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 unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class _UpperCAmelCase ( unit...
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 gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin,...
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 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 ......
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 typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase :str = { 'configuration_rembert': ['REMBERT_PRE...
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 from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer el...
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
def lowerCamelCase_ (): return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(_SCREAMING_SNAKE_CASE , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print(f"{solution() = }")
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 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...
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 __future__ import annotations import math def lowerCamelCase_ (UpperCamelCase__ : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, ...
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""" import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from...
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 typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCAmelCase :List[str] = {'configuration_vit_mae': ['VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMAEC...
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 json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer _lowerCAmelCase :Any = logging.get_logger(__name__...
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 ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :List[str] = logging.get_logger(__name__) _lowerCAmelCase :Tuple = { '''facebook/s2t-small-librispeech-asr''': ( '''https://huggingface.co/facebook/s2t-smal...
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 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__ =4_2 a__ =None...
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 numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class _UpperCAmelCase ( UpperCAmelCase__ ): '''si...
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 collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase :Dict = logging.get_logger(__name__) _lowerCAmelCase :List[str] = { 'facebook/xmod-ba...
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""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType _lowerCAm...
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""" def lowerCamelCase_ (UpperCamelCase__ : str , UpperCamelCase__ : bool = False ): if not isinstance(_lowercase , _lowercase ): _UpperCAmelCase : List[Any] = F'Expected string as input, found {type(_lowercase )}' ...
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 os import sys _lowerCAmelCase :int = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenc...
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 try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore _lowerCAmelCase :int = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" _lowerCAmelCase :Optional[Any] = [file for file in filepat...
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 json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer _lowerCAmelCase :List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': ...
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 argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_check...
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 copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from dat...
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__ : int = 1000 ): _UpperCAmelCase : Tuple = -1 _UpperCAmelCase : Optional[Any] = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c _UpperC...
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 re from ..models.auto import AutoProcessor from ..models.vision_encoder_decoder import VisionEncoderDecoderModel from ..utils import is_vision_available from .base import PipelineTool if is_vision_available(): from PIL import Image class _UpperCAmelCase ( _lowerCAme...
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 argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaP...
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 ....utils import logging _lowerCAmelCase :List[Any] = logging.get_logger(__name__) class _UpperCAmelCase ( snake_case_ ): '''simple docstring''' def __init__( self , A , A=None , A=2_0_4_8 ) -> Union[str, Any]: _Uppe...
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""" _lowerCAmelCase :Optional[int] = "\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://gi...
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
def lowerCamelCase_ (UpperCamelCase__ : str ): _UpperCAmelCase : int = [int(lowerCAmelCase__ ) for i in ip_va_address.split('''.''' ) if i.isdigit()] return len(lowerCAmelCase__ ) == 4 and all(0 <= int(lowerCAmelCase__ ) <= 254 for octet in octets ...
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 os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase :int = logging.get_logger(__name__) _lowerCAmelCase :Tuple ...
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 __future__ import annotations from collections.abc import Callable def lowerCamelCase_ (UpperCamelCase__ : Callable[[int | float], int | float] , UpperCamelCase__ : int | float , UpperCamelCase__ : int | float , UpperCamelCase__ : int = 100 , ): ...
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""" def lowerCamelCase_ (UpperCamelCase__ : List[str] = 1000 ): _UpperCAmelCase : Any = 2**power _UpperCAmelCase : List[str] = str(UpperCamelCase__ ) _UpperCAmelCase : Optional[Any] = list(UpperCamelCase__...
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""" 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_device from tra...
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 json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from trans...
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""" def lowerCamelCase_ (UpperCamelCase__ : str ): return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
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
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : List[str] , UpperCamelCase__ : Tuple , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Tuple , U...
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 typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _lowerCAmelCase :int = {'configuration_speech_encoder_decoder': ['SpeechEncoderDecoderConfig']} try: if not is_torch_available(): raise Opti...
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 torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( lowerCamelCase__ ): '''simple docstring''' a__ =(EulerDiscreteScheduler,) 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""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase :Dict = { 'configuration_informer': [ 'INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InformerConf...
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 collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_availab...
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 json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) ...
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 argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --host <host> --key_path ...
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 random def lowerCamelCase_ (UpperCamelCase__ : str , UpperCamelCase__ : List[Any] , UpperCamelCase__ : List[Any] ): _UpperCAmelCase : Tuple = a[left_index] _UpperCAmelCase : List[Any] = left_index + 1 fo...
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 torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _UpperCAmelCase ( UpperCAmelCase_ ,UpperCAmelCase_ ): '''simple docstring''' @register_to_config def __init__(...
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 ): if not nums: raise ValueError('''List is empty''' ) return sum(snake_case_ ) / len(snake_case_ ) if __name__ == "__main__": import doctest docte...
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 OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...util...
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 datasets from .evaluate import evaluate _lowerCAmelCase :List[str] = '\\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={a...
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 import math def lowerCamelCase_ (UpperCamelCase__ : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, al...
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 math def lowerCamelCase_ (UpperCamelCase__ : Optional[int] ): return math.sqrt(UpperCamelCase__ ) * math.sqrt(UpperCamelCase__ ) == num def lowerCamelCase_ (UpperCamelCase__ : Optional[Any] ): _UpperCAmelCase : Option...
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 inspect import unittest from transformers import ConvNextConfig 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 ...test_backbone_common import Backbon...
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
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets....
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 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, LMSDiscreteScheduler, ...
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""" import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowerCamelCase_ (): raise RuntimeError('''CUDA out of memory.''' ) class _UpperCA...
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""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import tor...
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""" def lowerCamelCase_ (UpperCamelCase__ : int = 6008_5147_5143 ): try: _UpperCAmelCase : List[str] = int(UpperCamelCase__ ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castable to int.''' )...
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 collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_o...
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 unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTes...
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
_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_ (UpperCamelCase__ : l...
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 typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageIn...
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 import numpy as np def lowerCamelCase_ (UpperCamelCase__ : dict ): _UpperCAmelCase : Optional[Any] = {key: len(UpperCamelCase__ ) for key, value in gen_kwargs.items() if isinstance(UpperCamelCase__ , UpperCamelCase__ ...
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""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_at...
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 json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeC...
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 json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common ...
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
from typing import List from .keymap import KEYMAP, get_character def lowerCamelCase_ (UpperCamelCase__ : str ): def decorator(UpperCamelCase__ : Optional[Any] ): _UpperCAmelCase : Tuple = getattr(UpperCamelCase__ , '''handle_key''' , [] ) ...
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 typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase :Dict = { 'configuration_longformer': [ 'LONGFORMER_PRETRAINED_CO...
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 unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class _UpperCAmelCase ( a ...
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 Any class _UpperCAmelCase : '''simple docstring''' def __init__( self , A ) -> str: _UpperCAmelCase : Union[str, Any] = data _UpperCAmelCase : Optional[int] = None de...
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 typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase :Union[str, Any] = { 'configuration_bert': ['...
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__ : list ): if len(UpperCamelCase__ ) <= 1: return [tuple(UpperCamelCase__ )] _UpperCAmelCase : Dict = [] def generate(UpperCamelCase__ : int , UpperCamelCase__ : list ): ...
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 os import numpy import onnx def lowerCamelCase_ (UpperCamelCase__ : Tuple , UpperCamelCase__ : int ): _UpperCAmelCase : List[str] = a.name _UpperCAmelCase : List[Any] = b.name _UpperCAmelCase : List[Any...
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 gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel...
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""" def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int ): _UpperCAmelCase : Optional[Any] = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series re...
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 argparse import os from accelerate.test_utils import execute_subprocess_async def lowerCamelCase_ (UpperCamelCase__ : Union[str, Any]=None ): if subparsers is not None: _UpperCAmelCase : List[str] = subparsers.add_parser('''test''' ) else: ...
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 os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_...
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""" def lowerCamelCase_ (): _UpperCAmelCase : Union[str, Any] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _UpperCAmelCase : Any = 6 _UpperCAmelCase : Dict = 1 _UpperCAmelCase : List[str] = ...
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""" def lowerCamelCase_ (): for n in range(1 , 100_0000 ): yield n * (n + 1) // 2 def lowerCamelCase_ (UpperCamelCase__ : Dict ): _UpperCAmelCase : Optional[int] = 1 _UpperCAmelCase : Tuple = 2 w...
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 typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, re...
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""" _lowerCAmelCase :Any = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' _lowerCAm...
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 ...processing_utils import ProcessorMixin class _UpperCAmelCase ( a ): '''simple docstring''' a__ ='''WhisperFeatureExtractor''' a__ ='''WhisperTokenizer''' def __init__( self , A , A ) -> An...
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
import re import string import numpy as np import datasets _lowerCAmelCase :str = '\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n' _lowerCAmelCase :Tuple = '\nArgs:\n predictions: List of...
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 torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _lowerCAmelCase :List[Any] = logging.get_logger(__name__) def lowerCamelCase_ (UpperCamelCase__ : str , UpperCamelCase__ : List[A...
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 os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is...
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 string def lowerCamelCase_ (UpperCamelCase__ : str ): _UpperCAmelCase : Tuple = '''''' for i in sequence: _UpperCAmelCase : Union[str, Any] = ord(UpperCamelCase__ ) if 65 <= extract <= 90: ...
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 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...
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 tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( a ): '''simple docstring''' a__ =(PNDMScheduler,) a__ =(('''num_inference_steps''', 5_0),) d...
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
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accele...
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 ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=a ): '''simple docstring''' a__ =['''transformers''', '''torch''', '''note_seq'''] def __init__( self , *A , **A ) -> int: requires_ba...
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 copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=a ) class _UpperCAmelCase ( a ): '''simple docstring''' a__ =f...
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 argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --...
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__ : int ): _UpperCAmelCase : Optional[int] = int(UpperCamelCase__ ) if n_element < 1: _UpperCAmelCase : Any = ValueError('''a should be a positive number''' ) raise my_error _UpperCAmel...
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 inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as np...
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 import os from typing import Any import requests _lowerCAmelCase :str = 'https://api.github.com' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user _lowerCAmelCase :Any = BASE_URL + '/user' # http...
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 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__ ...
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""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( CommonSchedulerState, FlaxKarrasDiffusionSchedulers, ...
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
_lowerCAmelCase :Tuple = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def lowerCamelCase_ (UpperCamelCase__ : dict , UpperCamelCase__ : Tuple , UpperCamelCase__ : int ...
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""" from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin...
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""" import os import sys import transformers _lowerCAmelCase :str = '3' print('Python version:', sys.version) print('transformers version:', transformers.__version__) try: import torch print('Torch version:', torch.__version__) print('Cuda available:', torch.cuda.is_available...
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 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 i...
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 . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit, ...
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 functools import reduce _lowerCAmelCase :Tuple = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' ...
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 __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 )...
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