code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
from __future__ import annotations from collections.abc import Generator def __SCREAMING_SNAKE_CASE ( ) -> Generator[int, None, None]: '''simple docstring''' UpperCAmelCase = {} UpperCAmelCase = 2 while True: UpperCAmelCase = ...
130
import warnings from ..trainer import Trainer from ..utils import logging __A : Any = logging.get_logger(__name__) class A_ (a_ ): def __init__( self , _A=None , **_A ): '''simple docstring''' warnings.warn( '''`SageMakerTrain...
130
1
from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class lowerCamelCase : def A__ ( self , lowerCAmelCase ): raise NotImplementedError() def A__ ( self ): raise NotImplemented...
712
import math def snake_case__ ( __SCREAMING_SNAKE_CASE ) -> list[int]: UpperCAmelCase_ = [] UpperCAmelCase_ = 2 UpperCAmelCase_ = int(math.sqrt(__SCREAMING_SNAKE_CASE ) ) # Size of every segment UpperCAmelCase_ = [True] * (end + 1) UpperCAmelCase_ = ...
23
0
from typing import Union import fire import torch from tqdm import tqdm def a ( A__ : str , A__ : str = "cpu" , A__ : Union[str, None] = None ) -> None: """simple docstring""" _lowercase =torch.load(A__ , map_location=A__ ) for k, v ...
291
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { 'facebook/timesformer': 'https://huggingface.co/facebook/timesformer/resolve/main/config.json', } class __lowerCAmelCase ( SC...
291
1
'''simple docstring''' from jiwer import compute_measures import datasets UpperCamelCase_ = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WI...
714
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('''repo_id''' , ['''canonical_dataset_name''', '''org-name/dataset-name'''] ) @pytest.mark.parametrize('''path''' , ['''filename.csv''', '''filename with blanks.cs...
599
0
"""simple docstring""" from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging A = logging.get_logger(__name__) A = { 'google/umt5-small': 'https://huggingface.co/google...
449
"""simple docstring""" import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging A = logging.get_logger(__name__) def __SCREAMING_SNAKE_CASE ( lowerCamelC...
449
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType lowerCAmelCase : Optional[Any]...
353
from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
353
1
'''simple docstring''' import unittest import numpy as np import requests 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 ...
358
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor __lowerCAmelCase = logging.get_logger(__name__) class __magic_name__ ( _UpperCamelCase ): def __init__( self : Tuple ,*_UpperCAmelCase : s...
358
1
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCamelCase__: def __init__( self : Tuple , lowerCAmelCase : int = 6 )-> None: """simple docstring""" UpperCAmelCase = None UpperCAmelCase ...
721
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __...
296
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def a__ ( A_, A_, A_ ): '''simple docstring''' if gpta_config_file ==...
529
0
"""simple docstring""" # 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 ...
296
"""simple docstring""" import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def...
296
1
'''simple docstring''' import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing...
138
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowercase__( )-> Optional[int]: """simple docstring""" raise RuntimeError("CUDA ou...
138
1
"""simple docstring""" from numpy import exp, pi, sqrt def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase = 0.0 , __lowerCamelCase = 1.0 ) -> int: return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main_...
122
"""simple docstring""" import re def __UpperCAmelCase ( __lowerCamelCase ) -> bool: lowercase__ : Optional[Any] = re.compile( r'''^(?:0|94|\+94|0{2}94)''' r'''7(0|1|2|4|5|6|7|8)''' r'''(-| |)''' r'''\d{7}$''' ) return bool(re.search(__lowerCam...
122
1
"""simple docstring""" import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import requi...
104
__lowercase = """Alexander Joslin""" import operator as op from .stack import Stack def _lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = {'''*''': op.mul, '''/''': op.truediv, '''+''': op.add, '''-''': op.sub} A_ ...
203
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowercase_: List[str] = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNet...
705
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def _lowercase ( UpperCAmelCase_): """simple docstring""" if "img_encoder.pos_embed" in name: snake_case__ : Dict = ...
127
0
from __future__ import annotations def _lowercase( __a : int ): a__ =2 a__ =[] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(__a ) if n > 1: ...
20
'''simple docstring''' import sys UpperCamelCase_ : Union[str, Any] = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """1254069874715852386305...
331
0
"""simple docstring""" from __future__ import annotations def _snake_case ( lowercase__ , lowercase__ ): _lowerCamelCase : list[list[int]] = [] create_all_state(1 , lowercase__ , lowercase__ , [] , l...
492
"""simple docstring""" 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_...
492
1
import random def SCREAMING_SNAKE_CASE__ ( lowerCAmelCase_ : int ,lowerCAmelCase_ : float ,lowerCAmelCase_ : bool = False ) -> dict: """simple docstring""" SCREAMING_SNAKE_CASE_ : dict ={i: [] for i in range(a_ )} # if p...
220
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A = logging.get_logger(__name__) A = { '''facebook/convnextv...
52
0
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( _lowerCAmelCase ): a__ : Tuple = (EulerDiscreteScheduler,) a__ : int ...
397
"""simple docstring""" import qiskit def lowercase__ ( snake_case_ :int , snake_case_ :int ): __UpperCAmelCase = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register __UpperCAmelCase = qiskit.QuantumCircu...
397
1
'''simple docstring''' import numpy as np __snake_case = [ ['''a''', '''b''', '''c''', '''d''', '''e'''], ['''f''', '''g''', '''h''', '''i''', '''k'''], ['''l''', '''m''', '''n''', '''o''', '''p'''], ['''q''', '''r''', '''s''', '''t''', '''u'''], ['''v''', '''w''', '''x''', '''y''', '''z''']...
189
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, ...
189
1
"""simple docstring""" from manim import * class __snake_case ( __lowerCAmelCase ): def lowerCamelCase_ ( self) -> Tuple: '''simple docstring''' a__: Dict = Rectangle(height=0.5 , width=0.5) a__: List[Any] = Rect...
217
"""simple docstring""" from math import ceil def __a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->int: a__: List[Any] = list(range(0 , _SCREAMING_SNAKE_CASE ) ) a__: Dict = [item for sublist in list(device_map.values() ) for item in sublist] # ...
217
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __snake_case : List[Any] = logging.get_logger(__name__) class UpperCamelCase ( a ): """simple docstring...
571
"""simple docstring""" import unittest import numpy as np from transformers import AlbertConfig, 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_a...
571
1
"""simple docstring""" def a__ ( snake_case__ ) -> Union[str, Any]: # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection lowerCamelCase = len(snake_case__ ) lowerCamelCase = ...
533
"""simple docstring""" from __future__ import annotations def a__ ( snake_case__ , snake_case__ = None , snake_case__ = None ) -> None: if start is None: lowerCamelCase = 0 if end is None: lowerCamelCase = len(snake_case__ ) - 1 ...
533
1
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES A__ : List[str] = logging.get_logger(__name__) A__ : Optional[Any...
13
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 10_00 ) -> int: __lowerCamelCase : Union[str, Any] = 3 __lowerCamelCase : Dict = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
13
1
"""simple docstring""" 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 ...
720
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def __lowerCamelCase ( lowerCAmelCase__ ,lowerCAmelCase__ = "cpu" ,lowerCAmelCase__ = None ): A__ = torch.load(lowerCAmelCase__ ,map_locat...
554
0
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowercase ( __A : Dict ) -> Optional[Any]: '''simple docstring''' def wrapper(*__A : Dict , **__A : Tuple ): ...
36
"""simple docstring""" from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import float...
506
0
"""simple docstring""" import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class __magic_name__ ( _UpperCamelCase ,_Upp...
309
"""simple docstring""" import os import pytest from transformers.dynamic_module_utils import get_imports a__ : Optional[Any] = """ import os """ a__ : Optional[Any] = """ def foo(): import os return False """ a__ : Tuple = """ def foo(): def...
309
1
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if len(UpperCAmelCase__ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): ...
605
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position snake_case : Dict = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'...
605
1
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCAmelCase_ = TypeVar('T') lowerCAmelCase_ = TypeVar('U') class UpperCamelCase ( Generic[T, U] ): """simple docstring""" def __init__( self : Any ...
110
import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def snake_case ( UpperCAmelCase : List[Any] ): if "model" in orig_key: A = orig_key.replace('model.', '' ) if "norm1" in orig_key: A = orig_key.replace('norm1'...
110
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase_ : Dict = { '''edbeeching/decision-transformer-gym-hopper-medium''...
255
from __future__ import annotations def __UpperCAmelCase ( a_ , a_ , a_): snake_case_ = list(range(len(a_))) snake_case_ = [v / w for v, w in zip(a_ , a_)] index.sort(key=lambda a_: ratio[i] , reverse=a_) snake_case_ = 0 ...
198
0
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow snake_case__ = False class lowerCAmelCase_ ( unittest.TestCase): def _snake_case ( self ...
708
# Copyright 2021 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 applic...
373
0
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf...
266
__UpperCamelCase: str = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} __UpperCamelCase: Tuple = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def SCREAMING_SNAKE_CASE__ ( _lowercase : dict[int, list[int]] , _lowercase : int , _lowercase : list[bool] ) -> ...
266
1
from __future__ import annotations import math def lowerCAmelCase_ ( lowercase: int ) -> 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 even numbers, all multiple...
264
from __future__ import annotations UpperCAmelCase_ = 1.6_0_2_1E-1_9 # units = C def lowerCAmelCase_ ( lowercase: float , lowercase: float , lowercase: float , ) -> tuple[str, float]: '''simple docstring''' if (conductivity, electron_conc, mobi...
264
1
"""simple docstring""" import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase_ (UpperCamelCase__ : Tuple , UpperCamelCase__ ...
506
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Any = logging.get_logger(__name__) _lowerCAmelCase :Union[str, Any] = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/conf...
506
1
'''simple docstring''' import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __snake_case : """simple docstring""" lowercase = None def __lowercase ( self ...
709
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __A : str = logging.get_logger(__name__) __A : List[str] = { "facebook/timesformer": "https://huggingface.co/facebook/timesformer/res...
398
0
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class lowercase__ ...
195
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Tuple ...
400
0
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
714
import string from math import logaa def __SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE : str , SCREAMING_SNAKE_CASE : str ) -> int: __lowercase = document.translate( str.maketrans('' , '' , string.punctuation ) ).replace('\n' , ''...
688
0
"""simple docstring""" import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _UpperCamelCase ( UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> Tuple: """simple docstring""" __Up...
77
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def _UpperCamelCase ( UpperCamelCase , UpperCamelCase = "cpu" , UpperCamelCase = None ) -> None: """simple docstring""" __UpperCAmelCase : Union[str,...
77
1
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import...
715
import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class UpperCamelCase__ ( __SCREAMING_SNAKE_CASE ): """simple docstring""" UpperCAmelCase_ =["image_processor", "tokenizer"] UpperCAmelCase_ =...
597
0
"""simple docstring""" import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configura...
58
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A = {"configuration_sew": ["SEW_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
290
0
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device _UpperCAmelCase = False class UpperCAmelCase ( unittest.TestCas...
70
import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_checkpoint_callback...
70
1
import json import sys def lowerCamelCase__ (_UpperCAmelCase , _UpperCAmelCase): with open(_UpperCAmelCase , encoding='utf-8') as f: SCREAMING_SNAKE_CASE = json.load(_UpperCAmelCase) SCREAMING_SNAKE_CASE = ['<details>', '<summary>Show updated benchmar...
73
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation ...
311
0
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging __A...
62
from __future__ import annotations def __A ( _lowercase , _lowercase , _lowercase , _lowercase ): # noqa: E741 '''simple docstring''' while r - l > 1: _A = (l + r) // 2 if v[m] >= key: _A = m else: ...
62
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __snake_case : Any = { 'configuration_resnet': ['RESNET...
571
"""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, DPTImageProcesso...
571
1
'''simple docstring''' import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version A ...
713
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging A =logging.get_logger(__name__) A ={ 'facebook/encodec_24khz': 'https://huggingface.co/facebook/encodec_24khz/resolve/ma...
358
0
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE = argparse.ArgumentParser() parser.add_argument('--du...
94
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 FeatureE...
509
0
"""simple docstring""" from __future__ import annotations def _snake_case ( snake_case__ : float , snake_case__ : float , snake_case__ : float ): if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_interest_rate < 0: ...
22
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Dict ) -> int: A = {} def _SCREAMING_SNAKE_...
22
1
"""simple docstring""" import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline __snake_case = { '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 ...
200
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _lowerCamelCase ( lowerCamelCase__ : int , lowerCamelCase__ : int , lowerCamelCase__ : float = 1 / sqrt(2 ) ): lowercase__ : str = tau * ...
200
1
"""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 accelerate...
706
"""simple docstring""" from __future__ import annotations def __snake_case ( UpperCamelCase ) -> bool: """simple docstring""" a__ = len(UpperCamelCase ) # We need to create solution object to save path. a__ = [[0 for _ in range(UpperCamelCase )] for _...
158
0
"""simple docstring""" import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_uti...
247
"""simple docstring""" from __future__ import annotations def lowercase (SCREAMING_SNAKE_CASE_ : list[int] ) -> int: SCREAMING_SNAKE_CASE = len(SCREAMING_SNAKE_CASE_ ) // 2 # choose the middle 3 elements SCREAMING_SNAKE_CASE = lst[m ...
247
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { "google/switch-base-8": "https://huggingface.co/google/switch-base-8/blob/main/config.json", } class __A ( snake_case__ ): '''simple docstring'''...
587
import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def UpperCamelCase_ ( lowerCAmelCase__ ): """simple docstring""" if "model" in orig_key: _lowerCAmelCase : Any = orig_key.replace("model." , "" ) if "norm1" in orig_key: ...
587
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { 'configuration_distilbert': [ ...
57
'''simple docstring''' 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 lowerCAmelCase__ ( ...
627
0
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/config.json""", """xlnet-large-c...
713
from argparse import ArgumentParser from . import BaseTransformersCLICommand def snake_case_ (__A : Union[str, Any] ) -> Any: return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class SCREAMING_SNAKE_CASE ( ...
218
0
'''simple docstring''' import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipelin...
11
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass...
26
0
'''simple docstring''' __lowerCAmelCase = [ """Audio""", """Array2D""", """Array3D""", """Array4D""", """Array5D""", """ClassLabel""", """Features""", """Sequence""", """Value""", """Image""", """Translation""", """TranslationVariableLanguages""", ] fro...
718
'''simple docstring''' import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class UpperCAmelCase__ ( unittest.TestCase ): """simple docstring""" def __lowercase ( self : Union[str, Any] ): ...
319
0
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor lowercase__ : Tuple = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__...
376
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher, ...
376
1
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def snake_case_ (UpperCamelCase : Tuple , UpperCamelCase : List[str] , **UpperCamelCase : List[str] ): '''simple docstring''' _a ...
708
'''simple docstring''' import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, neste...
377
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class SCREAMING_SN...
8
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { 'RWKV/rwkv-4-169m-pile': 'https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json', '...
389
0
"""simple docstring""" def UpperCamelCase_ ( lowerCamelCase : int ) -> int: """simple docstring""" assert ( isinstance(lowerCamelCase , lowerCamelCase ) and number_of_steps > 0 ), f"""number_of_steps needs to be positive integer, your input...
147
"""simple docstring""" from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TR...
147
1
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffu...
96
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, is_vis...
43
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) fro...
716
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase : Tuple = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author=...
290
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case = { """configuration_blenderbot_small""": [ """...
67
"""simple docstring""" import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex lowercase_ = logging.getLogger(__name__) class UpperCAmelCase_ : """simple docstring""" ...
470
0
import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated _A = collections.namedtuple('_Datasets', ['train', 'validation', 'test']) # CVDF ...
682
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/config.json', 'Salesforce/blip-vqa-capfit-...
682
1
'''simple docstring''' import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_chec...
541
'''simple docstring''' from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def __UpperCAmelCase ( A ...
541
1
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _snake_case : List[Any] = False class __SCREAMING_SNAKE_CASE ( u...
214
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import...
214
1
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ne...
266
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: Optional[int] = logging.get_logger(__name__) __UpperCamelCase: Optio...
266
1
"""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=None, type...
494
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class lowerCAmelCase : def __init__( self ): _UpperCAmelCase = {} def __A ( self , a__ , a__ , a__=1 ...
494
1
'''simple docstring''' from math import pi, sqrt, tan def A_ ( _lowerCamelCase : float ): if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def A_ ( _lowerCamelCase : f...
309
'''simple docstring''' import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () snake_case = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf(), ...
309
1
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda fro...
718
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) fr...
520
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import...
456
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_toke...
456
1
'''simple docstring''' def lowerCAmelCase__ ( UpperCAmelCase ): """simple docstring""" if len(UpperCAmelCase ) <= 1: return [tuple(UpperCAmelCase )] snake_case__ : Tuple = [] def generate(UpperCAmelCase...
172
'''simple docstring''' from __future__ import annotations def lowerCAmelCase__ ( UpperCAmelCase , UpperCAmelCase ): """simple docstring""" if len(UpperCAmelCase ) <= 1 or n <= 1: return insert_next(UpperCAmelCase ...
172
1
"""simple docstring""" from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy...
169
"""simple docstring""" from __future__ import annotations import math def lowercase (snake_case__ : int ) -> list[int]: '''simple docstring''' if num <= 0: lowerCAmelCase = f'''{num}: Invalid input, please enter a positive integer.''' raise Value...
169
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig""", """PoolFo...
431
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : list , UpperCAmelCase_ : int ) -> Tuple: # Checks if the entire collection has been sorted if len(UpperCAmelCase_ ) <= 1 or n <= 1: return insert_next(UpperCA...
431
1
"""simple docstring""" import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils i...
259
"""simple docstring""" import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class __UpperCamelCase ( a__ ): _UpperCAmelCase = ["image_processor", "tokenizer"] _UpperCAmelCase = "AutoImag...
259
1
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def A__ ( lowercase: Tuple ) -> str: # vision encoder if "img_encoder.pos_embed" in name: A : Any =name.r...
714
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
661
0
"""simple docstring""" import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
532
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def _lowerCamelCase ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ) -> Any: '''simple docstring''' ...
79
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 __A ( snake_case__ ,unittest.TestCase ): '''simple docstring''' a_ = TransfoXLToke...
587
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_safe imp...
587
1
import inspect import unittest from transformers import ViTMSNConfig 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_configuration_common import ConfigTester from ...test_model...
321
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_...
321
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { 'xlm-mlm-en-2048': 'https://huggin...
640
'''simple docstring''' 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 D...
640
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase = {'''configur...
211
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotA...
211
1
'''simple docstring''' import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class UpperCamelCase...
708
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
0
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch import pyarrow as...
0
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __lowercase ( snake_case ): """simple docstring""" __magic_name__ :Optional[Any] = [ '''encoder.version''', '''decoder.version''', ...
0
1
"""simple docstring""" from functools import reduce __lowerCamelCase = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295...
709
"""simple docstring""" from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImag...
190
0
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class A_ ( unittest.TestCase )...
236
from __future__ import annotations def __lowerCamelCase (UpperCAmelCase__ : str , UpperCAmelCase__ : list[str] | None = None , UpperCAmelCase__ : dict[str, float] | None = None , UpperCAmelCase__ : bool = False , ): SCREAMING_SNAKE_CASE = cipher_...
403
0
"""simple docstring""" import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase__ : Any = { """facebook/mask2former-swin-small-coco-instance""": ( ...
703
"""simple docstring""" import baseaa def lowercase_ ( _snake_case ): return baseaa.baaencode(string.encode("""utf-8""" ) ) def lowercase_ ( _snake_case ): return baseaa.baadecode(_snake_case ).decode("""utf-8""" ) if __name__ == "__main__": UpperCAmelC...
545
0
"""simple docstring""" def lowerCamelCase_( _lowerCamelCase ) -> Dict: '''simple docstring''' if not head: return True # split the list to two parts _lowerCamelCase, _lowerCamelCase : List[str] = head.next, head while fast and fast.next: _...
46
def SCREAMING_SNAKE_CASE__ ( snake_case__ :str , snake_case__ :str ) -> list: _lowercase = len(snake_case__ ) _lowercase = [] for i in range(len(snake_case__ ) - pat_len + 1 ): _lowercase = True for j in range(snake_case__ ): ...
67
0
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.training.common_...
437
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 = datasets.utils.logging.get_logger(__name__) @dataclass class _SCREAMING_SNAKE_CASE ( d...
437
1
def _a ( lowerCAmelCase , lowerCAmelCase )-> List[Any]: # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) SCREAMING_SNAKE_CASE_ = (boundary[1] - boundary[0]) / steps SCREAMING_SNAKE_CASE_ = boundary[0] SCREAMING_SNAKE_CA...
360
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common ...
360
1
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class __snake_case ( snake_case__ ): """simple docstring""" UpperCamelCase_ = 'EncodecFeatureExtractor' UpperCamelCase_ = ('T5Tokeniz...
683
from __future__ import annotations def UpperCamelCase ( snake_case__ , snake_case__ , snake_case__ , ): if (electron_conc, hole_conc, intrinsic_conc).count(0) != 1: raise ValueError("You cannot supply more or less than 2 values") elif electron_conc < 0: raise V...
683
1
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase : str = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
142
"""simple docstring""" import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowercase : List[str] = logging.get_logger(__name__) class lowerCAmelCase ( a ): """simple docstring""" def __init__( self , ...
142
1
"""simple docstring""" from math import factorial, pi def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ = 30 ) -> float: if not isinstance(SCREAMING_SNAKE_CASE__, (int, float) ): raise ValueError("maclaurin_sin() requires either an int or float for theta" ) i...
370
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
370
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json", # See all AltCLIP models at https:/...
475
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MA...
518
0
'''simple docstring''' 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 @requi...
318
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { "facebook/xglm-564M": "https://huggingface.co/facebook/xglm-564M/resolve/main/config.json", # See a...
318
1
class lowercase_ : def __init__( self) -> str: a__ =0 a__ =0 a__ ={} def __UpperCamelCase ( self , lowercase_) -> Dict: if vertex not in self.adjacency: a__ ={} self...
20
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin...
293
0
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import B...
678
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ : str = logging.get_logger(__name__) a_ : Union[str, Any] ...
678
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "BridgeTower/bridgetower-base": "https://huggingface.co/BridgeTower/bridgeto...
666
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimensio...
666
1
"""simple docstring""" import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _lowercase : Tuple = WebClient(token=os.environ["CI_SLACK_BOT_TOKEN"]) def snake_case__...
703
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list[int] ): """simple docstring""" if not numbers: return 0 if not isinstance(__lowerCamelCase , (list, tuple) ) or not all( isinstance(__lowerCamelCase , __lowerCamelCase ) for number in num...
625
0
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py lowerCamelCase_ : Any = """\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Automat...
548
from statistics import mean, stdev def _A (UpperCamelCase : list , UpperCamelCase : int = 3 ) ->list: '''simple docstring''' lowerCamelCase__ : Dict = min(UpperCamelCase ) lowerCamelCase__ : List[str] = max(UpperCamelCase ) # normalize...
157
0
'''simple docstring''' import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class __UpperCamelCase ( lowercase_ ): def ...
713
'''simple docstring''' def UpperCAmelCase ( lowerCamelCase_ :str ): '''simple docstring''' return " ".join( """""".join(word[::-1] ) if len(lowerCamelCase_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() ...
267
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : str = { "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"], } try: if not is_torch_available(): r...
56
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinvaConfig, SwinvaForImageClassification def lowerCAmelCase_ ( __A ) -> List[...
486
0
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__ : List[str] = logging.get_logger(__name__) UpperCamelCase__ : Any = ...
715
def __UpperCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int ) -> Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCamelCase_ , int(b / 2 ) ) * actual_power(lowerCamelCas...
685
0