code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
__lowerCamelCase : Dict = {} def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[str] , __UpperCamelCase : Optional[int] , __UpperCamelCase : Optional[Any] ) -> int: """simple docstring""" if late == 3 or absent == 2: ...
219
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _a = get_logger(__name__) class __lowerCamelCase ( enum.Enum): """simple docstring""" UpperCamelCase__ = ...
39
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { """shi-labs/nat-mini-in1k-224""": "...
68
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbon...
39
0
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, load_...
121
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
0
"""simple docstring""" class _UpperCAmelCase: def __init__( self , __a) -> Tuple: '''simple docstring''' _UpperCamelCase = val _UpperCamelCase = None _UpperCamelCase = None def UpperCAmelCa...
194
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''...
39
0
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_ ( ) -> Tuple: """simple docstring""" raise RuntimeError('''CUDA out of memo...
279
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging _a = logging.get_logger(__name__) def __A ( ...
39
0
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae import Decoder, DecoderOutput, Encoder, ...
216
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
39
0
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import *
218
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 __A ( )-> Tuple: """simple docstring""" raise RuntimeError('CUDA out of me...
39
0
def _UpperCamelCase ( snake_case__ ) -> bool: if not all(x.isalpha() for x in string ): raise ValueError("String must only contain alphabetic characters." ) __UpperCAmelCase : Tuple = sorted(string.lower() ) return len(__l...
157
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...tes...
39
0
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def __a(): '''simple docstring''' with offline(OfflineSimulationMode.CONNECTION...
158
def __A ( __lowerCAmelCase )-> list: """simple docstring""" if len(__lowerCAmelCase ) < 2: return collection def circle_sort_util(__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> bool: _UpperCAmelCase = False ...
39
0
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import...
212
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 __lowerCamelCase ( snake_case__): ...
39
0
# flake8: noqa # Lint as: python3 SCREAMING_SNAKE_CASE :str = [ 'VerificationMode', 'Version', 'disable_progress_bar', 'enable_progress_bar', 'is_progress_bar_enabled', 'experimental', ] from .info_utils import VerificationMode from .logging import disable_progress_bar, enable_...
15
class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase = "" , UpperCAmelCase = False ): """simple docstring""" _UpperCAmelCase = {} # A node will be a leaf if the tree contai...
39
0
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu,...
219
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transfor...
39
0
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_i...
68
from __future__ import annotations import collections import pprint from pathlib import Path def __A ( __lowerCAmelCase )-> str: """simple docstring""" return "".join(sorted(__lowerCAmelCase ) ) def __A ( __lowerCAmelCase )-> list[str]: ...
39
0
import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig UpperCAmelCase__ : Union[str, Any] = logging.get_logger(__name__) class UpperCAmelCase : '''simple d...
121
from __future__ import annotations def __A ( __lowerCAmelCase )-> list[int]: """simple docstring""" _UpperCAmelCase = 2 _UpperCAmelCase = [] while i * i <= n: if n % i: i += 1 else: ...
39
0
"""simple docstring""" from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase( snake_case__ ): ...
194
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __A ( )-> tuple[list[int], int]: """simple docstring""" _UpperCAmelCase = [randint(-1_000 , 1_000 ) for i in range(10 )...
39
0
def lowerCamelCase_ ( _UpperCamelCase ) -> list[int]: """simple docstring""" snake_case_ : Union[str, Any] = len(__lowerCAmelCase ) for i in range(__lowerCAmelCase ): for j in range(i + 1 , __lowerCAmelCase ): if numbers[j] < numbers[i]: ...
279
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.traini...
39
0
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''': 1_0, '''max_num_jobs''': 1}, [range(1_0 )]),...
216
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _a = get_tests_dir('''fixtures/spiece.model'''...
39
0
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
218
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _a = lo...
39
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, ...
157
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { '''distilbert-base-uncased''': '''https://huggingface.co/...
39
0
'''simple docstring''' def __a(SCREAMING_SNAKE_CASE_ : Optional[Any] = 10**12 ): '''simple docstring''' _lowerCAmelCase = 1 _lowerCAmelCase = 0 _lowerCAmelCase = 1 _lowerCAmelCase = 1 while numerator <= 2 * min_total - 1: prev_numerato...
158
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
39
0
import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is_flax_available():...
212
class __lowerCamelCase : """simple docstring""" def __init__( self ): """simple docstring""" _UpperCAmelCase = {} # Mapping from char to TrieNode _UpperCAmelCase = False def UpperCamelCase ( s...
39
0
import random from typing import Any def UpperCAmelCase ( a_ ) -> list[Any]: """simple docstring""" for _ in range(len(__lowerCAmelCase ) ): __A = random.randint(0 , len(__lowerCAmelCase ) - 1 ) __A = random.randint(0 , len(__lowerCA...
15
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, requ...
39
0
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets __lowerCamelCase : Any = datasets.logging.get_logger(__name__) __lowerCamelCase : Any = '''\ @InProceedings{moosavi2...
219
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _a = get_logger(__name__) class __lowerCamelCase ( enum.Enum): """simple docstring""" UpperCamelCase__ = ...
39
0
from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ..utils.dummy_pt_objects import * # ...
68
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbon...
39
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set_verbosity_info() UpperCAm...
121
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
0
"""simple docstring""" def lowerCamelCase__ ( __snake_case ) -> List[str]: """simple docstring""" if not head: return True # split the list to two parts _UpperCamelCase , _UpperCamelCase = head.next, head while fast and fast.ne...
194
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''...
39
0
def lowerCamelCase_ ( _UpperCamelCase ) -> int: """simple docstring""" snake_case_ : List[str] = abs(__lowerCAmelCase ) snake_case_ : Any = 0 while n > 0: res += n % 10 n //= 10 return res def lowerCamelCase_ ( ...
279
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging _a = logging.get_logger(__name__) def __A ( ...
39
0
from __future__ import annotations class UpperCamelCase__ : def __init__(self : Any , snake_case_ : List[str] , snake_case_ : Union[str, Any] ): __a , __a : int = text, pattern __a , __a : Dict = len(snake_case_ ), len(snake_case_ ) de...
216
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
39
0
import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def UpperCamelCase_( _snake_case : Optional[int] ): """...
218
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 __A ( )-> Tuple: """simple docstring""" raise RuntimeError('CUDA out of me...
39
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onnx_available,...
157
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...tes...
39
0
'''simple docstring''' def __a(SCREAMING_SNAKE_CASE_ : Dict , SCREAMING_SNAKE_CASE_ : Any ): '''simple docstring''' return base * power(__lowerCAmelCase , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("Raise base to the power of...
158
def __A ( __lowerCAmelCase )-> list: """simple docstring""" if len(__lowerCAmelCase ) < 2: return collection def circle_sort_util(__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> bool: _UpperCAmelCase = False ...
39
0
from sklearn.metrics import recall_score import datasets lowerCamelCase__ = """ Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation: Recall = TP / (TP + FN) Where TP is the true positives and FN is the false negat...
212
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 __lowerCamelCase ( snake_case__): ...
39
0
from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] ,A : Union[str, Any] ): __A = data __A = None class UpperCAmelCase...
15
class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase = "" , UpperCAmelCase = False ): """simple docstring""" _UpperCAmelCase = {} # A node will be a leaf if the tree contai...
39
0
import os import sys __lowerCamelCase : Union[str, Any] = os.path.join(os.path.dirname(__file__), '''src''') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModel...
219
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transfor...
39
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Tuple ) -> bool: '''simple docstring''' A__ = [int(__lowerCAmelCase ) for i in ip_va_address.split("." ) if i.isdigit()] return len(__lowerCAmelCase ) == 4 and all(0 <= int(__lowerCAmelCase ) <= 2_5_4 for ...
68
from __future__ import annotations import collections import pprint from pathlib import Path def __A ( __lowerCAmelCase )-> str: """simple docstring""" return "".join(sorted(__lowerCAmelCase ) ) def __A ( __lowerCAmelCase )-> list[str]: ...
39
0
def lowerCamelCase__ ( a ) -> int: if not grid or not grid[0]: raise TypeError('''The grid does not contain the appropriate information''' ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] _A: List[Any] = grid[...
121
from __future__ import annotations def __A ( __lowerCAmelCase )-> list[int]: """simple docstring""" _UpperCAmelCase = 2 _UpperCAmelCase = [] while i * i <= n: if n % i: i += 1 else: ...
39
0
"""simple docstring""" from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_t...
194
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __A ( )-> tuple[list[int], int]: """simple docstring""" _UpperCAmelCase = [randint(-1_000 , 1_000 ) for i in range(10 )...
39
0
def lowerCamelCase_ ( _UpperCamelCase ) -> str: """simple docstring""" snake_case_ : Optional[Any] = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def lowerCam...
279
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.traini...
39
0
import os import pytest from attr import dataclass lowercase__ ='us-east-1' # defaults region @dataclass class UpperCamelCase__ : _SCREAMING_SNAKE_CASE : str = 42 _SCREAMING_SNAKE_CASE : List[str] = "arn:aws:iam::558105141721:role/sagemaker_execution_...
216
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _a = get_tests_dir('''fixtures/spiece.model'''...
39
0
import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_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_model...
218
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _a = lo...
39
0
import copy import random from transformers import CLIPTokenizer class _snake_case ( snake_case__ ): def __init__( self: List[str] , *__lowerCamelCase: Optional[int] , **__lowerCamelCase: int ) -> List[str]: super().__init__(*__lowerCamelCase , **__lowerCamel...
157
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { '''distilbert-base-uncased''': '''https://huggingface.co/...
39
0
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import Ba...
158
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
39
0
import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import Seq...
212
class __lowerCamelCase : """simple docstring""" def __init__( self ): """simple docstring""" _UpperCAmelCase = {} # Mapping from char to TrieNode _UpperCAmelCase = False def UpperCamelCase ( s...
39
0
def UpperCAmelCase ( a_ ) -> str: """simple docstring""" if number > 0: raise ValueError("input must be a negative integer" ) __A = len(bin(__lowerCAmelCase )[3:] ) __A = bin(abs(__lowerCAmelCase ) - (1 << binary_number_length) )[3:] ...
15
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, requ...
39
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Any = logging.get_logger(__name__) __lowerCamelCase : Tuple = { '''junnyu/roformer_...
219
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _a = get_logger(__name__) class __lowerCamelCase ( enum.Enum): """simple docstring""" UpperCamelCase__ = ...
39
0
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, resize, to_channel_dime...
68
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbon...
39
0
from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=snake_case__ ): '''simple docstring''' __UpperCamelCase : Any = ['''sentencepiece'''] def __init__( self : Optional[Any] , *lowerCAmelCase_ : Optional[int] , **l...
121
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
0
"""simple docstring""" 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__ ( __snake_case, ...
194
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''...
39
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { '''configuration_roberta''': ['''ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP'''...
279
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging _a = logging.get_logger(__name__) def __A ( ...
39
0
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder, ...
216
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
39
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPipeline, ...
218
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 __A ( )-> Tuple: """simple docstring""" raise RuntimeError('CUDA out of me...
39
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slo...
157
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...tes...
39
0
'''simple docstring''' import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models...
158
def __A ( __lowerCAmelCase )-> list: """simple docstring""" if len(__lowerCAmelCase ) < 2: return collection def circle_sort_util(__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> bool: _UpperCAmelCase = False ...
39
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
212
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 __lowerCamelCase ( snake_case__): ...
39
0
from __future__ import annotations import collections import pprint from pathlib import Path def UpperCAmelCase ( a_ ) -> str: """simple docstring""" return "".join(sorted(__lowerCAmelCase ) ) def UpperCAmelCase ( a_ ) -> list[str]: """simple docs...
15
class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase = "" , UpperCAmelCase = False ): """simple docstring""" _UpperCAmelCase = {} # A node will be a leaf if the tree contai...
39
0
def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple ) -> Dict: """simple docstring""" SCREAMING_SNAKE_CASE__ = [0] * len(__lowerCAmelCase ) SCREAMING_SNAKE_CASE__ = [] SCREAMING_SNAKE_CASE__ = [] SCREAMING_SNAKE_...
219
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transfor...
39
0
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class a__ ( snake_case__ ): """simple docstring""" __lowerCamelCase = 'MCTCTFeatureExtractor' __lowerCamelCase = 'AutoTokenizer' def __init__( self , ...
68
from __future__ import annotations import collections import pprint from pathlib import Path def __A ( __lowerCAmelCase )-> str: """simple docstring""" return "".join(sorted(__lowerCAmelCase ) ) def __A ( __lowerCAmelCase )-> list[str]: ...
39
0
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import ConfigM...
121
from __future__ import annotations def __A ( __lowerCAmelCase )-> list[int]: """simple docstring""" _UpperCAmelCase = 2 _UpperCAmelCase = [] while i * i <= n: if n % i: i += 1 else: ...
39
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { """funnel-transformer/small""": """https://huggingface.co/funnel-transformer/small/resolve/main/config.json""", """...
194
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __A ( )-> tuple[list[int], int]: """simple docstring""" _UpperCAmelCase = [randint(-1_000 , 1_000 ) for i in range(10 )...
39
0
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassification, SegformerForSemanticSegmentation, S...
279
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.traini...
39
0
from collections import Counter from timeit import timeit def __UpperCamelCase ( lowerCAmelCase__ : List[str] = "" , ): return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ) < 2 def __UpperCamelCase ( lowerCAmelCase__ : List[...
216
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _a = get_tests_dir('''fixtures/spiece.model'''...
39
0
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
218
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _a = lo...
39
0
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _UpperCamelCase ( ) -> Tuple: import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dir...
157
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { '''distilbert-base-uncased''': '''https://huggingface.co/...
39
0
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __a(SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : Optional[int] ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den...
158
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
39
0
from functools import reduce lowerCamelCase__ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" ""...
212
class __lowerCamelCase : """simple docstring""" def __init__( self ): """simple docstring""" _UpperCAmelCase = {} # Mapping from char to TrieNode _UpperCAmelCase = False def UpperCamelCase ( s...
39
0
from __future__ import annotations def UpperCAmelCase ( a_ ) -> list[int]: """simple docstring""" __A = 2 __A = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(__lowerCAmelCase ) if n > 1...
15
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, requ...
39
0
from collections import deque from math import floor from random import random from time import time class __snake_case : def __init__( self : Dict ): """simple docstring""" SCREAMING_SNAKE_CASE__ = {} def __a ( ...
219
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _a = get_logger(__name__) class __lowerCamelCase ( enum.Enum): """simple docstring""" UpperCamelCase__ = ...
39
0
from collections.abc import Generator from math import sin def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Tuple ) -> bytes: '''simple docstring''' if len(__lowerCAmelCase ) != 3_2: raise ValueError("Input must be of length 32" ) A__ = b"" for i...
68
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbon...
39
0
import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPR_CONTEXT_ENCODER...
121
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
0
"""simple docstring""" import comet # From: unbabel-comet import torch import datasets _a = datasets.logging.get_logger(__name__) _a = """\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon}, ...
194
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''...
39
0
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class __lowerCA...
279
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging _a = logging.get_logger(__name__) def __A ( ...
39
0
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
216
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
39
0
import numpy as np _lowerCAmelCase : Optional[Any] = [ ["a", "b", "c", "d", "e"], ["f", "g", "h", "i", "k"], ["l", "m", "n", "o", "p"], ["q", "r", "s", "t", "u"], ["v", "w", "x", "y", "z"], ] class __magic_name__ : def __init__( self ) ...
218
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 __A ( )-> Tuple: """simple docstring""" raise RuntimeError('CUDA out of me...
39
0
from math import pi, sqrt, tan def _UpperCamelCase ( snake_case__ ) -> float: if side_length < 0: raise ValueError("surface_area_cube() only accepts non-negative values" ) return 6 * side_length**2 def _UpperCamelCase ( snake_c...
157
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...tes...
39
0
'''simple docstring''' import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
158
def __A ( __lowerCAmelCase )-> list: """simple docstring""" if len(__lowerCAmelCase ) < 2: return collection def circle_sort_util(__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> bool: _UpperCAmelCase = False ...
39
0
from __future__ import annotations lowerCamelCase__ = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], }...
212
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 __lowerCamelCase ( snake_case__): ...
39
0
import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class UpperCAmelCase ( snake_c...
15
class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase = "" , UpperCAmelCase = False ): """simple docstring""" _UpperCAmelCase = {} # A node will be a leaf if the tree contai...
39
0
def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple = 60_08_51_47_51_43 ) -> int: """simple docstring""" try: SCREAMING_SNAKE_CASE__ = int(__lowerCAmelCase ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or ...
219
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transfor...
39
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
68
from __future__ import annotations import collections import pprint from pathlib import Path def __A ( __lowerCAmelCase )-> str: """simple docstring""" return "".join(sorted(__lowerCAmelCase ) ) def __A ( __lowerCAmelCase )-> list[str]: ...
39
0
# Copyright 2022 The HuggingFace Team and The OpenBMB 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...
121
from __future__ import annotations def __A ( __lowerCAmelCase )-> list[int]: """simple docstring""" _UpperCAmelCase = 2 _UpperCAmelCase = [] while i * i <= n: if n % i: i += 1 else: ...
39
0
"""simple docstring""" from __future__ import annotations def lowerCamelCase__ ( __snake_case, __snake_case = None, __snake_case = None, __snake_case = False, ) -> tuple[int, float, str]: """simple docstring""" _UpperCamelCase = ciphe...
194
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __A ( )-> tuple[list[int], int]: """simple docstring""" _UpperCAmelCase = [randint(-1_000 , 1_000 ) for i in range(10 )...
39
0
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 datasets.features import...
279
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.traini...
39
0
import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): lowercase__ =yaml.safe_load( '\\nname: ""\nallow_empty: false\nallow_empty_text: true\nsubsections:\n - name: "Dataset Card for X" # Fi...
216
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _a = get_tests_dir('''fixtures/spiece.model'''...
39
0
from ... import PretrainedConfig _lowerCAmelCase : Any = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class __magic_name__ ( snake_case__ ): SCREAMING_SNAKE_CASE = NEZHA_PRETRAINED_CONFIG_ARCHI...
218
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _a = lo...
39
0
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _snake_case ( snake_case__ , unittest.TestCase ): lowerCamelCase__: Tuple = ...
157
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { '''distilbert-base-uncased''': '''https://huggingface.co/...
39
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { "configuration_ctrl": ["CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CTRLConfig"], "tokenization_ctrl": ["CTRL...
158
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
39
0
import os 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 lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = "...
212
class __lowerCamelCase : """simple docstring""" def __init__( self ): """simple docstring""" _UpperCAmelCase = {} # Mapping from char to TrieNode _UpperCAmelCase = False def UpperCamelCase ( s...
39
0
import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling...
15
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, requ...
39
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...test_...
219
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _a = get_logger(__name__) class __lowerCamelCase ( enum.Enum): """simple docstring""" UpperCamelCase__ = ...
39
0
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseScheduler, DPMS...
68
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbon...
39
0
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel UpperCAmelCase__ : List[str] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'self.proj'...
121
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { """SCUT-DLVCLab/lilt-roberta-en-base""": ( """https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/...
194
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''...
39
0
import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @require_torch_gpu class ...
279
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging _a = logging.get_logger(__name__) def __A ( ...
39
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 ...
216
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
39
0
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class __magic_name__ : SCREAMING_SNAKE_CASE = 4_2 SCREAMING_SNAKE_CASE = None SCREAMING_SNAKE_CASE = None _lowerCAmelCas...
218
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 __A ( )-> Tuple: """simple docstring""" raise RuntimeError('CUDA out of me...
39
0
from __future__ import annotations from typing import Any def _UpperCamelCase ( snake_case__ ) -> int: if not postfix_notation: return 0 __UpperCAmelCase : Union[str, Any] = {"+", "-", "*", "/"} __UpperCAmelCase : Optional[int]...
157
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...tes...
39
0
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _SCREAMING...
158
def __A ( __lowerCAmelCase )-> list: """simple docstring""" if len(__lowerCAmelCase ) < 2: return collection def circle_sort_util(__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> bool: _UpperCAmelCase = False ...
39
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> list: if bit_count < 0: raise ValueError('The given input must be positive' ) # get the generated string sequence lowerCAmelCase__ : List[Any] = gray_code_sequence_string(__lowerCAmelCase ) # # ...
212
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 __lowerCamelCase ( snake_case__): ...
39
0
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def UpperCAmelCase ( a_ , a_ , a_ ) -> List[str]: """simple docstring""" __A = ("dense.weight", "attention.self.query", "attention.self.key", "attention.se...
15
class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase = "" , UpperCAmelCase = False ): """simple docstring""" _UpperCAmelCase = {} # A node will be a leaf if the tree contai...
39
0
import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 # Here to ha...
219
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transfor...
39
0