code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def lowerCamelCase_ (UpperCamelCase__ : str ): _UpperCAmelCase : Optional[int] = [ '''encoder.version''', '''decoder.version...
358
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
68
0
"""simple docstring""" from math import log from scipy.constants import Boltzmann, physical_constants _lowerCAmelCase :Optional[Any] = 300 # TEMPERATURE (unit = K) def lowerCamelCase_ (UpperCamelCase__ : float , UpperCamelCase__ : float , UpperCamelCase__ : float , ): if...
359
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ (UpperCamelCase__ : list[int] , UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and a...
68
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_co...
360
"""simple docstring""" from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase_ (): _UpperCAmelCase : Optional[int] = [randint(-1000 , 1000 ) for i in range(10 )] _UpperCAme...
68
0
"""simple docstring""" def lowerCamelCase_ (UpperCamelCase__ : list[int] , UpperCamelCase__ : str ): _UpperCAmelCase : Tuple = int(UpperCamelCase__ ) # Initialize Result _UpperCAmelCase : Optional[Any] = [] # Traverse through all de...
361
"""simple docstring""" from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=a ): '''simple docstring''' a__ =['''transformers''', '''torch''', '''note_seq'''] def __init__( self , *A , **A ) -> int: requires_ba...
68
0
"""simple docstring""" from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCAmelCase :Optional[int] = logging.get_logger(__name__) _lowerCAmelCase :...
362
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _UpperCAmelCase ( unitt...
68
0
"""simple docstring""" from pathlib import Path import torch from ...utils import is_npu_available, is_xpu_available from .config_args import ClusterConfig, default_json_config_file from .config_utils import SubcommandHelpFormatter _lowerCAmelCase :List[Any] = 'Create a default config file for Accelerate ...
363
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin @flax...
68
0
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_toke...
364
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
68
0
"""simple docstring""" import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize('''dataset_size''' , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize('''input_in_memory_max_size''' , ['''default''', 0, 100 * 2**20, 900 * 2**2...
365
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class _UpperCAmelCase : '''simple docstring''' a__ ...
68
0
"""simple docstring""" import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated _lowerCAmelCase :List[Any] = collections.namedtuple('_...
366
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _UpperCAmelCase ( unittest.TestCase )...
68
0
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ (UpperCamelCase__ : list[int] , UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and a...
367
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class _UpperCAmelCase : '''simple docstring''' def __init__( self ) -> Tuple: _UpperCAmelCase : str = {} def __lo...
68
0
from math import ceil def lowerCamelCase_ (UpperCamelCase__ : List[str] , UpperCamelCase__ : Dict ): _UpperCAmelCase : Dict = list(range(0 , UpperCamelCase__ ) ) _UpperCAmelCase : Optional[Any] = [item for sublist in list(devi...
368
"""simple docstring""" from itertools import count def lowerCamelCase_ (UpperCamelCase__ : int = 50 ): _UpperCAmelCase : Tuple = [1] * min_block_length for n in count(UpperCamelCase__ ): fill_count_functions.append(1 ) for block_length in...
68
0
"""simple docstring""" def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int ): return int((input_a, input_a).count(1 ) != 0 ) def lowerCamelCase_ (): assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_g...
369
"""simple docstring""" import datasets from .evaluate import evaluate _lowerCAmelCase :int = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv p...
68
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _UpperCAmelCase ( unittest.TestCase ): ...
370
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch....
68
0
"""simple docstring""" import os from pathlib import Path def lowerCamelCase_ (UpperCamelCase__ : List[str] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Any ): _UpperCAmelCase : Union[str, Any] = { '''en''': '''Machine learning is great, i...
371
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def lowerCamelCase_ (): _UpperCAmelCase : int = HfArgumentParser(UpperCamelCase__ ) _UpperCAmelCase : Optional[Any] = parser.parse_args...
68
0
"""simple docstring""" import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL...
350
"""simple docstring""" import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCase ( a ,unittest.TestCase ): '''simple docstring'''...
68
0
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, ControlNetModel, DDIMScheduler, StableDiffusionControlNetImgaImgPipeline, U...
351
"""simple docstring""" import qiskit def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int ): _UpperCAmelCase : List[str] = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register _UpperCAmelCase...
68
0
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch....
352
"""simple docstring""" from ...processing_utils import ProcessorMixin class _UpperCAmelCase ( a ): '''simple docstring''' a__ ='''WhisperFeatureExtractor''' a__ ='''WhisperTokenizer''' def __init__( self , A , A ) -> Any: super().__i...
68
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase :int = logging.get_logger(__name__) _lowerCAmelCase :Union[str, Any] = { 'xlm-mlm-...
353
"""simple docstring""" _lowerCAmelCase :List[str] = 0 # The first color of the flag. _lowerCAmelCase :Optional[Any] = 1 # The second color of the flag. _lowerCAmelCase :List[Any] = 2 # The third color of the flag. _lowerCAmelCase :Any = (red, white, blue) def lowerCamelCase_ ...
68
0
"""simple docstring""" _lowerCAmelCase :Any = tuple[float, float, float] _lowerCAmelCase :Optional[Any] = tuple[float, float, float] def lowerCamelCase_ (UpperCamelCase__ : Pointad , UpperCamelCase__ : Pointad ): _UpperCAmelCase : str = end_pointa[0] - ...
354
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _lowerCAmelCase :int = get_logger(__name__) class _UpperCAmelCase ( enum.Enum ): '''simple docstring''' a__ ='''a...
68
0
"""simple docstring""" _lowerCAmelCase :List[str] = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : Tuple , UpperC...
355
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ....
68
0
"""simple docstring""" from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neu...
356
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase :int = logging.get_logger(__name__) _lowerCAmelCase :Union[str, Any] = { 'xlm-mlm-...
68
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _lowerCAmelCase :int = { 'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'], 'tokenization_tapas': ['T...
357
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : float = 1 / sqrt(2 ) ): _UpperCAmelCase : str = tau * fr...
68
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase :str = logging.get_logger(__name__) _lowerCAmelCase :Optional[int] = { 'google/bigbird-roberta-base': 'ht...
358
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
68
0
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_com...
359
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ (UpperCamelCase__ : list[int] , UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and a...
68
0
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def lowerCamelCase_ (UpperCamelCase__ : Dict ): _UpperCAmelCase : str = SwinConfig(image_size=192 ...
360
"""simple docstring""" from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase_ (): _UpperCAmelCase : Optional[int] = [randint(-1000 , 1000 ) for i in range(10 )] _UpperCAme...
68
0
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_toke...
361
"""simple docstring""" from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=a ): '''simple docstring''' a__ =['''transformers''', '''torch''', '''note_seq'''] def __init__( self , *A , **A ) -> int: requires_ba...
68
0
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from .....
362
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _UpperCAmelCase ( unitt...
68
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCAmelCase :List[Any] = { 'configuration_efficientformer': [ 'EFFICIENTFORMER_PRETRAIN...
363
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin @flax...
68
0
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor...
364
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
68
0
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: _lowerCAmelCase :Optional[int] = None try: import msvcrt except ImportError: _lowerCAmelCase :List[str] = None try: import fcntl except ImportError: _lowerCAm...
365
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class _UpperCAmelCase : '''simple docstring''' a__ ...
68
0
"""simple docstring""" def lowerCamelCase_ (UpperCamelCase__ : List[str] , UpperCamelCase__ : List[Any] , UpperCamelCase__ : Dict , UpperCamelCase__ : Optional[int] , UpperCamelCase__ : Any , UpperCamelCase__ : Any ): if index == r: for j in range(UpperCamel...
366
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _UpperCAmelCase ( unittest.TestCase )...
68
0
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_avai...
367
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class _UpperCAmelCase : '''simple docstring''' def __init__( self ) -> Tuple: _UpperCAmelCase : str = {} def __lo...
68
0
def lowerCamelCase_ (UpperCamelCase__ : Optional[int]=2_8123 ): _UpperCAmelCase : Optional[Any] = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1 ): ...
368
"""simple docstring""" from itertools import count def lowerCamelCase_ (UpperCamelCase__ : int = 50 ): _UpperCAmelCase : Tuple = [1] * min_block_length for n in count(UpperCamelCase__ ): fill_count_functions.append(1 ) for block_length in...
68
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :str = logging.get_logger(__name__) _lowerCAmelCase :Tuple = { 'facebook/wav2vec2-base-960h': 'https://huggingface.co/facebook/wav2vec2-base-96...
369
"""simple docstring""" import datasets from .evaluate import evaluate _lowerCAmelCase :int = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv p...
68
0
"""simple docstring""" import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.schedulers.scheduling_utils import SchedulerMixin from diffusers.utils import ...
370
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch....
68
0
"""simple docstring""" class _UpperCAmelCase : '''simple docstring''' def __init__( self , A , A , A ) -> int: _UpperCAmelCase : str = None _UpperCAmelCase : List[Any] = None _UpperCAmelCase : O...
371
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def lowerCamelCase_ (): _UpperCAmelCase : int = HfArgumentParser(UpperCamelCase__ ) _UpperCAmelCase : Optional[Any] = parser.parse_args...
68
0
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @...
350
"""simple docstring""" import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCase ( a ,unittest.TestCase ): '''simple docstring'''...
68
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow,...
351
"""simple docstring""" import qiskit def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int ): _UpperCAmelCase : List[str] = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register _UpperCAmelCase...
68
0
"""simple docstring""" import datasets from .evaluate import evaluate _lowerCAmelCase :int = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv p...
352
"""simple docstring""" from ...processing_utils import ProcessorMixin class _UpperCAmelCase ( a ): '''simple docstring''' a__ ='''WhisperFeatureExtractor''' a__ ='''WhisperTokenizer''' def __init__( self , A , A ) -> Any: super().__i...
68
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Tuple = logging.get_logger(__name__) _lowerCAmelCase :str = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', } ...
353
"""simple docstring""" _lowerCAmelCase :List[str] = 0 # The first color of the flag. _lowerCAmelCase :Optional[Any] = 1 # The second color of the flag. _lowerCAmelCase :List[Any] = 2 # The third color of the flag. _lowerCAmelCase :Any = (red, white, blue) def lowerCamelCase_ ...
68
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule _lowerCAmelCase :Tuple = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys _lowerCAme...
354
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _lowerCAmelCase :int = get_logger(__name__) class _UpperCAmelCase ( enum.Enum ): '''simple docstring''' a__ ='''a...
68
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Dict = logging.get_logger(__name__) _lowerCAmelCase :int = { 'vinvino02/glpn-kitti': 'https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json', # See all GLPN ...
355
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ....
68
0
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _lowerCAmelCase :int = get_logger(__name__) class _UpperCAmelCase ( enum.Enum ): '''simple docstring''' a__ ='''a...
356
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase :int = logging.get_logger(__name__) _lowerCAmelCase :Union[str, Any] = { 'xlm-mlm-...
68
0
"""simple docstring""" import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase_ (UpperCamelCase__ : Dict , UpperCamelCase__ : Any=1 ): if n_shave_prefix_segments >= 0: return ".".joi...
357
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : float = 1 / sqrt(2 ) ): _UpperCAmelCase : str = tau * fr...
68
0
def lowerCamelCase_ (UpperCamelCase__ : list[int] ): _UpperCAmelCase : Tuple = len(UpperCamelCase__ ) for i in range(UpperCamelCase__ ): for j in range(i + 1 , UpperCamelCase__ ): if numbers[j] < numbers[i]: _UpperC...
358
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
68
0
"""simple docstring""" import argparse import datetime import io import itertools import json import math import os import platform import re import shlex import subprocess import sys from pathlib import Path from statistics import fmean import pandas as pd import torch from tqdm import tqdm import transformers ...
359
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ (UpperCamelCase__ : list[int] , UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and a...
68
0
"""simple docstring""" from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( a ): ...
360
"""simple docstring""" from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase_ (): _UpperCAmelCase : Optional[int] = [randint(-1000 , 1000 ) for i in range(10 )] _UpperCAme...
68
0
"""simple docstring""" class _UpperCAmelCase : '''simple docstring''' def __init__( self ) -> None: _UpperCAmelCase : dict[str, TrieNode] = {} # Mapping from char to TrieNode _UpperCAmelCase : List[str] = False ...
361
"""simple docstring""" from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=a ): '''simple docstring''' a__ =['''transformers''', '''torch''', '''note_seq'''] def __init__( self , *A , **A ) -> int: requires_ba...
68
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Optional[int] = logging.get_logger(__name__) _lowerCAmelCase :List[str] = { 'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP...
362
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _UpperCAmelCase ( unitt...
68
0
"""simple docstring""" import argparse import os import re import packaging.version _lowerCAmelCase :List[str] = 'examples/' _lowerCAmelCase :Union[str, Any] = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile...
363
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin @flax...
68
0
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowerCAmelCase :int = logging.get_logger(__name__) ...
364
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
68
0
"""simple docstring""" from PIL import Image def lowerCamelCase_ (UpperCamelCase__ : Image ): _UpperCAmelCase : int = image.size _UpperCAmelCase : List[Any] = 0 _UpperCAmelCase : int = image.load() for i in range(UpperCame...
365
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class _UpperCAmelCase : '''simple docstring''' a__ ...
68
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device ...
366
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _UpperCAmelCase ( unittest.TestCase )...
68
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( OP...
367
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class _UpperCAmelCase : '''simple docstring''' def __init__( self ) -> Tuple: _UpperCAmelCase : str = {} def __lo...
68
0
from collections import deque from math import floor from random import random from time import time class _UpperCAmelCase : '''simple docstring''' def __init__( self ) -> Tuple: _UpperCAmelCase : str = {} def __lowerCAmelCase ( self...
368
"""simple docstring""" from itertools import count def lowerCamelCase_ (UpperCamelCase__ : int = 50 ): _UpperCAmelCase : Tuple = [1] * min_block_length for n in count(UpperCamelCase__ ): fill_count_functions.append(1 ) for block_length in...
68
0
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class _UpperCAmelCase ( nn.Module ): '''simple docstring''' a__ =4_2 a__ =jnp.floataa def __lowerCAmelCase ( self ) -> List[Any]: _UpperCAmelCase ...
369
"""simple docstring""" import datasets from .evaluate import evaluate _lowerCAmelCase :int = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv p...
68
0
"""simple docstring""" from __future__ import annotations class _UpperCAmelCase : '''simple docstring''' def __init__( self , A=None ) -> List[Any]: _UpperCAmelCase : Dict = data _UpperCAmelCase : Optional[int] = None ...
370
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch....
68
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Tuple = logging.get_logger(__name__) _lowerCAmelCase :List[Any] = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json', } class _U...
371
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def lowerCamelCase_ (): _UpperCAmelCase : int = HfArgumentParser(UpperCamelCase__ ) _UpperCAmelCase : Optional[Any] = parser.parse_args...
68
0
"""simple docstring""" import sys from collections import defaultdict class a : """simple docstring""" def __init__( self: Union[str, Any] ): """simple docstring""" A__ = [] def UpperCamelCase ( sel...
69
"""simple docstring""" import sys from collections import defaultdict class a : """simple docstring""" def __init__( self: Union[str, Any] ): """simple docstring""" A__ = [] def UpperCamelCase ( sel...
69
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
69
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configur...
69
1
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _snake_case ( ): with offline(OfflineSimulationMode.CONNE...
69
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor SCREAMING_SNAKE_CASE_ : int = logging.get_logger(__name__) class a ( _lowerCamelCase ): """simple docstring""" def ...
69
1
"""simple docstring""" from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput fro...
69
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is...
69
1
"""simple docstring""" import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel SCREAMING_S...
69
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets SCREAMING_SNAKE_CASE_ : List[str] = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n a...
69
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ : Tuple = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ : Optional[Any] = { 'asapp/sew-tiny-100k'...
69
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : int = 50 ): A__ = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length +...
69
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ : Optional[int] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ : Optional[int] = { 'microsoft/markuplm-base': 'https://huggingface.co...
69
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_ : Tuple = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ...
69
1
"""simple docstring""" from __future__ import annotations from collections import deque class a : """simple docstring""" def __init__( self: List[str] , UpperCamelCase: list[str] ): """simple docstring""" A__ = ...
69
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.pro...
69
1
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding...
69
"""simple docstring""" import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl....
69
1
"""simple docstring""" from scipy.stats import pearsonr import datasets SCREAMING_SNAKE_CASE_ : Union[str, Any] = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The ...
69
"""simple docstring""" import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor SCREAMING_SNAKE_CASE_ : Tuple = logging.get_logger(__name__) class a ( _lowerCamelCase ): """simple docstring""" def __in...
69
1
"""simple docstring""" import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE_ : Union[str...
69
"""simple docstring""" from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline SCREAMING_SNAKE_CASE_...
69
1
"""simple docstring""" import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _snake_case ( UpperCAmelCase_ : Union[str, Any] ): A__ = [ """encoder.version""", "...
69
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class a ( _lowerCamelC...
69
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_ : int = {'configuration_wavlm': ['WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'WavLMConfig']} try: if not is_torch_available...
69
"""simple docstring""" import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_a...
69
1
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE_ : Optional[Any] = logging...
69
"""simple docstring""" from typing import Any class a : """simple docstring""" def __init__( self: List[Any] , UpperCamelCase: Any ): """simple docstring""" A__ = data A__ = None ...
69
1
"""simple docstring""" import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_a...
69
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch...
69
1
"""simple docstring""" SCREAMING_SNAKE_CASE_ : Union[str, Any] = range(2, 2_0 + 1) SCREAMING_SNAKE_CASE_ : Dict = [1_0**k for k in range(ks[-1] + 1)] SCREAMING_SNAKE_CASE_ : dict[int, dict[int, list[list[int]]]] = {} def _snake_case ( Uppe...
69
"""simple docstring""" import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
69
1
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : list[list[int]] , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : list[int] ): # 1. Validate that path exists between current and next vertices if graph[path[curr_...
69
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def _snake_case ( UpperCAmelCase_ : int="ro" , UpperCAmelCase_ : Optional[int]="en" , UpperCAmelCase_ : List[Any]="wmt16" , UpperCAmelCase_ : str=None ): ...
69
1
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : int = 100 ): A__ = (n * (n + 1) // 2) ** 2 A__ = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(f"""{solution() = }""") ...
69
"""simple docstring""" import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE_ : Union[str...
69
1
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : int ): A__ = [[0 for _ in range(UpperCAmelCase_ )] for _ in range(m + 1 )] for i in range(m + 1 ): A__ = 1 for n in range(m + 1 ): for k in ...
69
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ : List[str] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ : str = { 'funnel-transformer/small': 'https://huggingface.co/funnel-trans...
69
1
"""simple docstring""" import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def _snake_case ( UpperCAmelCase_ :...
69
"""simple docstring""" from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL i...
69
1
"""simple docstring""" import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class a ( _lowerCamelCase ): """simple docstring""" @require_torch def...
69
"""simple docstring""" import argparse SCREAMING_SNAKE_CASE_ : Any = 'docs/source/_static/js/custom.js' def _snake_case ( UpperCAmelCase_ : List[Any] ): with open(UpperCAmelCase_ , encoding="""utf-8""" , newline="""\n""" ) as f: ...
69
1
"""simple docstring""" import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast SCREAMING_SNAKE_CASE_ : Optional[int] = datasets.utils.logging.get_...
69
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSD...
69
1
"""simple docstring""" from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..p...
69
"""simple docstring""" import sys from collections import defaultdict class a : """simple docstring""" def __init__( self: Union[str, Any] ): """simple docstring""" A__ = [] def UpperCamelCase ( sel...
69
1
"""simple docstring""" from math import sqrt def _snake_case ( UpperCAmelCase_ : int = 100_0000 ): A__ = 0 A__ = 0 A__ = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_sh...
69
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configur...
69
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
69
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor SCREAMING_SNAKE_CASE_ : int = logging.get_logger(__name__) class a ( _lowerCamelCase ): """simple docstring""" def ...
69
1
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -...
69
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is...
69
1
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : bool = False ): if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit ...
69
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets SCREAMING_SNAKE_CASE_ : List[str] = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n a...
69
1
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def _snake_case ( UpperCA...
69
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : int = 50 ): A__ = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length +...
69
1
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _snake_case ( ): A__ = HfArgumentParser(UpperCAmelCase_ ) A__ = parser.parse_args_into_dataclasses()[0] A__ ...
69
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_ : Tuple = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ...
69
1
"""simple docstring""" import collections import inspect import unittest from transformers import FocalNetConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...t...
69
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.pro...
69
1
"""simple docstring""" import math import sys def _snake_case ( UpperCAmelCase_ : int ): if number != int(UpperCAmelCase_ ): raise ValueError("""the value of input must be a natural number""" ) if number < 0: raise ValueError("""the ...
69
"""simple docstring""" import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl....
69
1
"""simple docstring""" from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer SCREAMING_SNAKE_CASE_ : Optional[Any] = logging.get_logger(__name__) SCREA...
69
"""simple docstring""" import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor SCREAMING_SNAKE_CASE_ : Tuple = logging.get_logger(__name__) class a ( _lowerCamelCase ): """simple docstring""" def __in...
69
1
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def _snake_case ( ): A__ = {} A__ = 2 while True: A__ = factor_map.pop(UpperCAmelCase_ , UpperCAmelCase_ ...
69
"""simple docstring""" from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline SCREAMING_SNAKE_CASE_...
69
1
"""simple docstring""" from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUE...
69
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class a ( _lowerCamelC...
69
1
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import _LazyModule SCREAMING_SNAKE_CASE_ : str = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys SCREAMING_SNAKE_CASE_ ...
69
"""simple docstring""" import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_a...
69
1
"""simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} SCREAMING_SNAKE_CASE_ : int = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _snake_case ( UpperCAmelCase_ : dict[int, list[int]] , ...
69
"""simple docstring""" from typing import Any class a : """simple docstring""" def __init__( self: List[Any] , UpperCamelCase: Any ): """simple docstring""" A__ = data A__ = None ...
69
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE_ : List[Any] = {'configuration_swin': ['SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwinConfig', 'SwinOnnxConfig'...
69
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch...
69
1
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common i...
69
"""simple docstring""" import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
69
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizati...
69
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def _snake_case ( UpperCAmelCase_ : int="ro" , UpperCAmelCase_ : Optional[int]="en" , UpperCAmelCase_ : List[Any]="wmt16" , UpperCAmelCase_ : str=None ): ...
69
1
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -...
69
"""simple docstring""" import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE_ : Union[str...
69
1
"""simple docstring""" import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration SCREAMING_SNAKE_CASE_ : Dict = 5_0_0_0_0 SCREAMING_SNAKE_CASE_ : Optional[Any] = 5_0_0_0 SCREAMING_SNAKE_CASE_ ,SCREAMING_SNAK...
69
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ : List[str] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ : str = { 'funnel-transformer/small': 'https://huggingface.co/funnel-trans...
69
1
"""simple docstring""" from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class a ( _lowerCamelCase ): """simpl...
69
"""simple docstring""" from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL i...
69
1