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
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requi...
237
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""note_seq"""] def __init__( self :Optional[Any] , *lowercase_ :List[Any] , **lowercase_ :List[str] ...
237
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A__ : Optional[int] ={ '''configuration_convnext''...
220
'''simple docstring''' import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration A__ : str =5_00_00 A__ : Optional[int] =50_00 A__ , A__ : Optional[int] ...
220
1
"""simple docstring""" import itertools import math def lowercase ( A_ )-> bool: '''simple docstring''' 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 ...
40
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = lo...
93
0
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters lowerCAmelCase__ = (720, 1_280) # Height, Width lowerCAmelCase__ = (0.4, 0.6) # if height or width lower than this scale, drop it. low...
133
"""simple docstring""" import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowerCAmelCase__ = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', default=Non...
133
1
def _UpperCAmelCase ( snake_case = 60_08_51_47_51_43 ): """simple docstring""" try: _lowerCAmelCase = int(snake_case ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable to int.""" ) if n <= 0: raise ...
82
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DDI...
82
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowercase : Optional[Any] = {} try: if not is_...
363
'''simple docstring''' import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class lowerCAmelCase...
264
0
'''simple docstring''' from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def UpperCAmelCase_ ( __lowercase : str ) -> None: '''simple docstring''' _UpperCAmelCase , _UpperCAmelCase ...
22
"""simple docstring""" import random def __SCREAMING_SNAKE_CASE ( A_ , A_ ): lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ : Optional[int] = [], [], [] for element in data: if element < pivot: less.append(A_ ) elif element > pivot: greater.append(A_ ) else: ...
106
0
def lowercase( UpperCamelCase_ ) -> bool: '''simple docstring''' UpperCamelCase = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowercase( UpperCamelCase_ = 5000 ) -> int: '''simple docstring''' UpperCamelCase = [(i * (3 * i - 1)) ...
371
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils import FeatureExtracti...
165
0
"""simple docstring""" import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class a__ ( unittest.TestCase ): def __magic_...
202
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
202
1
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...featu...
351
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> List[Any]: '''simple docstring''' return x + 2 class __A ( unittest.TestCase ): ...
323
0
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( A : list , A : int , A : int , A : int ) -> list: UpperCAmelCase_ : Any = [] UpperCAmelCase_ , UpperCAmelCase_ : Tuple = input_list[low:mid...
304
'''simple docstring''' 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 Option...
304
1
'''simple docstring''' import torch from torch import nn class UpperCAmelCase ( nn.Module): def __init__( self : List[str], a_ : Optional[Any], a_ : List[Any], a_ : Union[str, Any], a_ : Union[str, Any], a_ : List[Any]=1, a_ : List[str]=False ): """si...
31
'''simple docstring''' def SCREAMING_SNAKE_CASE__( _UpperCamelCase : list ) -> float: '''simple docstring''' UpperCamelCase__ = 0 while len(_UpperCamelCase ) > 1: UpperCamelCase__ = 0 # Consider two files with minimum cost to be me...
31
1
"""simple docstring""" import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.to...
81
'''simple docstring''' from string import ascii_lowercase, ascii_uppercase def lowerCamelCase ( __lowerCamelCase : str ) ->str: if not sentence: return "" _SCREAMING_SNAKE_CASE = dict(zip(__lowerCamelCase , __lowerCamelCase ) ) return lower_t...
58
0
"""simple docstring""" import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common ...
359
"""simple docstring""" def lowerCAmelCase (__UpperCamelCase : int = 1_0_0_0 ): """simple docstring""" __UpperCamelCase =-1 __UpperCamelCase =0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c ...
85
0
import functools def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> int: """simple docstring""" if not isinstance(lowercase_ , lowercase_ ) or not all(isinstance(lowercase_ , lowercase_ ) for day in days ): raise ValueError('...
14
"""simple docstring""" def __lowercase ( _a , _a , _a=False ): if isinstance(_a , _a ) and isinstance(_a , _a ): snake_case_ : Union[str, Any] = len(set_a.intersection(_a ) ) if alternative_union: snake_case_ : Any = len(_a ) + l...
264
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.json''', # See all CANINE models at https://huggingface.co/models?fil...
350
import numpy # List of input, output pairs a_ = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) a_ = (((515, 22, 13), 555), ((61, 35, 49), 150)) a_ = [2, 4, 1, 5] a_ = len(train_data) a_ = 0.009 def __lowercase ( lowe...
50
0
from bisect import bisect from itertools import accumulate def _UpperCamelCase ( lowercase__ , lowercase__ , lowercase__ , lowercase__ ): __SCREAMING_SNAKE_CASE : Tuple = sorted(zip(lowercase__ , lowercase__ ) , key=lambda...
9
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin ...
149
0
from collections import defaultdict def lowerCamelCase_ ( lowerCamelCase__ , lowerCamelCase__ ): lowerCamelCase_ = first_str.lower().strip() lowerCamelCase_ = second_str.lower().strip() # Remove whitespace lowerCamelCase_ = first_str.replace(" " ...
47
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 ModelTest...
47
1
import math def A_ ( _UpperCAmelCase ): 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 not primes return False ...
13
def lowerCamelCase__ ( _a , _a): _validate_point(_a) _validate_point(_a) if len(_a) != len(_a): raise ValueError("Both points must be in the same n-dimensional space") return float(sum(abs(a - b) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a): if point: if...
76
0
'''simple docstring''' 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_ava...
365
'''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 () -> Optional[Any]: '''simple docstr...
104
0
import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() lowercase : Dict = logging.get_logger(__name__) def _snake_case( SCREAMING_SNAKE_CASE__ ,...
20
'''simple docstring''' from __future__ import annotations def lowercase_ ( _lowercase ) -> list[int]: # This function is recursive '''simple docstring''' lowerCamelCase_ : Tuple = len(_lowercase ) # If the array contains only one element, we return it (it's the stop c...
318
0
from numpy import exp, pi, sqrt def UpperCAmelCase_ (_lowerCAmelCase : str , _lowerCAmelCase : float = 0.0 , _lowerCAmelCase : float = 1.0 ): return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": ...
171
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters lowercase : Dict = (720, 1280) # Height, Width lowercase : Any = (0.4, 0.6) # if height or width lower than this scale, drop it. lowercase : Tuple ...
171
1
import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'facebook/data2vec-base-960h': 'https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json',...
110
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 lowerCAmelCase = logging.get_logger(__name__) def _a ( SCREAMING_SNAKE_CASE...
110
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependencyNotAvailabl...
140
def A_ ( _lowerCAmelCase = "The quick brown fox jumps over the lazy dog" , ) -> bool: UpperCamelCase : Union[str, Any] = set() # Replace all the whitespace in our sentence UpperCamelCase : Union[str, Any] = input_str.replace(" " , "" ) ...
140
1
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from tra...
244
"""simple docstring""" import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast 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 import To...
266
0
import random def snake_case_ ( snake_case , snake_case ) -> tuple: lowercase__ , lowercase__ , lowercase__: Any = [], [], [] for element in data: if element < pivot: less.append(sna...
288
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore, ) ...
288
1
'''simple docstring''' import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf clas...
168
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.m...
310
0
"""simple docstring""" import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase = 8 ) -> str: lowercase__: List[str] = ascii_letters + digits + punctuation return...
2
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __A = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control the model ...
2
1
"""simple docstring""" import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore a : Any = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" a : List[Any] ...
105
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F'''{price_plus_tax(100, 0.25) = }''') ...
105
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureEx...
129
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) _A : str ={ '''sample_size''': 32, '''in_channels''': 3, '''out_channels'...
129
1
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def lowercase_ ( _lowerCamelCase : str = ""): lowercase__ : str = url or "https://www.imdb.com/chart/top/?ref_=nv_mv_250" lowercase__ : int = BeautifulSoup(reques...
87
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : Optional[int] = logging.get_logger(__name__) _snake_case : Optional[int] = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vi...
292
0
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean lowerCamelCase = 0 lowerCamelCase = [ [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,...
351
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowerCamelCase_ ( _a ): """simple docstring""" def wrapper(*_a , **_a ): lowerCAmelCase__ : ...
211
0
'''simple docstring''' import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, r...
55
'''simple docstring''' a_ : Any = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_load...
55
1
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_tokenizer...
371
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, BertEmbeddings, BertLayer,...
278
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
325
def __SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE : Optional[Any] , SCREAMING_SNAKE_CASE : List[Any] ) -> List[str]: __lowercase = [0 for i in range(r + 1 )] # nc0 = 1 __lowercase = 1 for i in range(1 , n + 1 ): ...
325
1
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def __lowerCamelCase ( __snake_case : Union[str, Any], __snake_case : List[Any], __sna...
136
'''simple docstring''' from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class lowerCamelCase ( lowercase_ ): '''simple docstring''' def lowercase__ ( self : Any , lowerCAmelCase_ : ...
136
1
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase__ ( UpperCAmelCase__ ) -> bytes: if len(_UpperCamelCase ) != 32: raise ValueError("""Input must be of length 32""" ) A_ = b"""""" for i in [3, 2, 1, 0]...
162
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=A ): """simple docstring""" __a = ["""note_seq"""] def __init__( self : List[Any] , *UpperCamelCase : List[Any] , **...
115
0
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union _SCREAMING_SNAKE_CASE : Optional[int] = TypeVar("T") _SCREAMING_SNAKE_CASE : Tuple = Union[List[T], Tuple[T, ...]] _SCREAMING_SNAKE_CASE : List[Any] = Union[T, List...
92
'''simple docstring''' import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForCondi...
92
1
'''simple docstring''' import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def _SCREAMING_SNAKE_CASE (A = 8 ) -> str: """simple docstring""" lowercase__ = ascii_letters + digits +...
2
'''simple docstring''' import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants lowerCamelCase : str = Mapping[str, np.ndarray] lowerCamelCase : List[Any] = Mapping...
2
1
"""simple docstring""" import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FO...
68
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _UpperCAmelCase ( unittest.TestCase )...
68
1
"""simple docstring""" 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_AR...
64
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( __snake_case : int ): '''simple docstring''' return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number...
220
0
from typing import TYPE_CHECKING import torch from ..models.auto import AutoModelForVisualQuestionAnswering, AutoProcessor from ..utils import requires_backends from .base import PipelineTool if TYPE_CHECKING: from PIL import Image class A ( SCREAMING_SNAKE_CASE__ ): __snake_case ...
359
from abc import ABC, abstractmethod from argparse import ArgumentParser class A ( __UpperCAmelCase ): @staticmethod @abstractmethod def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): """simple docstring""" raise NotImplementedError() @abstractmet...
167
0
'''simple docstring''' 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_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna che...
234
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path....
234
1
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_mu...
371
def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] UpperCAmelCase = 6 UpperCAmelCase = 1 UpperCAmelCase = 1901 UpperCAmelCase = 0 while yea...
152
0
from __future__ import annotations from math import pi def _A ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float ): """simple docstring""" if (inductance, frequency, reactance).coun...
95
from __future__ import annotations from collections.abc import Callable __UpperCAmelCase = list[list[float | int]] def A__ ( __lowerCamelCase, __lowerCamelCase ): SCREAMING_SNAKE_CASE_ = len(__lowerCamelCase ) SCREAMING_SNAKE_CASE_ = [[0 for _ in range(size + 1 )] for _ in ...
299
0
from PIL import Image def lowerCamelCase__ ( UpperCamelCase__ : Image , UpperCamelCase__ : float ) -> Image: '''simple docstring''' def brightness(UpperCamelCase__ : int ) -> float: return 128 + level + (c - 128) if not -255.0 ...
352
from cva import destroyAllWindows, imread, imshow, waitKey def lowerCamelCase__ ( UpperCamelCase__ : Dict ) -> Optional[Any]: '''simple docstring''' _snake_case , _snake_case = img.shape[0], img.shape[1] # converting each pixel's colo...
295
0
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
201
'''simple docstring''' UpperCAmelCase = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git ''' UpperCAmelCas...
141
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __A = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase ) -> List[int]: if isinstance(UpperCAmelCase__ , np.ndarra...
370
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/unispeech-sat-base-100h-libri-ft": ( "https://huggingface.co/microsoft/unispeec...
2
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vi...
158
"""simple docstring""" def a__ ( snake_case__ , snake_case__ = False ) -> str: if not isinstance(snake_case__ , snake_case__ ): lowerCamelCase = F'Expected string as input, found {type(snake_case__ )}' raise ValueError(snake_case__ ) if not...
291
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface i...
367
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokeniz...
201
0
import sys import turtle def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ , ) -> None...
338
from ...processing_utils import ProcessorMixin class lowercase_ ( UpperCamelCase_ ): """simple docstring""" UpperCAmelCase_ : List[Any] = ["""image_processor""", """feature_extractor"""] UpperCAmelCase_ : Optional[int] = """TvltImageProcessor""" UpperCAmelC...
338
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'microsoft/trocr-base-handwritten': ( 'https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json' ), # See ...
23
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'} class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__...
23
1
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class lowercase ( _UpperCAmelCase ): def _snake_case ( self , lowercase ) -> List[str]: with open(lowercase , ...
46
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' return [ord(SCREAMING_SNAKE_CASE ) - 96 for elem in plain] def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : l...
46
1
import argparse from collections import defaultdict import yaml UpperCamelCase__ : Tuple = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( snake_case_ ) -> List[str]: """simple docstring""" a = defaultdict(snake_case_ ...
330
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__ : Union[str, Any] = logging.get_logger(__name__) UpperCam...
330
1
'''simple docstring''' # 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....
229
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging lowercase : List[str] = loggin...
20
0
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> str: lowerCamelCase__ : int = AutoConfig.from_pretrained(_UpperCAmelCase ...
45
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class lowerCAmelCase ( pl.LightningModule ): def __init__( self : List[str] , UpperCAmelCase : Optional[Any] ) ...
45
1
import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogram_diffusion import S...
76
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import tor...
209
0
"""simple docstring""" import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.ja...
357
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, ComputeEnvironment, ...
171
0
from collections import deque class _lowerCamelCase: def __init__( self, lowerCamelCase, lowerCamelCase, lowerCamelCase) -> None: """simple docstring""" _lowercase : Optional[Any] = process_name # process name _lowerca...
21
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer fro...
2
0
"""simple docstring""" import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def __A (_...
371
"""simple docstring""" def __A (_SCREAMING_SNAKE_CASE ) ->int: """simple docstring""" lowerCAmelCase__ :list[list[int]] = [[0 for _ in range(_SCREAMING_SNAKE_CASE )] for _ in range(m + 1 )] for i in range(m + 1 ): lowerCAmelCase__ :str ...
254
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = {'''configuration_deit''': ['''DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Dei...
104
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import loggin...
172
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class a_ ( a__ ): """simple docstring""" @staticmethod @abstractmethod def __lowerCAmelCase ( _lowerCamelCase ) ->Optional[Any]: raise NotImplementedError() ...
19
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GENER...
19
1
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE__ ( ...
193
import operator def lowercase_ ( _lowerCamelCase : list , _lowerCamelCase : bool = False , _lowerCamelCase : list | None = None): lowercase__ : int = operator.lt if reverse else operator.gt lowercase__ : str = solution or [] if ...
87
0
'''simple docstring''' _SCREAMING_SNAKE_CASE = { "km/h": 1.0, "m/s": 3.6, "mph": 1.6_0_9_3_4_4, "knot": 1.8_5_2, } _SCREAMING_SNAKE_CASE = { "km/h": 1.0, "m/s": 0.2_7_7_7_7_7_7_7_8, "mph": 0.6_2_1_3_7_1_1_9_2, "knot": 0.5_3_9_9_5_6_8_0_3, } ...
217
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _lowerCAmelCase ( ): print('''Making key files...''' ) make_key_files('''rsa''' , 1...
217
1
"""simple docstring""" import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenizati...
16
from math import pi, sqrt, tan def lowerCamelCase_ ( UpperCamelCase__ : float ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * s...
90
0
UpperCAmelCase__ = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" UpperCAmelCase__ ...
26
from __future__ import annotations def _a ( a :dict , a :str ) -> set[str]: a , a = set(a ), [start] while stack: a = stack.pop() explored.add(a ) # Differences from BFS: # 1) pop last element instead of first one # 2) add ad...
26
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Tuple = logging.get_logger(__name__) _A : List[Any] = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config...
229
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__: str = { "configuration_lxmert": ["LXMERT_PR...
23
0
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device __A = False class _lowerCAmelCase ( u...
254
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = None ) ->str: """simple docstring""" if ...
254
1
from __future__ import annotations def A ( _lowercase , _lowercase ): SCREAMING_SNAKE_CASE : list[list[int]] = [] SCREAMING_SNAKE_CASE : list[int] = [] SCREAMING_SNAKE_CASE : Dict = 0 SCREAMING_SNAKE_CASE :...
182
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.func...
182
1
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva __UpperCamelCase = '''''' __UpperCamelCase = '''''' __UpperCamelCase = '''''' __UpperCamelCase = 1 # (0 is vertical, 1 is horizontal) def low...
363
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e impo...
38
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowercase : List[str] = logging.get_logger(__name__) __lowercase : Dict = { 'distilb...
27
'''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...
27
1
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torc...
222
'''simple docstring''' from __future__ import annotations def _a( UpperCamelCase__ : List[str], UpperCamelCase__ : Union[str, Any], UpperCamelCase__ : int, UpperCamelCase__ : List[str] ): # noqa: E741 '''simple docstring''' while r -...
222
1
"""simple docstring""" from __future__ import annotations class lowerCamelCase : '''simple docstring''' def __init__(self , _lowerCamelCase ): """simple docstring""" UpperCAmelCase__ : Optional[Any] = order # a_{0} ... a_{k} UpperCAmelCa...
171
"""simple docstring""" from __future__ import annotations def a__ ( lowerCAmelCase , lowerCAmelCase = None , lowerCAmelCase = None ) -> None: if start is None: UpperCAmelCase__ : Dict = 0 if end is None: UpperCAmelCase__ :...
171
1
'''simple docstring''' def UpperCamelCase_ ( A__ : str = "The quick brown fox jumps over the lazy dog" , ): '''simple docstring''' lowerCAmelCase_ : List[Any] = set() # Replace all the whitespace in our sentence lowerCAmelCase_ ...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A : List[str] = ...
89
1
"""simple docstring""" 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 ...
100
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A = { """configuration_owlvit""":...
293
0
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 ...test_config...
120
def SCREAMING_SNAKE_CASE_ ( __A : list ) -> bool: """simple docstring""" if not isinstance(__A , __A ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(__A ) == 0: raise ValueError('Inpu...
120
1
from pathlib import Path import fire from tqdm import tqdm def lowerCamelCase__ ( A__ : str="ro" , A__ : List[Any]="en" , A__ : Any="wmt16" , A__ : int=None ): '''simple docstring''' try: import datasets ...
12
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import A...
12
1
def snake_case( __magic_name__ ) -> str: '''simple docstring''' lowercase : List[str] = int(__magic_name__ ) if decimal in (0, 1): # Exit cases for the recursion return str(__magic_name__ ) lowercase , lowercase : Uni...
116
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { 'facebook/xmod-base': 'https://hugg...
116
1
'''simple docstring''' import copy from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING a__ : Dict = l...
80
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 _UpperCamelCase ( enum.Enum ): '''simple docstring''' lowerCamelCase__ ='all_checks' lowerCamelCase__...
76
0
from graphs.minimum_spanning_tree_kruskal import kruskal def __A ( ) -> Union[str, Any]: a = 9 a = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2, 8, 2], [8, 6, 6], [2, 3, 7], [2, 5, 4], ...
370
__UpperCamelCase : Dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def __A ( ) -> None: a = input("""Enter message: """ ) a = input("""Enter key [alphanumeric]: """ ) a = input("""Encrypt/Decrypt [e/d]: """ ) if mode.lower().startswit...
347
0
'''simple docstring''' import cmath import math def _A (lowerCAmelCase__ :float , lowerCAmelCase__ :float , lowerCAmelCase__ :float , lowerCAmelCase__ :float ) -> complex: '''simple docstring''' _a = math.radians(lo...
168
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .to...
168
1
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def _A ( ): """simple docstring""" a =ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) a =parser.add_subparser...
215
"""simple docstring""" import inspect import unittest from transformers import YolosConfig 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_configura...
215
1
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class UpperCamelCase_ ( UpperCamelCase): """simple docstring""" def UpperCAmelCase_ ( self : Optional[Any] , UpperCAmelCase__ : str ) -> Opt...
54
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar A__ = TypeVar("""T""") A__ = TypeVar("""U""") class __lowerCAmelCase ( Generic[T, U] ): def __init__( self , _snake_case , _snake_ca...
82
0
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
312
"""simple docstring""" 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 .token...
312
1
"""simple docstring""" import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRCo...
77
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( _lowerCamelCase: list[int] , _lowerCamelCase: list[int] , _lowerCamelCase: int ): __SCREAMING_SNAKE_CASE : List[Any] = list(range(len(_lowerCamelCase ) ) ) __...
112
0
from collections import namedtuple lowerCamelCase_ = namedtuple("""from_to""", """from_ to""") lowerCamelCase_ = { """cubicmeter""": from_to(1, 1), """litre""": from_to(0.001, 1_0_0_0), """kilolitre""": from_to(1, 1), """gallon""": from_to(0.00454, 264.172),...
357
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, SegformerForSemant...
14
0
"""simple docstring""" def lowercase_ ( _snake_case = 50 ): SCREAMING_SNAKE_CASE__ : Tuple = [1] * (length + 1) for row_length in range(3 ,length + 1 ): for block_length in range(3 ,row_length + 1 ): for block...
25
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import...
312
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart impor...
41
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\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 eac...
41
1
from __future__ import annotations def _a ( lowerCamelCase, lowerCamelCase, lowerCamelCase ): if len(lowerCamelCase ) == 0: raise ValueError("""find_max() arg is an empty sequence""" ) if ( left >= len(lowerCamelCase ) or left < -len(lowerCamelCase ) o...
287
import warnings 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 _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={ """nvidia/...
287
1
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : float = 1 / sqrt(2 ) ): '''simple docstring''' UpperCA...
61
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProc...
61
1
"""simple docstring""" import requests def _a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> None: snake_case_ = {"""Content-Type""": """application/json"""} snake_case_ = requests.post(_SCREAMING_SNAKE_CASE , json={"""text""": message_body} , ...
347
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) class __A (snake_case__): '''simple docstring''' def __init__( self : ...
347
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCamelCase : Any = { """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerConfig""", ...
371
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : List[str] = logging.get_logger(__name__) __lowerCamelCase : List[Any] = { """...
286
0
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def __lowerCamelCase ( ) -> str: """simple docstring""" UpperCamelCase = HfArgumentParser(A__ ) UpperCamelCase = parser.pars...
28
# using dfs for finding eulerian path traversal def a_ ( SCREAMING_SNAKE_CASE__ : Any , SCREAMING_SNAKE_CASE__ : List[str] , SCREAMING_SNAKE_CASE__ : List[str] , SCREAMING_SNAKE_CASE__ : Optional[int]=None ): '''simple docstring''' _low...
199
0
"""simple docstring""" 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 ...
316
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any ...
316
1
from ...configuration_utils import PretrainedConfig lowercase_ = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas-base-f...
7
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformer...
224
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(): im...
352
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
51
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 __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
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
1
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging _lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ : '''simple docstring''' _UpperCAmelCase : Optional...
130
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Tuple = logging.get_logger(__name__) _lowerCamelCase : Union[str, Any] = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.json''', # See ...
130
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING __snake_case =loggi...
4
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_...
200
0
'''simple docstring''' from importlib import import_module from .logging import get_logger UpperCamelCase : Optional[int] = get_logger(__name__) class UpperCamelCase : """simple docstring""" def __init__( self : Optional[Any] , UpperCAmelCase_ ...
345
'''simple docstring''' from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def SCREAMING_SNAKE_CASE__ ( snake_case : str , snake_case : float | Decimal , snake_case : float = 10**-10 ...
345
1