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
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) __lowerCAmelCase : str = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class snake_case__ (_Up...
107
def __lowercase ( _UpperCamelCase, _UpperCamelCase, _UpperCamelCase, _UpperCamelCase ) ->Union[str, Any]: """simple docstring""" lowercase : Union[str, Any] = [False] * len(_UpperCamelCase ) lowercase : Optional[int] = [] queue.appe...
337
0
'''simple docstring''' from manim import * class __lowercase ( _a ): '''simple docstring''' def _UpperCAmelCase (self ) -> int: '''simple docstring''' __lowercase = Rectangle(height=0.5 ,width=0.5 ) __lowercase = R...
370
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { '''abeja/gpt-neox-japanese-2.7b''': '''https://huggingface.co/abeja/gpt-neox-japanese-2.7b...
217
0
class A__ : """simple docstring""" def __init__( self , __snake_case ): snake_case = arr.split(''',''' ) def a_ ( self ): snake_case = [int(self.array[0] )] * len(self.array ) snake_case = ...
127
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils...
128
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig SCREAMING_SNAKE_CASE : Optional[Any] = { """albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""...
24
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_avail...
24
1
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _lowercase ( A__ , unittest.TestCase ): '''simple docstring''' SCREAMING_...
9
from ..utils import DummyObject, requires_backends class _lowercase ( metaclass=A__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = ['''keras_nlp'''] def __init__( self :Tuple , *lowerCAmelCase__ :Optional[Any] , **lowerCAmelC...
9
1
'''simple docstring''' import argparse from collections import defaultdict import yaml snake_case__ = """docs/source/en/_toctree.yml""" def snake_case__ ( lowerCamelCase__ : Optional[Any] ) -> List[str]: A_ : List[str] = defaultdict(lo...
4
'''simple docstring''' import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline snake_case...
4
1
'''simple docstring''' import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxrunti...
185
import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig, AutoModelFo...
157
0
"""simple docstring""" import logging from transformers import PretrainedConfig __lowercase = logging.getLogger(__name__) __lowercase = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json''',...
357
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer __lowercase = logging.get_logger(__name__) __lowercase = {'''vocab_file''': '''vocab.json''', '''merges_file''': '...
105
0
from random import randint, random def A ( lowercase , lowercase , lowercase , lowercase = False , lowercase = False , lowercase = 5 , ) -> list: '''simple docstring''' UpperCamelCase = [[-1] * number_of_cells] # Create a highway wit...
222
from decimal import Decimal, getcontext from math import ceil, factorial def A ( lowercase ) -> str: '''simple docstring''' if not isinstance(lowercase , lowercase ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natu...
222
1
import math def snake_case ( snake_case__ :int) -> bool: 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 multiples of 3 are ...
81
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
1
"""simple docstring""" from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def UpperCamelCase ( UpperCAmelCase ) ->List[Any]: """simple docstring""" if not is_accelerate_available(): return method a_ ...
243
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 __lowerCAmelCase : List[Any] = get_tests_dir('fixtures/test_sentencepiece_wit...
107
0
'''simple docstring''' import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common i...
354
'''simple docstring''' from __future__ import annotations import pandas as pd def _snake_case ( _SCREAMING_SNAKE_CASE : list[int] , _SCREAMING_SNAKE_CASE : list[int] , _SCREAMING_SNAKE_CASE : int ) -> list[int]: """si...
187
0
from math import factorial def __lowerCamelCase ( __a :int , __a :int , __a :float ) -> float: """simple docstring""" if successes > trials: raise ValueError("""successes must be lower or equal to trials""" ) if trials < 0...
274
import argparse from collections import defaultdict import yaml A : str = '''docs/source/en/_toctree.yml''' def __lowerCamelCase ( __a :str ) -> List[Any]: """simple docstring""" A__ = defaultdict(__a ) A__ =...
274
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __A = { '''configuration_audio_spectrogram_transformer''': [ '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ASTConfig''', ] }...
354
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils im...
64
0
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __UpperCamelCase ( a__ , a__ ): @register_to_config def __init__( sel...
105
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Effic...
49
0
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() UpperCamelCase_ = logging.get_l...
344
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : Optiona...
344
1
"""simple docstring""" from math import pi, sqrt def UpperCAmelCase ( UpperCamelCase__ ): """simple docstring""" if num <= 0: raise ValueError('math domain error' ) if num > 1_7_1.5: raise OverflowError('math rang...
221
"""simple docstring""" import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_avail...
221
1
import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_available(): from transf...
138
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __magic_name__: Tuple = { "configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"], "tokenization_tapas": ["TapasTokenizer"], } try...
138
1
# Lint as: python3 import itertools import os import re snake_case_ = re.compile(R'([A-Z]+)([A-Z][a-z])') snake_case_ = re.compile(R'([a-z\d])([A-Z])') snake_case_ = re.compile(R'(?<!_)_(?!_)') snake_case_ = re.compile(R'(_{2,})') snake_case_ = R'^\w+(\.\w+)*$' sn...
24
import os import pytest from transformers.dynamic_module_utils import get_imports snake_case_ = '\nimport os\n' snake_case_ = '\ndef foo():\n import os\n return False\n' snake_case_ = '\ndef foo():\n def bar():\n if True:\n import os\n return...
24
1
'''simple docstring''' from __future__ import annotations lowercase = list[tuple[int, int]] lowercase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0...
356
'''simple docstring''' # limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class A ( __snake_case ): def __init__( self , SCREAMING_SNAKE_CAS...
311
0
'''simple docstring''' import argparse from collections import defaultdict import yaml __snake_case ="""docs/source/en/_toctree.yml""" def a_ ( lowerCamelCase : Any ): lowerCAmelCase = defaultdict(lowerCamelCase ) for doc in model_doc: coun...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
"""simple docstring""" from __future__ import annotations class __a : def __init__( self , a__=None ): _lowerCamelCase = data _lowerCamelCase = None def __repr__( self ): _lowerCamelCase = [] _...
80
"""simple docstring""" from dataclasses import dataclass from typing import Dict, 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 .attention_processor import AttentionProcessor, ...
80
1
def _a ( UpperCamelCase_ : int ) -> int: """simple docstring""" lowerCAmelCase__ = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def _a ( UpperCamelCase_ : int = 100 ) ->...
340
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline a_ = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value network '''scale_grad_by_...
340
1
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch class a...
352
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class a (_lowerCAmelCase ): """simple docstring""" ...
134
0
def UpperCamelCase ( __magic_name__ : Dict , __magic_name__ : Dict ) -> Any: """simple docstring""" lowercase__ = [0 for i in range(r + 1 )] # nc0 = 1 lowercase__ = 1 for i in range(1 , n + 1 ): # to compute current ro...
305
def UpperCamelCase ( __magic_name__ : str ) -> list: """simple docstring""" if n_term == "": return [] lowercase__ = [] for temp in range(int(__magic_name__ ) ): series.append(f'''1/{temp + 1}''' if series else """1""" ) return series ...
305
1
"""simple docstring""" import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForS...
254
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
254
1
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers fr...
78
import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTokenizer, JumanppToken...
284
0
"""simple docstring""" import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py __magic_name__ = "src/transformers...
350
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokeni...
255
0
'''simple docstring''' 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_mod...
298
'''simple docstring''' import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow _lowerCAmelCase = [ os.path.join(os.path.dirname(__file__), dirname) for...
298
1
import operator def a_ ( __lowercase : list , __lowercase : bool = False , __lowercase : list | None = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: return solution ...
130
import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWit...
130
1
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 transforme...
327
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
1
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class UpperCamelCase__ ...
356
from __future__ import annotations __UpperCAmelCase = 10 def A__ ( __lowerCamelCase ): SCREAMING_SNAKE_CASE_ = 1 SCREAMING_SNAKE_CASE_ = max(__lowerCamelCase ) while placement <= max_digit: # declare and initialize empty buckets SCREAMING_SNAKE_CASE_ = ...
257
0
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase = 1 / sqrt(2 ) ) -> IIRFilter: '''simple docstring''' lowerCAmelCase : int = tau * frequency / sample...
138
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast __A : Any = datasets.utils.logging.get_logger(__name__) @dataclass class __A ( datasets.Bui...
138
1
"""simple docstring""" # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format...
195
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a__ : List[str] = { '''configuration_biogpt''': ['''BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BioGptConfig'''],...
195
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, sl...
119
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_...
228
0
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CA...
1
"""simple docstring""" def _snake_case ( lowercase__ : list , lowercase__ : list , lowercase__ : int , lowercase__ : int , lowercase__ : int ) -> int: '''simple docstring''' if index == number_of_items: return 0 lowerCA...
1
1
'''simple docstring''' import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": _UpperCamelCase = argparse.ArgumentParser() parser.add_argument( '...
208
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class lowerCamel...
208
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image...
367
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import...
86
0
'''simple docstring''' from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging UpperCAmelCase_ : List[Any] = logging.get_logger(__name__) def ...
200
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class lowercase__ ( ctypes.Structure ): '''simple docstring''' A_ : Optional[Any] =...
200
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __UpperCamelCase : Optional[int] = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTok...
357
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transforme...
347
0
'''simple docstring''' import inspect import os import re from transformers.configuration_utils import PretrainedConfig from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/...
254
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase = { '''configuration_pegasus_x''': ['''PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusXConfig'''], } try: if not is_t...
254
1
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class UpperCAmelCase ( A_ ): def __init__(self : Tuple , snake_case__ : Any , snake_case__ : str=None , ...
362
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor __lowerCamelCase = logging.get_logger(__name__) class UpperCAmelCase ( A_ ): def __init__(self : List[Any] , *snake_case__ : List[str] , **snake_...
10
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf UpperCAmelCase : Dict =logging.get_logge...
128
from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) UpperCAmelCase : Tuple =2_9979_2458 # Symbols UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase : int =symbol...
128
1
from scipy.stats import pearsonr import datasets A_ : Dict = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that each dataset is ...
361
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @require_sentencepiece @require_t...
141
0
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class lowerCamelCase__ ( __lowercase): '''simple docstring''' _A = CustomTokenizer pass
232
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : List[Any] = logging.get_logger(__name__) lowercase : Any = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', # S...
232
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable lowerCAmelCase__ = { "configuration_gpt_neox_japanese": ["GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoXJapaneseConfig"], "tokenization_gpt_neo...
369
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
121
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : str = logging.get_logger(__name__) snake_case__ : str = { '''tiiuae/falcon-40b''': '''https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json''', '''tii...
60
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTokeni...
257
0
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow...
197
from datetime import datetime import matplotlib.pyplot as plt import torch def lowerCAmelCase( __lowerCamelCase ): for param in module.parameters(): __a = False def lowerCAmelCase( ): __a = 'cuda' if torch.cuda.is_available() else 'cpu' if to...
197
1
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger SCREAMING_SNAKE_CASE__ : Dict = get_logger(__name__) SCREAMING_SNAKE_CASE__ : List[str] = r"\n Args:\n input_ids (`...
270
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ : List[str] = { "configuration_blip": [ "BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
270
1
"""simple docstring""" import math import sys def _lowerCamelCase(__UpperCamelCase ) -> str: _lowerCAmelCase ="""""" try: with open(__UpperCamelCase , """rb""" ) as binary_file: _lowerCAmelCase =binary_file.read() for dat in data: _lowerCAmelCase =F'''{d...
364
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTest...
341
0
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __A ( UpperCamelCase__ ): a__ ...
1
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_ten...
1
1
from math import isclose, sqrt def UpperCamelCase ( _A : float , _A : float , _A : float )-> tuple[float, float, float]: """simple docstring""" A__ = point_y / 4 / point_x A__ = 2 * normal_gradient / (1 + normal_...
356
from __future__ import annotations from random import random class UpperCamelCase : def __init__( self , UpperCAmelCase__ = None ): A__ = value A__ = random() A__ = None A__ = None def __repr__( self )...
198
0
import math def A__ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ = 0 , SCREAMING_SNAKE_CASE__ = 0) -> Optional[int]: __snake_case: Union[str, Any] = end or len(SCREAMING_SNAKE_CASE__) for i in range(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE_...
111
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) UpperCAmelCase : Optional[int] = { """google/canine-s""": """https://huggingface.co/google/canine-s/resolve/main/config.json"""...
95
0
"""simple docstring""" from __future__ import annotations A__ : List[str] = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _snake_case ( lowerCamelCase__ : list[list[int]] , lowerCamelCase__ : list[int] , lowerCamelCase__ ...
209
"""simple docstring""" import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTest...
209
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
168
'''simple docstring''' import sys a_ : Dict = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" ...
168
1
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformer...
28
from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import TimmBackboneConfig ...
28
1
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin _UpperCamelCase = get_tests_dir('''fixtures/test_sentencepiece_b...
326
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
10
0
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase = ...
355
'''simple docstring''' from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require...
13
0
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels a : int = object() # For specifying empty leaf dict `{}` a : Dict = ...
105
import os import numpy import onnx def A_ ( a , a ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Union[str, Any] = a.name SCREAMING_SNAKE_CASE_ : Dict = b.name SCREAMING_SNAKE_CASE_ : Optional[int] = '' SCREAMING_S...
253
0
"""simple docstring""" import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForCon...
356
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_xlnet import ...
65
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from...
40
"""simple docstring""" import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from acceler...
247
0
import argparse import json from pathlib import Path import torch import torchaudio from datasets import load_dataset from huggingface_hub import hf_hub_download from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification from transformers.utils import logging logging.set_verbosity_info(...
356
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, g...
158
0
import math import unittest from transformers import BioGptConfig, 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 ModelTe...
62
"""simple docstring""" import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _UpperCAmelCase = 5_0_0_0_0_0 _UpperCAmelCase, _UpperCAmelCase = os.path.split(__file__) _UpperCAmelCase = os.path.join(RESULTS...
173
0
from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { """speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json""", # See all M-CTC-T m...
353
def __lowerCamelCase ( lowerCAmelCase__ ): lowerCAmelCase__ = len(lowerCAmelCase__ ) for i in range(lowerCAmelCase__ ): for j in range(i + 1 , lowerCAmelCase__ ): if numbers[j] < numbers[i]: lowerCAmelCa...
119
0
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock...
28
import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from transformers.utils import loggi...
119
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : str = logging.get_logger(__name__) _lowercase : List[str] = { "microsoft/unispeech-large-1500h-cv": ( "https...
364
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowercase : List[str] = logging.get_logger(__name__) def snake_case__ ( __lowerCamelCase : Union[tf.Tensor, np.ndarray] ): ...
272
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = {'configuration_wavlm': ['WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'WavLMConfig']} try: if not is_torch_available(): raise OptionalDependencyNotA...
250
'''simple docstring''' class a__ : def __init__( self , _UpperCamelCase ): """simple docstring""" _lowercase : Tuple = n _lowercase : Any = [None] * self.n _lowercase : Tuple = 0 # index of the first element _lower...
250
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
363
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """microsoft/wavlm-base""": """https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json""", # See al...
267
0
# Copyright 2022 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 a...
157
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'''], } ...
131
0
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def __magic_name__( lowerCamelCase): if num <= 0: raise ValueError('''math domain error''') return quad(_a, 0, _a, args=(_a))[0] def __magic_name...
360
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device fr...
9
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"], } try: if not is_torc...
28
'''simple docstring''' from PIL import Image def __lowerCamelCase ( A__ , A__ ) -> Image: """simple docstring""" def brightness(A__ ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: raise ValueEr...
28
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase_ : Union[str, Any] = { """SCUT-DLVCLab/lilt-roberta-en-base""": ( ...
318
"""simple docstring""" from pathlib import Path import numpy as np from PIL import Image def _A (__a ) -> np.ndarray: """simple docstring""" SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Optional[int] = rgb[:, :, 0],...
318
1
"""simple docstring""" # Algorithm for the pigeonhole sorting def __lowerCamelCase ( a_ : Union[str, Any] ) -> Tuple: __SCREAMING_SNAKE_CASE :Optional[Any] = min(_UpperCAmelCase ) # min() finds the minimum value __SCREAMIN...
191
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Any = logging.get_logger(__name__) lowerCAmelCase : Tuple = ...
13
0
"""simple docstring""" import numpy as np import torch from ..models.clipseg import CLIPSegForImageSegmentation from ..utils import is_vision_available, requires_backends from .base import PipelineTool if is_vision_available(): from PIL import Image class __lowerCamelCase ( __lowercase ): _...
361
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
0
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES __lowerCAmelCase : Dict = logging.get_logger(__name__) __lowerCAmelCase : Union[str, A...
156
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer a_ = logging.get_logger(__name__) a_ = {'vocab_file': 'vocab.txt'} ...
76
0
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Ba...
371
"""simple docstring""" import argparse import os import re import packaging.version _UpperCamelCase : Optional[Any] = 'examples/' _UpperCamelCase : Any = { 'examples': (re.compile(r'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'i...
186
0
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase=1_0_2_4 ): __snake_case , __snake_case : Optional[int]...
123
'''simple docstring''' from __future__ import annotations from collections import deque class lowerCAmelCase_ : def __init__( self , _lowerCAmelCase ) -> Optional[int]: _lowerCAmelCase = [] self.adlist.append( {"value": "", "next_states": [], "fail_stat...
158
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_visi...
202
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
202
1
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ ...
108
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if principal <= 0: raise Exception("Principal borrowed must be > 0" ) if rate_per_annum < 0: ...
108
1
'''simple docstring''' import pprint import requests lowerCAmelCase_ = "https://zenquotes.io/api" def __magic_name__ ( ) -> list: return requests.get(API_ENDPOINT_URL + '/today' ).json() def __magic_name__ ( ) -> list: return requests.get(API_ENDPOINT_URL + '/...
332
'''simple docstring''' from __future__ import annotations def __magic_name__ ( A , A , A ) -> int | float: if len(A ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= len(A ) or left < -len(A ) or right >= len(A ...
332
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ :Optional[int] = { '''configuration_instructblip''': [ '''INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InstructBlipConfig''', '''Instr...
329
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor __lowercase = logging.get_logger(__name__) class a__( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , *__...
272
0
from __future__ import annotations class lowerCamelCase__ : '''simple docstring''' def __init__( self :int , a :int ) -> None: __UpperCamelCase : Dict = data __UpperCamelCase : Node | None = None ...
364
lowercase : Optional[int] = 9.8_0_6_6_5 def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCase : float = g) -> float: '''simple docstring''' if fluid_density <= 0: ...
151
0
'''simple docstring''' from __future__ import annotations def _lowercase ( __A ,__A ,__A ): '''simple docstring''' if len(a__ ) == 0: raise ValueError("""find_max() arg is an empty sequence""" ) if ( left >= len(a__ ) or lef...
349
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.utils ...
267
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @req...
350
'''simple docstring''' import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase ( UpperCAmelCase__ : List[Any] , UpperCAmelCase__ : Op...
21
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCamelCase : str = logging.get_logger(__name__) _UpperCamelCas...
77
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTokeniz...
9
0
'''simple docstring''' 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 ...file_utils import add_code_sample_docstrings, add_start_docstrin...
179
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _snake_case : List[str] = {'co...
179
1
"""simple docstring""" import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize("""dataset_size""" , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize("""input_in_memory_max_size""" , ["""default""", 0, 100 * 2**20, 900 * 2**20] ...
109
"""simple docstring""" import datasets from .evaluate import evaluate A: Optional[Any] = "\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv p...
109
1
'''simple docstring''' import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List,...
18
'''simple docstring''' from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class __UpperCAmelCase : '''simple docstring''' pass
18
1
class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase ): '''simple docstring''' pass class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase ): '''simple docstring''' pass class SCREAMING_SNAKE_CASE__ : '''simple docstring''' def __init__( self : str ): '''sim...
282
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class SCREAMING_SNAKE_CASE__ : '''simple docstring''' @property def A ( sel...
282
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_clap''': [ '''CLAP_PRETRAINED_MODEL_ARCHIVE_LIST''', '''ClapAudioConfig''', '''ClapConfig''', '''ClapTextConfig'''...
121
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils impo...
121
1
'''simple docstring''' import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): i...
164
"""simple docstring""" # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowerCAmelCase = TypeVar("""T""") class A_ ( Generic[T] ): ...
126
0
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() lowercase = ...
35
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowercase = """src/transformers""" # This is to make sure ...
35
1
"""simple docstring""" import unittest from transformers import DonutProcessor _lowerCAmelCase :str = 'naver-clova-ix/donut-base' class _UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' def __lowerCAmelCase ( self ) -> Optional[Any]: ...
263
"""simple docstring""" import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class _UpperCAmelCase ( unittest.TestCase ): ...
263
1
import os import sys import unittest _lowerCAmelCase : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_mappi...
351
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer import PriorTransformer...
70
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(): i...
87
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger __snake_case : Dict = """<<<<<<< This should probably be modified because it mentions: """ __snake_case : ...
248
0
'''simple docstring''' def UpperCamelCase( UpperCAmelCase_ ): if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise ValueError('Input must be an integer' ) if input_num <= 0: raise ValueError('Input must be positive' ) return sum( divisor for divisor in range(1 ...
280
'''simple docstring''' from __future__ import annotations def UpperCamelCase( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ ): if len(UpperCAmelCase_ ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= len(UpperCAmelCase_ ) or ...
280
1
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def UpperCamelCase( __UpperCamelCase : Optional[int] ,__UpperCamelCase ...
103
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_p...
322
0
def __lowercase ( snake_case_ : Union[str, Any] ,snake_case_ : int ,snake_case_ : str=False ) ->Optional[Any]: '''simple docstring''' if isinstance(snake_case_ ,snake_case_ ) and isinstance(snake_case_ ,snake_case_ ): __A : Option...
352
"""simple docstring""" import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import ...
291
0
"""simple docstring""" def __A (_SCREAMING_SNAKE_CASE ) ->list[int]: """simple docstring""" if length <= 0 or not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(lowerCamelCase_ ...
293
def UpperCamelCase_( lowerCamelCase_ ) -> int: if not numbers: return 0 if not isinstance(lowerCamelCase_ , (list, tuple) ) or not all( isinstance(lowerCamelCase_ , lowerCamelCase_ ) for number in numbers ): raise ValueError('numbers must be an iterable o...
21
0
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingSt...
123
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __lowerCAmelCase : Union[str, Any] =logging.get_logger(__name__) __lowerCAmelCase : ...
123
1