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 gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_determinism, load_nump...
36
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class UpperCAme...
36
1
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand lowercase : Tuple = logging.get_logger(__name__) # pylint: disable=invalid-name def lowe...
36
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments ...
36
1
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( "kwargs, expected" , [ ({"num_shards": 0, "max_num_jobs": 1}, []), ({"num_shards": 10, "max_num_jobs": 1}, [range(10 )]), ({"nu...
36
import argparse import copy def lowerCAmelCase__ ( _a : List[Any] ): snake_case_ : List[Any] = {} with open(_a ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: snake_case_ : int = [] _list.append([line.spl...
36
1
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' def _lowerCAmelCase ( self , _SCREAMING_SNAKE_CASE ) -> ...
36
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowercase : Any = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} ...
36
1
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( _a : int , _a : str , _a : List[Any] ): # Initialise...
36
def lowerCAmelCase__ ( _a : float , _a : float ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": ...
36
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowercase : Tuple = {'''configuration_speech_encoder_decoder''': ['''SpeechEncoderDecoderConfig''']} try: if not is_torch_available(): ...
36
def lowerCAmelCase__ ( _a : int = 50 ): snake_case_ : Union[str, Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ): ...
36
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_fnet im...
36
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECK...
36
1
import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers cla...
36
import datasets from .evaluate import evaluate lowercase : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint ...
36
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : List[str] = { '''configuration_trajectory_transformer''': [ '''TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TrajectoryTr...
36
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
1
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowercase : List[Any] = get_tests_dir('''fixtures/test_sentencepi...
36
def lowerCAmelCase__ ( _a : dict ): snake_case_ : List[Any] = set() # edges = list of graph's edges snake_case_ : int = get_edges(_a ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) and add his extre...
36
1
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask lowercase : Any = logging.getLogger(__name__) class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simp...
36
import numpy as np def lowerCAmelCase__ ( _a : np.array ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
36
1
def lowerCAmelCase__ ( _a : int ): if n == 1 or not isinstance(_a , _a ): return 0 elif n == 2: return 1 else: snake_case_ : Any = [0, 1] for i in range(2 , n + 1 ): sequence.append(sequence[i - 1] + sequence[i - 2] ) r...
36
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCAmelCase__ ( _a : str ): snake_case_ : str = FileLock(str(tmpdir / "foo.lock" ) ) snake_case_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock" ...
36
1
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowercase : Union[str, Any] = importlib.util.find_spec('''s3fs''') is not None if _has_safs: ...
36
from __future__ import annotations def lowerCAmelCase__ ( _a : str , _a : str ): snake_case_ : Optional[Any] = get_failure_array(_a ) # 2) Step through text searching for pattern snake_case_ , snake_case_ : Dict = 0, 0 # index into te...
36
1
def lowerCAmelCase__ ( _a : int = 50 ): snake_case_ : Union[str, Any] = [[0] * 3 for _ in range(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 + 1 )...
36
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase__ ( ): snake_case_ : str = ArgumentParser( description=( "PyTorch TPU distributed training l...
36
1
import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging lowercase : Any ...
36
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py lowercase : Optional[Any] = '''src/diffusers''' # Matches is_xxx_available() lowercase : Any ...
36
1
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert.tokenization_...
36
lowercase : Optional[int] = { '''Pillow''': '''Pillow''', '''accelerate''': '''accelerate>=0.11.0''', '''compel''': '''compel==0.1.8''', '''black''': '''black~=23.1''', '''datasets''': '''datasets''', '''filelock''': '''filelock''', '''flax''': '''flax>=0.4.1''...
36
1
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): '''simple docstring''' @register_to_config def __init__( s...
36
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' A : Tuple = ['image_processor', 'tokenizer'] A : Tuple = 'AutoIm...
36
1
from __future__ import annotations import bisect def lowerCAmelCase__ ( _a : list[int] , _a : int , _a : int = 0 , _a : int = -1 ): if hi < 0: snake_case_ : str = len(_a ) while lo < hi: snake_case_ : Union[str, An...
36
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils ...
36
1
def lowerCAmelCase__ ( _a : Optional[Any] , _a : List[Any] , _a : List[Any] , _a : Any ): if height >= 1: move_tower(height - 1 , _a , _a , _a ) move_disk(_a , _a ) move_tower(height - 1 , _a , _a , _a ...
36
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers...
36
1
import math def lowerCAmelCase__ ( _a : int ): snake_case_ : str = [True] * n snake_case_ : List[Any] = False snake_case_ : int = False snake_case_ : Union[str, Any] = True for i in range(3 , int(n**0.5 + 1 ) , ...
36
import copy 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 ..auto import CONFIG_MAPPING lowercase : List[Any] = logging.ge...
36
1
import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state import GradientState, ...
36
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
36
1
import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowerCAmelCase__ ( _a : int , _a : int=7 ): snake_case_ : Any = None if token is not None: snake_case_ : Optional[int] = ...
36
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils im...
36
1
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_...
36
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class UpperCAme...
36
1
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase : int = logging.get_logger(__name__) lowercase : List...
36
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments ...
36
1
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def lowerCAmelCase__ ( _a : int = 8 ): snake_case_ : Any = ascii_letters + digits + punctuation return "".join(secrets.choice(_a ) for ...
36
import argparse import copy def lowerCAmelCase__ ( _a : List[Any] ): snake_case_ : List[Any] = {} with open(_a ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: snake_case_ : int = [] _list.append([line.spl...
36
1
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import r...
36
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowercase : Any = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} ...
36
1
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCAmelCase__ ( _a : List[Any] , _a : bool = True , _a : float = math.inf , _a : float = -math.inf , _a : float = math.inf , _a : float = -...
36
def lowerCAmelCase__ ( _a : float , _a : float ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": ...
36
1
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
36
def lowerCAmelCase__ ( _a : int = 50 ): snake_case_ : Union[str, Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ): ...
36
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECK...
36
1
import math from collections.abc import Iterator from itertools import takewhile def lowerCAmelCase__ ( _a : 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, all multip...
36
import datasets from .evaluate import evaluate lowercase : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint ...
36
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) lowercase : Optional[int] = {'''configuration_beit''': ['''BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Be...
36
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
1
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface_hub.utils as hf...
36
def lowerCAmelCase__ ( _a : dict ): snake_case_ : List[Any] = set() # edges = list of graph's edges snake_case_ : int = get_edges(_a ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) and add his extre...
36
1
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import P...
36
import numpy as np def lowerCAmelCase__ ( _a : np.array ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
36
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCAmelCase__ ( _a : str ): snake_case_ : str = FileLock(str(tmpdir / "foo.lock" ) ) snake_case_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock" ...
36
1
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_model...
36
from __future__ import annotations def lowerCAmelCase__ ( _a : str , _a : str ): snake_case_ : Optional[Any] = get_failure_array(_a ) # 2) Step through text searching for pattern snake_case_ , snake_case_ : Dict = 0, 0 # index into te...
36
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if ...
36
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase__ ( ): snake_case_ : str = ArgumentParser( description=( "PyTorch TPU distributed training l...
36
1
# 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 # # Unless required by ap...
36
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py lowercase : Optional[Any] = '''src/diffusers''' # Matches is_xxx_available() lowercase : Any ...
36
1
def lowerCAmelCase__ ( _a : int , _a : Dict ): return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCAmelCase__ ( _a : Dict , _a : List[str]=0 ): return sorted(_a , key=lambda _a : x[column] ) def ...
36
lowercase : Optional[int] = { '''Pillow''': '''Pillow''', '''accelerate''': '''accelerate>=0.11.0''', '''compel''': '''compel==0.1.8''', '''black''': '''black~=23.1''', '''datasets''': '''datasets''', '''filelock''': '''filelock''', '''flax''': '''flax>=0.4.1''...
36
1
lowercase : Union[str, Any] = 0 # The first color of the flag. lowercase : int = 1 # The second color of the flag. lowercase : int = 2 # The third color of the flag. lowercase : Tuple = (red, white, blue) def ...
36
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' A : Tuple = ['image_processor', 'tokenizer'] A : Tuple = 'AutoIm...
36
1
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 lowercase : str = logging.get_logger(__name__) lowercase : Optional[A...
36
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils ...
36
1
from __future__ import annotations def lowerCAmelCase__ ( _a : list , _a : int | None = None , _a : int | None = None ): if start is None: snake_case_ : Dict = 0 if end is None: snake_case_ : Tuple = len(_a ) - 1 if st...
36
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers...
36
1
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 import ModelTesterMixin, ids_tensor f...
36
import copy 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 ..auto import CONFIG_MAPPING lowercase : List[Any] = logging.ge...
36
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
36
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
36
1
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' A : Tuple = ['image_processor', 'tokenizer'] A : Tuple = 'AutoIm...
36
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils im...
36
1
import math from datetime import datetime, timedelta def lowerCAmelCase__ ( _a : int ): snake_case_ : Union[str, Any] = year % 19 snake_case_ : List[str] = year % 4 snake_case_ : str = year % 7 snake_case_ : Optional[Any] = mat...
36
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class UpperCAme...
36
1
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def lowerCAmelCase__ ( _a : List[str...
36
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments ...
36
1
import cva import numpy as np class UpperCAmelCase_ : '''simple docstring''' def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: if k in (0.04, 0.06): snake_case_ : Optional[int] = k snake_case_ :...
36
import argparse import copy def lowerCAmelCase__ ( _a : List[Any] ): snake_case_ : List[Any] = {} with open(_a ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: snake_case_ : int = [] _list.append([line.spl...
36
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : str = { '''configuration_nllb_moe''': [ '''NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NllbMoeConfig''', ] } try: if not i...
36
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowercase : Any = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} ...
36
1
import argparse import json import subprocess def lowerCAmelCase__ ( _a : Optional[Any] , _a : Optional[Any] ): snake_case_ : int = [] snake_case_ : Optional[int] = ( F'''curl -H "Accept: application/vnd.github+json" -H "Authorization: Bea...
36
def lowerCAmelCase__ ( _a : float , _a : float ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": ...
36
1
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( _a : List[str] , _a : str , _a : Dict=10_24 , _a : str=10_24 , _a : ...
36
def lowerCAmelCase__ ( _a : int = 50 ): snake_case_ : Union[str, Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ): ...
36
1
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWi...
36
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECK...
36
1
import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoModelForQuestionAnswerin...
36
import datasets from .evaluate import evaluate lowercase : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint ...
36
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase : str = logging.get_logger(__name__) lowercase : Optional[Any] = { '''ca...
36
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
1
from typing import TYPE_CHECKING from ...utils import _LazyModule lowercase : int = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys ...
36
def lowerCAmelCase__ ( _a : dict ): snake_case_ : List[Any] = set() # edges = list of graph's edges snake_case_ : int = get_edges(_a ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) and add his extre...
36
1
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 from .import_utils...
36
import numpy as np def lowerCAmelCase__ ( _a : np.array ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
36
1
import warnings 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_ ( SCREAMING_SNAKE_CASE...
36
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCAmelCase__ ( _a : str ): snake_case_ : str = FileLock(str(tmpdir / "foo.lock" ) ) snake_case_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock" ...
36
1
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def lowerCAmelCase__ ( _a : Optional[int] ): # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikipedia.org/wiki/CJK_Unified_Ideo...
36
from __future__ import annotations def lowerCAmelCase__ ( _a : str , _a : str ): snake_case_ : Optional[Any] = get_failure_array(_a ) # 2) Step through text searching for pattern snake_case_ , snake_case_ : Dict = 0, 0 # index into te...
36
1
# Copyright (c) 2021-, NVIDIA CORPORATION. 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 # # Unless required ...
36
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase__ ( ): snake_case_ : str = ArgumentParser( description=( "PyTorch TPU distributed training l...
36
1
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, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.utils import floats_tensor,...
36
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py lowercase : Optional[Any] = '''src/diffusers''' # Matches is_xxx_available() lowercase : Any ...
36
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : Union[str, Any] = logging.get_logger(__name__) class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' A : Union[str, Any] = 't...
350
lowercase : Optional[int] = { '''Pillow''': '''Pillow''', '''accelerate''': '''accelerate>=0.11.0''', '''compel''': '''compel==0.1.8''', '''black''': '''black~=23.1''', '''datasets''': '''datasets''', '''filelock''': '''filelock''', '''flax''': '''flax>=0.4.1''...
36
0
from datetime import datetime as dt import os from github import Github lowercase : Optional[Any] = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def lowerCAmelCase__ ...
351
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' A : Tuple = ['image_processor', 'tokenizer'] A : Tuple = 'AutoIm...
36
0
from typing import Dict from .base import GenericTensor, Pipeline class UpperCAmelCase_ ( _UpperCAmelCase ): '''simple docstring''' def _lowerCAmelCase ( self , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None , ...
352
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils ...
36
0
from ..utils import DummyObject, requires_backends class UpperCAmelCase_ ( metaclass=A__ ): '''simple docstring''' A : Union[str, Any] = ['transformers', 'torch', 'note_seq'] def __init__( self , *_SCREAMING_SNAKE_CASE , **_SCREAMING_SNAKE_C...
353
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers...
36
0
import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( _a : Union[str, Any] , _a : Dict ,...
354
import copy 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 ..auto import CONFIG_MAPPING lowercase : List[Any] = logging.ge...
36
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase : Union[str, Any] = { '''configuration_efficientnet''': [ '''EFFICIENTNET_PRETRAINED_CO...
355
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
36
0
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCAmelCase__ ( ): snake_case_ : Optional[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "path": ["test_1.p...
356
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils im...
36
0
import sys def lowerCAmelCase__ ( _a : int ): snake_case_ : int = len(__A ) snake_case_ : int = [[0 for x in range(__A )] for x in range(__A )] snake_case_ : Dict = [[0 for x in range(__A )] for x in range(__A )] f...
357
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class UpperCAme...
36
0
def lowerCAmelCase__ ( _a : int = 2_00 ): snake_case_ : Dict = [1, 2, 5, 10, 20, 50, 1_00, 2_00] snake_case_ : Optional[Any] = [0] * (pence + 1) snake_case_ : Optional[int] = 1 # base case: 1 way to make 0 pence for coin in coins: for ...
358
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments ...
36
0
"""simple docstring""" import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase : Tuple = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pr...
359
import argparse import copy def lowerCAmelCase__ ( _a : List[Any] ): snake_case_ : List[Any] = {} with open(_a ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: snake_case_ : int = [] _list.append([line.spl...
36
0
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import...
360
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowercase : Any = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} ...
36
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase : int = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], } try: if...
361
def lowerCAmelCase__ ( _a : float , _a : float ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": ...
36
0
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @requ...
362
def lowerCAmelCase__ ( _a : int = 50 ): snake_case_ : Union[str, Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ): ...
36
0
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEX...
363
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECK...
36
0
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration lowercase : Union[str, Any] = 50_00_00 lowercase ,lowercase : Union[str, Any] = os.path.split(__file__) lowercase : ...
364
import datasets from .evaluate import evaluate lowercase : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint ...
36
0
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def lowerCAmelCase__ ( _a : List[str] ): snake_case_ : List[Any] = args.pruning_method snake_case_ : Tuple = args.thresh...
365
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
0
from functools import lru_cache def lowerCAmelCase__ ( _a : int ): snake_case_ : Tuple = 2 snake_case_ : int = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(lowerCAmelCase__ ) if n > 1: factors.add...
366
def lowerCAmelCase__ ( _a : dict ): snake_case_ : List[Any] = set() # edges = list of graph's edges snake_case_ : int = get_edges(_a ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) and add his extre...
36
0
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def lowerCAmelCase__ ( *_a : str ): if not isinstance(a_ , a_ ): snake_case_ : Optional[int] = list(a_ ) for i in range(len(a_ ) ...
367
import numpy as np def lowerCAmelCase__ ( _a : np.array ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
36
0
from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def lowerCAmelCase__ ( _a : Optional[Any] ): return getitem, k def lowerCAmelCase__ ( _a : str , _a : int ): return seti...
368
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCAmelCase__ ( _a : str ): snake_case_ : str = FileLock(str(tmpdir / "foo.lock" ) ) snake_case_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock" ...
36
0
import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowercase : str = logging.get_logger(__name__) lowercase ...
369
from __future__ import annotations def lowerCAmelCase__ ( _a : str , _a : str ): snake_case_ : Optional[Any] = get_failure_array(_a ) # 2) Step through text searching for pattern snake_case_ , snake_case_ : Dict = 0, 0 # index into te...
36
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : Optional[int] = logging.get_logger(__name__) lowercase : Tuple = { '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-h...
370
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase__ ( ): snake_case_ : str = ArgumentParser( description=( "PyTorch TPU distributed training l...
36
0
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_available, is_vision_availa...
371
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py lowercase : Optional[Any] = '''src/diffusers''' # Matches is_xxx_available() lowercase : Any ...
36
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowercase : List[str] = { '''configuration_owlvit...
350
lowercase : Optional[int] = { '''Pillow''': '''Pillow''', '''accelerate''': '''accelerate>=0.11.0''', '''compel''': '''compel==0.1.8''', '''black''': '''black~=23.1''', '''datasets''': '''datasets''', '''filelock''': '''filelock''', '''flax''': '''flax>=0.4.1''...
36
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembe...
351
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' A : Tuple = ['image_processor', 'tokenizer'] A : Tuple = 'AutoIm...
36
0
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def lowerCAmelCase__ ( ): print("Making key files..." ) make_key_files("rsa" , 10_24 ) print("Key files generation successful."...
352
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils ...
36
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedKVPro...
353
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers...
36
0
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, prepare_image_inputs if is_torch_available(): import ...
354
import copy 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 ..auto import CONFIG_MAPPING lowercase : List[Any] = logging.ge...
36
0
def lowerCAmelCase__ ( _a : int ): snake_case_ : Optional[Any] = [], [] while len(snake_case_ ) > 1: snake_case_ : Optional[Any] = min(snake_case_ ), max(snake_case_ ) start.append(snake_case_ ) end.append(snake_case_ ) ...
355
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
36
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_avail...
356
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils im...
36
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : Union[str, Any] = logging.get_logger(__name__) lowercase : List[Any] = { '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/main/...
357
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class UpperCAme...
36
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase : Dict = { '''configuration_whisper''': ['''WHISPER_PRETRAINED_C...
358
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments ...
36
0
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_f...
359
import argparse import copy def lowerCAmelCase__ ( _a : List[Any] ): snake_case_ : List[Any] = {} with open(_a ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: snake_case_ : int = [] _list.append([line.spl...
36
0
import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def lowerCAmelCase__ ( ...
360
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowercase : Any = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} ...
36
0
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCas...
361
def lowerCAmelCase__ ( _a : float , _a : float ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": ...
36
0
def lowerCAmelCase__ ( _a : Optional[int] ): if number < 0: raise ValueError("number must not be negative" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
362
def lowerCAmelCase__ ( _a : int = 50 ): snake_case_ : Union[str, Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ): ...
36
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : Tuple = logging.get_logger(__name__) lowercase : Any = { '''EleutherAI/gpt-neox-20b''': '''https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json'''...
363
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECK...
36
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.hu...
364
import datasets from .evaluate import evaluate lowercase : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint ...
36
0
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tens...
365
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyN...
36
0
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, UNetTesterMixin l...
366
def lowerCAmelCase__ ( _a : dict ): snake_case_ : List[Any] = set() # edges = list of graph's edges snake_case_ : int = get_edges(_a ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) and add his extre...
36
0
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArgu...
367
import numpy as np def lowerCAmelCase__ ( _a : np.array ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
36
0
def lowerCAmelCase__ ( _a : int = 10_00 ): snake_case_ : Dict = -1 snake_case_ : str = 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 snake_case_ : List[Any] = (n * n - 2 * ...
368
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCAmelCase__ ( _a : str ): snake_case_ : str = FileLock(str(tmpdir / "foo.lock" ) ) snake_case_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock" ...
36
0