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
def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : int ): if digit_amount > 0: return round(number - int(SCREAMING_SNAKE_CASE__ ) , SCREAMING_SNAKE_CASE__ ) return number - int(SCREAMING_SNAKE_CASE__ ) if __name__ == "_...
62
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : str = "" ): __UpperCamelCase =url or 'https://www.imdb.com/chart/top/?ref_=nv_mv_250' __UpperCamelCase =BeautifulSoup(request...
62
1
import csv import tweepy # Twitter API credentials snake_case_ = '''''' snake_case_ = '''''' snake_case_ = '''''' snake_case_ = '''''' def snake_case__ ( SCREAMING_SNAKE_CASE_ : str ): '''simple docstring''' lowercase__...
371
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class SCREAMING_SNAKE_CASE__ (__snake_case ): def __init__( self , a , ...
216
0
'''simple docstring''' from __future__ import annotations class a__ : def __init__( self : Tuple , a : str , a : str ): """simple docstring""" __lowerCamelCase , __lowerCamelCase = text, pattern __lowerCamelCase , __lowerCamelCase = l...
67
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, ...
159
0
"""simple docstring""" import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
157
"""simple docstring""" from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("""To use the rich extension, install rich with `pip install rich`""")
157
1
def lowercase_ ( _A : list ): """simple docstring""" if len(_A ) < 2: return collection def circle_sort_util(_A : list , _A : int , _A : int ) -> bool: lowerCamelCase__ : Union[str, Any] = F...
184
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge A : Optional[int] = [ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a cell phone...
184
1
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from...
285
def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> Union[str, Any]: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: lowercase : str ...
285
1
def __lowercase ( lowerCamelCase : float ): if edge <= 0 or not isinstance(lowerCamelCase , lowerCamelCase ): raise ValueError('Length must be a positive.' ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def __lowercase ( lowerCamelCase : float ): i...
175
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def __lowercase ( lowerCamelCase : str , lowerCamelCase : str , **lowerCamelCase : List[Any] ): UpperCamelCase_ : Union[str, Any] = AutoConfig.from_pretrained(lowerCamelCase ...
175
1
import os import re import shutil import sys import tempfile import unittest import black snake_case : Any = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is the ...
355
from collections import defaultdict from math import ceil, sqrt def __lowercase ( __lowerCAmelCase : int = 1_0_0_0_0_0_0 , __lowerCAmelCase : int = 1_0 ): a__ = defaultdict(__lowerCAmelCase ) for outer_width in range(3 , (t_limit // 4) + 2...
109
0
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won...
177
from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_pipeline_mixin impor...
216
0
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings lowerCamelCase = log...
48
'''simple docstring''' import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVec...
48
1
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ) ...
157
import copy from typing import Any, Dict, List, Optional, Union import numpy as np 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 Tensor...
157
1
"""simple docstring""" 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 ConfigTe...
362
"""simple docstring""" a__ : Optional[Any] = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' def UpperCAmelCase__ (): '''simple docstring''' __SCREAMING_SNAKE_CASE = input("Enter message: " ) __SCREAMING_SNAKE_CASE = input("Enter key...
195
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) _UpperCAmelCase : str = { """microsoft/unispeech-large-1500h-cv""": ( """https://huggingf...
285
import os import numpy import onnx def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' snake_case_ = a.name snake_case_ = b.name snake_case_ = '' snake_case_ = '' snake...
285
1
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class lowercase_ ( unittest.TestCase , lowercase ): '''simple docstring''' def __lowerCAmelCase ( self : str ) ->str: ...
26
import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators import ThreadedIte...
26
1
from collections.abc import Sequence def lowerCAmelCase ( _lowerCAmelCase : Sequence[int] | None = None ): """simple docstring""" if nums is None or not nums: raise ValueError("Input sequence should not be empty" ) UpperCAmelCase__ = nums[0] for i in rang...
169
"""simple docstring""" import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def _snake_case ( UpperCamelCase : Dataset , UpperCamelCase : Dict[str, str] ...
109
0
from __future__ import annotations import typing from collections import Counter def __lowerCAmelCase ( a__ ): __a = Counter() for base in range(1 , max_perimeter + 1 ): for perpendicular in range(__lowerCamelCase , max_perimeter + 1 ): __a ...
351
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
0
def A ( _SCREAMING_SNAKE_CASE ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ): raise TypeError("Input value must be a 'int' type" ) re...
48
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A ( _SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE = None ,_SCREA...
48
1
from __future__ import annotations from PIL import Image # Define glider example lowercase : Union[str, Any] = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0...
171
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging lowercase : Optional[int] = ...
171
1
"""simple docstring""" import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils impor...
77
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, infer_shape...
195
0
'''simple docstring''' import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( lowerCamelCase__ , unittest.TestCase ): """simple docstring...
356
'''simple docstring''' def lowerCAmelCase__ ( lowerCamelCase : int ,lowerCamelCase : list[int] ,lowerCamelCase : int ): def count_of_possible_combinations(lowerCamelCase : int ) -> int: if target < 0: return 0 ...
227
0
from math import pi, sqrt def lowerCAmelCase_ ( snake_case_ ): if num <= 0: raise ValueError("""math domain error""" ) if num > 1_71.5: raise OverflowError("""math range error""" ) elif num - int(snake_case_ ) not in (0, 0.5): rai...
26
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 ...fe...
26
1
"""simple docstring""" import argparse _lowerCAmelCase : Tuple = '''docs/source/_static/js/custom.js''' def lowerCamelCase_( _lowerCamelCase ) -> Tuple: '''simple docstring''' with open(_lowerCamelCase , encoding="utf-8" , newline="\n" ) as f: _l...
362
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modu...
340
0
'''simple docstring''' def UpperCAmelCase_ ( __lowercase : str , __lowercase : str ) -> list: '''simple docstring''' _UpperCAmelCase = len(__lowercase ) _UpperCAmelCase = [] for i in range(len(__lowerc...
22
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin __A : Dict = ''' Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that ...
33
0
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowerCamelCase ( snake_case_ ): """simple docstring""" def A__ ( self , UpperCAmelCase ) -> float:...
366
from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class __lowerCamelCase ( snake_case_ ): """simple docstring""" def A__ ( self ) -> int: '''simple docstring''' ...
297
0
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _A = get_tests_dir("""fixt...
171
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def a__ ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , low...
171
1
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def UpperCAmelCase_( a__ ): """simple docstring""" SCREAMING_SNAKE_CASE : Dict = [] SCREAMING_SNAKE_CASE :...
19
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_av...
19
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: List[st...
1
import random def a( A : Optional[Any] , A : Optional[Any] , A : str ) -> List[Any]: """simple docstring""" a = a[left_index] a = left_index + 1 for j in range(left_index + 1 , A ): if a...
227
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : List[str] = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''', '''CLIPSegTextConfig''',...
352
import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import Tok...
130
0
'''simple docstring''' # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F40...
319
'''simple docstring''' import fire from utils import calculate_rouge, save_json def SCREAMING_SNAKE_CASE( __lowercase , __lowercase , __lowercase=None , **__lowercase ) -> Any: A: Any = [x.strip() for x in open(__lowercase ...
319
1
'''simple docstring''' import math def a ( __a ) -> list[int]: '''simple docstring''' UpperCamelCase__ :Dict = [] UpperCamelCase__ :Union[str, Any] = 2 UpperCamelCase__ :int = int(math.sqrt(__a ) ) #...
367
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormat...
219
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ ): '''simple docstring''' lowercase = f'{sampling_rate}' lowercase = '1' lowercase ...
101
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
297
0
"""simple docstring""" from __future__ import annotations from dataclasses import dataclass @dataclass class a : _snake_case : float _snake_case : TreeNode | None = None _snake_case : TreeNode | None = None def __Uppe...
350
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase__ = { """configuration_git""": ["""GIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GitConfig""", """GitVisionConfig"""], """processing_git""": ["""...
30
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __A ={ '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], } try: if not is_torch_available(): raise Optio...
19
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCamelCase_ ( ): lowerCamelCase_ , lowerCamelCase_ = 9, 1_4 # noqa: F841 lowerCamelCase_ = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7...
19
1
"""simple docstring""" import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqd...
58
"""simple docstring""" import sys __snake_case : List[Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '125406987471585238630507156932909632...
58
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available SCREAMING_SNAKE_CASE__ = { """configuration_audio_spectrogram_transformer""": [ """AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", "...
325
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase__ = { '''configuration_biogpt''': ['''BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BioGptConfig'''], '''tokenization_biogpt''': ['''BioGptTok...
130
0
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _lowerCamelCase = (7_20, 12_80) # Height, Width _lowerCamelCase = (0.4, 0.6) # if height or width lower than this scale, drop it. _lowerCamelCase = 1...
362
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Union[str, Any] , __UpperCamelCase : int , __UpperCamelCase : Union[str, Any] , __UpperCamelCase : List[str]=5 ) ...
177
0
'''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 # #...
145
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTes...
219
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_t...
30
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser() parser.add_argument("""--dump_path""", de...
30
1
"""simple docstring""" from math import pow, sqrt def lowercase ( *lowerCAmelCase__ : float ) -> Optional[Any]: __a = len(snake_case__ ) > 0 and all(value > 0.0 for value in values ) return result def lowercase ( lowerCAmelCase__ : fl...
45
import os def a ( ): '''simple docstring''' lowercase_ = os.path.join(os.path.dirname(snake_case__ ) , '''num.txt''' ) with open(snake_case__ ) as file_hand: return str(sum(int(snake_case__ ) for line in file_hand ) )[:10] ...
30
0
"""simple docstring""" from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def UpperCamelCase_ ( lowerCAmelCase__ : NDArray[floataa] , lowerCAmelCase__ : NDArray[floataa] , lowerCAmelCase__ ...
289
"""simple docstring""" import argparse import os # New Code # 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_sched...
289
1
'''simple docstring''' from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttenti...
58
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def lowerCamelCase ( __lowerCamelCase : str ) ->Optional[int]: def decorator(__lowerCamelCase : int ): _SCREAMING_SNAKE_CASE = getattr(__lowerCamelCase , """ha...
58
1
"""simple docstring""" def _A ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float ): """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.2_5) = }""") print(F"...
350
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class __lowerCAmelCase ( UpperCamelCase__): _lowercase : Any = (PNDMScheduler,) _lowercase : str = (("""num_infe...
148
0
from random import shuffle import tensorflow as tf from numpy import array def lowerCamelCase__ ( __lowerCAmelCase : Optional[int] , __lowerCAmelCase : int ): """simple docstring""" lowerCAmelCase_ = int(__UpperCAmelCase ) assert noofclusters < len(__UpperCAmelCas...
231
"""simple docstring""" from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "snap-research/efficientformer-l1-300": ( "https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/c...
177
0
"""simple docstring""" import re def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = s...
259
"""simple docstring""" 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 : Tuple = logging.get_logger(__name__) A : ...
259
1
def a ( snake_case__: str , snake_case__: str ): '''simple docstring''' lowercase_ = len(snake_case__ ) lowercase_ = len(snake_case__ ) lowercase_ = ( first_str_length if first_str_length > second_str_length else ...
30
def a ( snake_case__: list , snake_case__: list , snake_case__: int , snake_case__: int , snake_case__: int ): '''simple docstring''' if index == number_of_items: return 0 lowercase_ = 0 lowercase_ = ...
30
1
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from...
358
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.modeling...
99
0
"""simple docstring""" import math def __UpperCAmelCase ( lowercase ): """simple docstring""" _UpperCAmelCase = 0 _UpperCAmelCase = 0 while num > 0: _UpperCAmelCase = num % 8 _UpperCAmelCase = octal + (remainder * math.floor(math....
289
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( lowercase ,lowercase ): """simple docstring""" _UpperCAmelCase = get_failure_array(lowercase ) # 2) Step through text searching for pattern _UpperCAmelCase , _UpperCAmelCase ...
289
1
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFI...
64
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = set() __lowerCamelCase : Union[str, Any] = 0 __lowerCamelCase : Optional[Any] ...
64
1
'''simple docstring''' import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter...
152
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availa...
148
0
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig 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 impo...
370
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for test...
57
0
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, ...
259
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, )...
259
1
'''simple docstring''' import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
123
'''simple docstring''' from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def UpperCamelCase ( _lowerCamelCase : bool = True , *_lowerCamelCase : Optional[int] , **_lowerCamelCase : Optional[Any] )...
123
1
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def a_ ( _lowerCAmelCase : List[str] , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : Optional[...
77
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Co...
99
0
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_...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_ = {'''configuration_yolos''': ['''YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''YolosConfig''', '''YolosOnnxConfig''']} try:...
64
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase( metaclass=__a ): '''simple docstring''' lowercase__ = ["note_seq"] def __init__( self: Dict, *a_: Union[str, Any], **a_: List[str] )...
64
1
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 BartForConditionalGeneration, BartTokeniz...
354
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_G...
94
0
'''simple docstring''' from __future__ import annotations from typing import TypedDict class __SCREAMING_SNAKE_CASE (lowerCamelCase_ ): """simple docstring""" __a =42 __a =42 def _lowerCamelCase ( lowercase : str ) -> list[s...
63
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
57
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _A = {"""configuration_reformer""": ["""REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",...
166
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class lowerCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__(self , _lowerCamelCase , _lowerCamelCase , _lower...
166
1
from ...processing_utils import ProcessorMixin class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : Dict = "SpeechT5FeatureExtractor" __UpperCAmelCase : List[str] = "SpeechT5Tokenizer" def __init__( self : Uni...
123
import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import floats_tensor, is_xformers_available,...
123
1
import numpy as np def _a ( UpperCAmelCase ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
265
def _a ( UpperCAmelCase , UpperCAmelCase ) -> Dict: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else: return a *...
265
1
'''simple docstring''' import re from filelock import FileLock try: import nltk A__: Optional[Any] = True except (ImportError, ModuleNotFoundError): A__: Optional[Any] = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: ...
276
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A__: str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Optional...
276
1
"""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/unispeech-sat-...
357
"""simple docstring""" import argparse from collections import defaultdict import yaml a = '''docs/source/en/_toctree.yml''' def _snake_case ( _snake_case : List[Any] ) -> Optional[Any]: '''simple docstring''' _A = defaultdict(_snake_c...
271
0
"""simple docstring""" import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, ...
316
from __future__ import annotations import collections import pprint from pathlib import Path def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" return "".join(sorted(UpperCAmelCase_ ) ) def __lowerCamelCase ( UpperCAmelCase_ : str...
94
0
def UpperCAmelCase_ (_lowerCAmelCase : int , _lowerCAmelCase : int ): return int((input_a, input_a).count(0 ) == 0 ) def UpperCAmelCase_ (): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , ...
171
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase : Union[str, Any] = {"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"]} try: if not is_vision_available(): r...
171
1
'''simple docstring''' from datetime import datetime import requests def _A ( _lowerCAmelCase ): """simple docstring""" __lowercase ='https://downloadgram.net/wp-json/wppress/video-downloader/video?url=' __lowercase =requests.get(base_url + url ).json()...
166
'''simple docstring''' import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
166
1
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from d...
367
UpperCAmelCase : Dict = [0, 2, 4, 6, 8] UpperCAmelCase : Tuple = [1, 3, 5, 7, 9] def _A ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : int ): "...
148
0
'''simple docstring''' from math import factorial, radians def __lowerCamelCase ( _lowercase , _lowercase = 1_8 , _lowercase = 1_0 ) -> float: UpperCAmelCase : Tuple = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from degrees t...
265
'''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 AutoImageProcessor, ViTImageProcessor from transformers.testing_utils imp...
265
1
"""simple docstring""" import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _A ( UpperCamelCase_ : str, UpperCamelCase_ : str, **UpperCamelCase_ : Optional[int]) -> Tuple: '''simple docstring''' __lowercase = AutoConfig....
355
"""simple docstring""" import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration _a = 5_00_00 _a = 50_00 _a , _a = os.path.split(__file__) _a = os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENA...
144
0
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : List[Any] = logging.get_logger(__name__) __lowerCAmelCase : Optional[int] = { 'xlnet-base-cased': 'https://huggingface.co/xlnet-base-cased/resolve/ma...
88
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCAmelCase__ ( unittest.TestCa...
271
0
"""simple docstring""" import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging lowerCamelCase = logging.get_logger(__name__) class lowercase__ : '''simple docstring''' ...
241
"""simple docstring""" from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class lowercase__ : '''simple docstring''' UpperCamelCase = 42 UpperCamelCase = None ...
241
1
"""simple docstring""" from __future__ import annotations def a__ ( lowerCAmelCase , lowerCAmelCase ) -> bool: if len(lowerCAmelCase ) == 0: return False UpperCAmelCase__ : Tuple = len(lowerCAmelCase ) // 2 if a_list[midpoint] == item: ...
171
"""simple docstring""" import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
171
1
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from dif...
360
'''simple docstring''' import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device fr...
156
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case = { '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], '''processing_git''': ['''Gi...
320
"""simple docstring""" import torch from diffusers import StableDiffusionPipeline __A = "path-to-your-trained-model" __A = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to("cuda") __A = "A photo of sks dog in a bucket" __A ...
148
0
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def UpperCAmelCase ( a_, a_, a_, a_, a_, a_ ): '''simple docstring''' if (ksize % 2) == 0: lowerCamelCase : Optional[in...
205
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .util...
205
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput ...
160
"""simple docstring""" import os def _snake_case ( ) -> Dict: with open(os.path.dirname(lowerCamelCase__ ) + "/p022_names.txt" ) as file: lowerCamelCase_ : str =str(file.readlines()[0] ) lowerCamelCase_ : Union[str, Any] ...
144
0
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : List[str] = """""" for i in table: res += inp[i - 1] return res def _UpperCamelCase ( UpperCamelCase__ ): return data[...
364
'''simple docstring''' import os from datetime import datetime as dt from github import Github __A =[ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _Upper...
283
0
"""simple docstring""" import fire from utils import calculate_rouge, save_json def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=None , **__UpperCamelCase ) -> Optional[Any]: """simple docstring""" lowerCAmelCase_ : ...
241
"""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 AutoProcessor, Be...
241
1
import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import ConfigTester from ...tes...
180
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowercase__ : Optional[int] = version.parse(importlib_metadata.version("nltk")) if NLTK_VERSION >= version.Version("3.6.4"): from nltk import word_tokenize lowercase...
180
1
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common ...
29
from math import isqrt, loga def UpperCAmelCase_ ( __lowerCAmelCase ) -> list[int]: __lowercase : Optional[Any] = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , __lowerCAmelCase , ...
156
0
"""simple docstring""" # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def lowerCAmelCase (__UpperCamelCase : Union[str, Any] , __UpperCamelCase : List[Any] , __UpperCamelCase : Dict ): """simple docstring""" __UpperCamelCase ={ ...
85
"""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 require_tokenizers, slow ...
85
1
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torch...
205
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 accelerat...
205
1
"""simple docstring""" import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets _a = datasets.logging.get_logger(__name__) _a = '\\n@InProceedings{moosavi2019minimum,\n auth...
366
"""simple docstring""" 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_chan...
144
0
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ = "" lowercase__ = ( Non...
207
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 _snake_case = logging.get_logger(__name__) _snake_case = { ...
283
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', ...
81
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
1
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def snake_case ( snake_case__ :int = 8) -> str: _A = ascii_letters + digits + punctuation return "".join(secrets.choice(snake_case__) ...
180
import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizerOutput f...
180
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) __lowerCAmelCase : int = { 'google/canine-s': 'https://huggingface.co/google/canine-s/resolve/main...
351
"""simple docstring""" def _a ( _SCREAMING_SNAKE_CASE ) -> list[int]: snake_case_ = len(_SCREAMING_SNAKE_CASE ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(i + 1 , _SCREAMING_SNAKE_CASE ): if numbers[j] < numbers[i]: ...
233
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _SCREAMING_SNAKE_CASE : Any = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], ...
85
'''simple docstring''' from __future__ import annotations import requests def UpperCamelCase_( snake_case : str ): '''simple docstring''' snake_case_ = f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty' return requests.get(s...
85
1
'''simple docstring''' from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit, ...
91
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTok...
91
1
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import Tens...
79
"""simple docstring""" import math def _snake_case ( lowerCamelCase__ : list , lowerCamelCase__ : int ) -> int: lowerCamelCase_ : int =len(lowerCamelCase__ ) lowerCamelCase_ : List[Any] =int(math.floor(math.sqrt(lowerCamelCase__...
144
0
def snake_case_ ( lowerCAmelCase_ : str , lowerCAmelCase_ : str ): __lowercase : Optional[Any] = len(lowerCAmelCase_ ) __lowercase : str = len(lowerCAmelCase_ ) __lowercase : Optional[int] = [[False for _ in rang...
306
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase : Optional[Any] = { '''configuration_poolformer''': [ '''POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PoolFormerConfig''', ...
306
1
"""simple docstring""" from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI...
81
"""simple docstring""" from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __A ( _SCREAMING_SNA...
81
1
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Dict =logging.get_logger(__name__) # TODO Update this A__ : Tuple ={ ...
364
'''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.skipUnles...
220
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) A_ = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CONFIG_A...
64
lowerCamelCase : Tuple = {'''a''': ['''c''', '''b'''], '''b''': ['''d''', '''e'''], '''c''': [], '''d''': [], '''e''': []} lowerCamelCase : int = ['''a''', '''b''', '''c''', '''d''', '''e'''] def snake_case_ ( lowerCAmelCase_ : Optional[int] , low...
233
0
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer...
350
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 A ( unittest.TestCase ): pass @nightly @requ...
167
0
"""simple docstring""" 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, ...
91
"""simple docstring""" import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_uti...
91
1
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( ...
369
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext...
283
0
from __future__ import annotations from math import pi def __lowerCamelCase ( snake_case__ ,snake_case__ ,snake_case__ ) -> dict[str, float]: """simple docstring""" if (inductance, frequency, reactance).count(0 ) != 1: r...
306
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mas...
306
1
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union __snake_case : Tuple = TypeVar('T') __snake_case : int = Union[List[T], Tuple[T, ...]] __snake_case : List[Any] = Union[T, List[T], Dict[str, T]] __snak...
369
'''simple docstring''' import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.num...
136
0
'''simple docstring''' import argparse import json from tqdm import tqdm def a_ ( ) -> str: """simple docstring""" lowerCamelCase_ =argparse.ArgumentParser() # Required parameters parser.add_argument( '''--src_path''' , t...
75
"""simple docstring""" import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a ( a_ ): UpperCAmelCase_ : List[Any] =["image_processor", "tokenizer"] UpperCAmelCase_ : str ="AutoImageProcessor" UpperCAme...
220
0
'''simple docstring''' def __lowerCamelCase ( __lowerCAmelCase : list[list[int | float]] ) -> int: snake_case = len(snake_case_ ) snake_case = len(matrix[0] ) snake_case = min(snake_case_ , snake_case_ ) for row in range(snake_case_...
367
'''simple docstring''' def __lowerCamelCase ( __lowerCAmelCase : list , __lowerCAmelCase : list , __lowerCAmelCase : int ) -> list: snake_case = len(__lowerCAmelCase ) snake_case = [[0] * n for i in range(__lowerCAmelCase ...
3
0