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
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class __A ( lowerCAmelCase ): lowerCAmelCase_ : Any = "" lowerCAmelCase_ : str = ( ...
138
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __A : Dict = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author={Yonghui Wu and...
138
1
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_ut...
336
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase ): return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
336
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Union[str, Any] = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig",...
57
"""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 _UpperCAme...
246
0
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import numpy as np import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor import tr...
352
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) UpperCAmelCase__ = { """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_M...
30
0
import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available snake_case_ = logging.getLogger(__name__) @dataclass class SCREAMING...
214
import unittest from transformers import DonutProcessor snake_case_ = '''naver-clova-ix/donut-base''' class SCREAMING_SNAKE_CASE__ (unittest.TestCase ): def snake_case_ ( self): lowercase__ : Dict = DonutProcessor.from_pretrained(a) def ...
214
1
"""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 ...
317
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return getitem, k def __UpperCAm...
317
1
'''simple docstring''' import socket def UpperCAmelCase__ ( ) -> Dict: A_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM ) A_ = socket.gethostname() A_ = 1_23_12 sock.connect((host, port) ) sock.send(b"""Hello server!""" ) ...
162
'''simple docstring''' import argparse import math import traceback import dateutil.parser as date_parser import requests def UpperCAmelCase__ ( UpperCAmelCase__ ) -> Optional[int]: A_ = {} A_ = job["""started_at"""] A_ = job["""completed_at"""] ...
162
1
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
95
"""simple docstring""" import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _a : Dict= logging.get_logger(__name__) class UpperCamelCase ( lowercase ): def __init__(self : List[str] , *_A : Dict ...
95
1
def lowercase_ ( _A : int , _A : float , _A : float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowercase_ ( _A : float , _A : float , _A : float ): "...
184
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : Optional[Any] = { "xlm-roberta-base": "...
184
1
import os import numpy import onnx def lowerCamelCase_ ( _a : Dict , _a : List[Any] ): '''simple docstring''' UpperCAmelCase_ : List[str] = a.name UpperCAmelCase_ : List[str] = b.name UpperCAmelCase_ : Union[str...
59
import random from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' for _ in range(len(_a ) ): UpperCAmelCase_ : List[str] = random.randint(0 , len(_a ) - 1 ) UpperCAmelCase_ : Any = r...
59
1
"""simple docstring""" import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class __lowerCamelCase ( a__ ): '''simple docstring''' A_ : Dict = 'M-CLIP' def __init__( self , __UpperCAmelCase=1024 , __UpperCAmelCase=768 , **__...
320
"""simple docstring""" import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor __snake_case = logging.get_logger(__name__) class __lowerCamelCase ( a__ ): '''simple docstring''' def __init__( self , *__UpperCAmelC...
320
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase = { "configuration_swiftformer": [ "SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwiftFormerConfig", "SwiftFormerOnnxConfig", ...
352
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : str =...
66
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) class lowerCamelCase_ ( UpperCAmelCase__ ): lowerCAmelCase__ = "timm_backbone" def __in...
181
'''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_utils import require...
67
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCamelCase : Union[str, Any] = { 'configuration_distilbert': [ ...
258
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def A (...
258
1
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determini...
336
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging _lowerCamelCase : str ...
336
1
"""simple docstring""" from __future__ import annotations import time __lowercase = list[tuple[int, int]] __lowercase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, ...
357
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer __lowercase = logging.get_logger(__name__) __lowercase = {'''vocab_file''': '''vocab.json''', '''merges_file''': '...
105
0
from __future__ import annotations import collections import pprint from pathlib import Path def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : str ): return "".join(sorted(snake_case__ ) ) def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : str ): return word_by_sig...
62
from __future__ import annotations def a ( snake_case__: list[int] , snake_case__: int , snake_case__: int , snake_case__: int ): '''simple docstring''' if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and...
30
0
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __a ( ) ->tuple[list[int], int]: """simple docstring""" A = [randint(-1000 , 1000 ) for i in range(10 )] A = randint(-50...
352
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
0
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
317
import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from transformer...
317
1
'''simple docstring''' import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_t...
368
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffuse...
95
def _A ( SCREAMING_SNAKE_CASE : Optional[Any] ): """simple docstring""" a__ : Optional[Any] =len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr a__ : List[Any] =arr.index(max(arr[0:cur] ) ...
95
1
import torch def snake_case_ () -> List[str]: if torch.cuda.is_available(): __lowerCAmelCase : Tuple = torch.cuda.device_count() else: __lowerCAmelCase : List[str] = 0 print(f'''Successfully ran on {num_gpus} GPUs''' ) if __n...
139
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transfo...
139
1
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 from ...test_tokeniza...
59
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.numpy as jnp ...
59
1
'''simple docstring''' import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() lowerCAmelCase :Optional[int] = ...
351
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase ( lowerCAmelCase : int ): """simple ...
275
0
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_ = { 'facebook/data2vec-text-base': 'https://huggingfa...
12
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": __a = pd.read_csv("sample_data.csv", header=None) __a = ...
66
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCAmelCase : Optional[Any] ={"""tokenization_bertweet""": ["""BertweetTokenizer"""]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys ...
363
"""simple docstring""" import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __lowerCAmelCase : Tuple ={ """facebook/mask2former-swin-small-coco-instance""": ( ""...
32
0
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
258
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if len(UpperCAmelCase ) <= 1 or n <= 1: return insert_next(UpperCAmelCase , n - 1 ) rec_insertion_sort(UpperCAmelCase , n - ...
258
1
'''simple docstring''' import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import A...
21
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available _lowercase : Union[str, Any] = {"tokenization_herbert": ["HerbertTokenizer"]} try: if not is_tokenizers_available(): raise Optional...
21
1
'''simple docstring''' import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class UpperCAmelCase ( snake_case_ ): _lowercase: Union[str, Any] = ['''image_processor''', '''tokenizer'''] _...
70
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _SCREAMING_SNAKE_CASE ( _lowercase : List[Any] ) ->str: '''simple docstring''' ...
105
0
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCamelCase_ ( UpperCamelCase__ : int ): '''simple docstring''' UpperCamelCase__ = FileLock(str(tmpdir / '''foo.lock''' ) ) UpperCamelC...
35
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase = { """facebook/maskformer-swin-base-ade""": ( ...
35
1
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
24
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version __a = { '''<''': operator.lt, '''<=''': operator.le, '''==''': operator.eq, '''!=''': operator.ne, '''>=''': operator.ge, '''>''': operator.gt, } def __lo...
337
0
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase__ ( lowercase_ ) -> bool: """simple docstring""" _UpperCamelCase : int = int(number**0.5 ) return number == sq * sq def lowercase__ ( l...
360
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {"UserAgent": UserAgent().random} def lowercase__ ( lowercase_ ) -> dict: """simple docstrin...
310
0
'''simple docstring''' def __UpperCamelCase ( lowercase__ : Any ): '''simple docstring''' return str(_UpperCamelCase ) == str(_UpperCamelCase )[::-1] def __UpperCamelCase ( lowercase__ : Union[str, Any] ): '''simple docstring''' ...
141
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def __lowercase ( ) ->int: """simple docstring""" lowercase : Tuple = HfArgumentParser(_UpperCamelCase ) lowercase : List[str] = parser.parse_args_in...
337
0
'''simple docstring''' def UpperCamelCase( UpperCAmelCase_ ): return credit_card_number.startswith(('34', '35', '37', '4', '5', '6') ) def UpperCamelCase( UpperCAmelCase_ ): UpperCAmelCase : Union[str, Any] = credit_card_number UpperCAmelCase : str ...
371
'''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, convert_to_rgb, get_resize_output_image_size, normalize, re...
280
0
'''simple docstring''' import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class _snake_case ( _a ): def __UpperCamelCase ( self : Dict ,SCREAMING_SNAKE_CASE__ : str ): with open(SCREAMING_...
139
'''simple docstring''' from __future__ import annotations import numpy as np def A_ ( snake_case ): return np.maximum(0 , snake_case ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
139
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer else: _...
350
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( lowerCamelCase_ ): lowerCAmelCase_ = (DDPMScheduler,) def _snake_case ( ...
264
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging lowerCAmelCase :Any = logging.get...
331
'''simple docstring''' from __future__ import annotations from typing import TypedDict class __A ( A ): '''simple docstring''' __lowerCamelCase : str __lowerCamelCase : int def lowerCAmelCase (__A): """simple docstring""" if not isinstance(__A...
211
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transforme...
205
"""simple docstring""" import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore _A = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" _A = [file for file in filepaths i...
205
1
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def __UpperCAmelCase ( __a : Optional[Any] ,__a : Union[str, Any] ,__a : int ,__a : Optional[int] ) -> Tuple: """simple docstring""" _a :...
235
def SCREAMING_SNAKE_CASE_ ( __A : list[int] , __A : str ) -> list[int]: """simple docstring""" a_ : Any = int(__A ) # Initialize Result a_ : Tuple = [] # Traverse through all denomination for denomination ...
32
0
'''simple docstring''' import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tok...
243
'''simple docstring''' def _lowercase ( __A = 10 ,__A = 22 ): '''simple docstring''' __UpperCamelCase = range(1 ,__A ) __UpperCamelCase = range(1 ,__A ) return sum( 1 for power in powers for base in bases if len(str(base**power ...
243
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch ...
21
def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> float: _lowercase : Tuple = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def UpperCamelCase_( ) ...
21
1
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data import Dat...
140
from pathlib import Path import numpy as np from PIL import Image def A_ ( _lowerCAmelCase ) -> np.ndarray: UpperCamelCase , UpperCamelCase , UpperCamelCase : Optional[Any] = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2] return 0.2_989 * r + 0.5_870 * g + 0.1_140 * ...
140
1
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __a = logging.get_logger(__name__) __a = { "vocab_file": "vocab.json", "merges_file...
35
'''simple docstring''' def __snake_case( _lowerCAmelCase = 1_000 ) -> int: return sum(e for e in range(3 , _lowerCAmelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
35
1
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils i...
369
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : int = logging.get_logger(__name__) _lowerCamelCase : Union[str, Any] = { '''microsoft/unispeech-sat-base-100h-libri-ft''': ( ''...
206
0
"""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 ...
217
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class __lowerCamelCase (_a ): _lowercase = """M-CLIP""" def __init__( self: int,A_: Any=1024,A_: Union[str, Any]=768,**A_: str ): ...
310
0
def _snake_case ( lowerCAmelCase: list )-> float: _snake_case : Tuple = 0 while len(_UpperCamelCase ) > 1: _snake_case : Any = 0 # Consider two files with minimum cost to be merged for _ in range(2 ): _snake_case : str ...
359
from math import ceil def lowerCamelCase_ ( lowerCAmelCase: Tuple , lowerCAmelCase: Union[str, Any] )-> str: _snake_case : Union[str, Any] = list(range(0 , lowerCAmelCase ) ) _snake_case : int = [item for sublist in list(device...
260
0
def A ( _SCREAMING_SNAKE_CASE ) -> Optional[Any]: lowerCamelCase : Tuple = [0] * len(_SCREAMING_SNAKE_CASE ) lowerCamelCase : Tuple = [] lowerCamelCase : Dict = [1] * len(_SCREAMING_SNAKE_CASE ) for values in g...
48
import math def _SCREAMING_SNAKE_CASE ( a ) -> list[int]: __A : List[str] = [] __A : Any = 2 __A : Union[str, Any] = int(math.sqrt(a ) ) # Size of every segment __A : Any = [True] * (end + 1) __A : Lis...
280
0
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def __A ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , ): ...
170
'''simple docstring''' import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor lowerCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) class __lowerCAmelCase ( __a ): def __init__(...
170
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
48
"""simple docstring""" import unittest import numpy as np def lowerCAmelCase__ ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ = None , ): '''simple docstring''' _a : List[Any] = np.shape(UpperCame...
294
0
"""simple docstring""" # XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path lowerCamelCase = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path)) ...
241
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, ...
241
1
def _UpperCAmelCase ( snake_case ): """simple docstring""" _lowerCAmelCase = """""" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _UpperCAmelCase ( snake_case ): ...
82
def __magic_name__ ( __a : str ): '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__a ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''').testmod()
244
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class __magic_name__ ( lowerCAmelCase_ ): @staticmethod @abstractmethod def __magic_name__ ( __snake_case ) -> List[Any]: '''simple docstring''' raise NotImpl...
308
def UpperCamelCase_( _snake_case : str , _snake_case : int ): """simple docstring""" return [sentence[i : i + ngram_size] for i in range(len(_snake_case ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import testmod ...
308
1
"""simple docstring""" from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { 'nielsr/canine-s': 2048, } # Unicode defines 1,114,112 tot...
243
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.dat...
243
1
import doctest from collections import deque import numpy as np class __magic_name__ : def __init__( self : str ) -> Dict: '''simple docstring''' UpperCamelCase__ : int = [2, 1, 2, -1] UpperCamelCase__ : Any = [1, 2, ...
359
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[Any] = logging.get_logger(__name__) __UpperCamelCase : Union[str...
51
0
from math import factorial, radians def UpperCamelCase ( __lowercase : float ,__lowercase : int = 18 ,__lowercase : int = 10 ): '''simple docstring''' A_ : Tuple = angle_in_degrees - ((angle_in_degrees // 3_60.0) * 3_60.0) # Converting fro...
140
from typing import Any import numpy as np def UpperCamelCase ( __lowercase : np.ndarray ): '''simple docstring''' return np.array_equal(__lowercase ,matrix.conjugate().T ) def UpperCamelCase ( __lowercase : np.ndarray ,__lowercase ...
140
1
from __future__ import annotations def UpperCAmelCase ( a_ ) -> bool: """simple docstring""" __A = str(a_ ) return n == n[::-1] def UpperCAmelCase ( a_ = 1_0_0_0_0_0_0 ) -> List[str]: """simple docstring""" ...
124
from __future__ import annotations def UpperCAmelCase ( a_ = 4 ) -> list[list[int]]: """simple docstring""" __A = abs(a_ ) or 4 return [[1 + x + y * row_size for x in range(a_ )] for y in range(a_ )] def UpperCAmelCase ( a_ ...
124
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Tuple = { "configuration_blip": [ "BLIP_PRETR...
28
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline lowerCamelCase :Tuple = logging.get_logger(__name...
206
0
'''simple docstring''' import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowerCAmelCase_ ( snake_case__ ): '''simple docstring''' A : Optional[Any] = ...
311
'''simple docstring''' # limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class A ( __snake_case ): def __init__( self , SCREAMING_SNAKE_CAS...
311
1
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class _A : """simple docstring""" def __init__( self : Optional[Any] , __UpperCAmelCase : Optional[Any] , __UpperCAmelCase ...
40
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A : Tuple = logging.get_logger(__name__) _...
260
0
import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig from transformers.models.ba...
359
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, require_ti...
103
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[int] =logging.get_logger(__name__) _lowercase : Optional[Any] ={ "studio-ousia/luke-base": "https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json", "stud...
170
import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class snake_case__ (datasets.BuilderConfig ): """simple docstring""" _...
170
1
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, p...
35
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging impo...
35
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __snake_case :Optional[int] = logging.get_logger(__name__) __snake_case :str ...
49
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig a : Optional[Any] = logging.get_logger(__name__) a : Tuple = "T5Config" ...
311
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ ={ 'configuration_llama': ['LLAMA_PRETRAINED_CONFIG_ARCHIVE_...
356
from __future__ import annotations import math def lowerCamelCase__ (__lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if depth < 0: raise ValueError("Depth cannot be less than 0" ) if len(__lowerCamelCase ) == 0: ...
325
0
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints, we had to include ...
159
"""simple docstring""" def lowerCAmelCase__ ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , ): '''simple docstring''' _a : Optional[Any] = [redshift, radiation_density, matter_...
294
0
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 if is...
350
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record _UpperCAmelCase = '\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n author={Wang, Alex and Pr...
328
0
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging lowercase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( ...
96
from datetime import datetime import requests def A (__A : str ) -> bytes: """simple docstring""" UpperCAmelCase_ = '''https://downloadgram.net/wp-json/wppress/video-downloader/video?url=''' UpperCAmelCase_ = r...
51
0
from __future__ import annotations import typing from collections import Counter def _a ( a :int ) -> typing.Counter[int]: a = Counter() for base in range(1 , max_perimeter + 1 ): for perpendicular in range(a , max_perimeter + 1 ): a ...
26
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_at...
26
1
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE__ ( lowercase ,lowercase = 0.0 ,lowercase = 1.0 ) -> int: return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": import doctest doctest.testmod() ...
124
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. lowerCamelCase : List[Any] = 1_0 def SCREAMING_SNAKE_CASE__ ( lowercase ,lowercase ,low...
124
1
def __lowerCamelCase ( snake_case__ ) -> List[str]: """simple docstring""" if not numbers: return 0 if not isinstance(lowerCamelCase_ ,(list, tuple) ) or not all( isinstance(lowerCamelCase_ ,lowerCamelCase_ ) for number in numbers...
356
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_...
125
0
"""simple docstring""" from pathlib import Path import numpy as np from PIL import Image def _A (__a ) -> np.ndarray: """simple docstring""" SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Optional[Any] = rgb[:, :, 0...
91
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
280
0
'''simple docstring''' import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_ava...
356
'''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_available(): ...
322
0
from manim import * class lowerCAmelCase ( __UpperCamelCase ): def A_ ( self : Dict ) -> List[str]: lowerCamelCase__ : List[Any] = Rectangle(height=0.5 , width=0.5 ) lowerCamelCase__ : Optional[Any] = Rectangle(height=0.4_6 , wid...
50
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hug...
103
0
from datetime import datetime import requests def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE :str ) -> bytes: __lowerCAmelCase : List[Any] = """https://downloadgram.net/wp-json/wppress/video-downloader/video?url=""" __lowerCAmelCase : Dict = requests.get(b...
370
import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor if is_flax_avail...
232
0
'''simple docstring''' import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCAmelCase_ : """simple docstring""" def __in...
35
'''simple docstring''' import numpy as np from transformers import Pipeline def __snake_case( _lowerCAmelCase ) -> Optional[int]: snake_case__ : Optional[Any] = np.max(_lowerCAmelCase , axis=-1 , keepdims=_lowerCAmelCase ) snake_case__ : List[str]...
35
1
"""simple docstring""" import argparse import os import re UpperCAmelCase__ = 'src/transformers/models/auto' # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict UpperCAmelCase__ = re.compile(r'[A-Z_]+_M...
40
"""simple docstring""" 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 imp...
40
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase ={ """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """AutoformerConfig""", ], } ...
287
def _a ( lowerCamelCase ): return " ".join( """""".join(word[::-1] ) if len(lowerCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words("""Hey wollef sroirraw"""))
287
1
"""simple docstring""" import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu lowercase__ = ...
368
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokeni...
161
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import DistilBertConfig, 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_t...
220
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCamelCase : Any = TypeVar('T') class a ( Generic[T] ): def __init__( self , _lowerCamelCase ): lowercase = ...
220
1
"""simple docstring""" class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase ): _lowerCamelCase : Union[str, Any] = val _lowerCamelCase : Union[str, Any] = None _lowerCamelCase : ...
366
"""simple docstring""" 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 lowercase__ = False class lowe...
12
0
def lowerCAmelCase_ ( snake_case_ ): if n_term == "": return [] _A : list = [] for temp in range(int(snake_case_ ) ): series.append(f'''1/{temp + 1}''' if series else """1""" ) return series if __name__ == "__main__": _sna...
26
def lowerCAmelCase_ ( snake_case_ ): if number < 0: raise ValueError("""number must not be negative""" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
26
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TFAutoMod...
14
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowerCamelCase_ = logging.get_logger(__name__) class a_ ( a_ ): '''simple docstring''' def __init__( self , ...
14
1
"""simple docstring""" def _A (__a , __a ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = [1] for i in range(2 , __a ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1...
91
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case_ : Union[str, Any] = { "configuration_pix2struct": [ "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Pix...
125
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_albert import Alb...
130
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO ) _lowerC...
130
1
'''simple docstring''' from __future__ import annotations _UpperCamelCase = 10 def a_ ( _lowerCAmelCase ) -> list[int]: __lowerCamelCase : Optional[Any] = 1 __lowerCamelCase : str = max(_lowerCAmel...
208
def _a ( SCREAMING_SNAKE_CASE : str ) -> Union[str, Any]: """simple docstring""" __lowerCAmelCase: str = len(SCREAMING_SNAKE_CASE ) __lowerCAmelCase: List[Any] = sum(SCREAMING_SNAKE_CASE ) __lowerCAmelCase: str = [[False for x in range(s + 1 )...
322
0
from __future__ import annotations import math from collections.abc import Callable def A ( _UpperCAmelCase : Callable[[int | float], int | float] , _UpperCAmelCase : int | float , _UpperCAmelCase : int | float , _Upper...
365
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import H...
290
0
def lowerCamelCase__ ( A__ : Optional[Any] ): '''simple docstring''' stooge(_lowerCamelCase , 0 , len(_lowerCamelCase ) - 1 ) return arr def lowerCamelCase__ ( A__ : List[str] , A__ : str , A__ : Li...
12
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int , _lowerCamelCase : int) -> float: '''simple docstring''' return base * power(_lowerCamelCase , (exponent - 1)) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of e...
232
0
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase_( a_...
367
import math def UpperCAmelCase_( a__ ): """simple docstring""" SCREAMING_SNAKE_CASE : Any = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(a__ ) def UpperCAmelCase_( a__ = 1 / 12_345 ): """simple docs...
19
0
"""simple docstring""" import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_...
40
"""simple docstring""" def lowercase ( A_ )-> str: '''simple docstring''' if isinstance(A_ , A_ ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(A_ , A_ ): raise TypeError("'str' obj...
40
1
def _a ( _lowercase : Tuple , _lowercase : Optional[int] ): '''simple docstring''' while b: __UpperCAmelCase , __UpperCAmelCase : Tuple = b, a % b return a def _a ( _lowercase : ...
360
'''simple docstring''' import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline __UpperCAmelCase...
240
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _snake_case = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP", "TrOCRConfig...
250
'''simple docstring''' from __future__ import annotations def snake_case ( UpperCAmelCase )-> list[int]: """simple docstring""" __A = 2 __A = [] while i * i <= n: if n % i: i += 1 els...
161
0
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_dev...
358
def _a ( SCREAMING_SNAKE_CASE__ : str ) -> str: '''simple docstring''' if not all(char in "01" for char in bin_string ): raise ValueError("Non-binary value was passed to the function" ) if not bin_string: raise V...
191
0
def __A ( __lowerCAmelCase = 1_000 )-> int: """simple docstring""" _UpperCAmelCase , _UpperCAmelCase = 1, 1 _UpperCAmelCase = 2 while True: _UpperCAmelCase = 0 _UpperCAmelCase = fa + ...
39
from __future__ import annotations def lowerCamelCase__ ( A__ : list[int] , A__ : list[int] , A__ : list[int] , A__ : list[list[str]] , A__ : int , ): '''simple docstring''' __lowerCamelCase = len(A__ ...
12
0
"""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, b...
24
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: SCREAMING_SNAKE_CASE : Tuple = None try: import msvcrt except ImportError: SCREAMING_SNAKE_CASE : List[str] = None try: import fcntl except ImportError: SC...
24
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM @re...
14
_lowerCamelCase : Optional[int] = 65521 def SCREAMING_SNAKE_CASE ( lowercase_ ) -> int: """simple docstring""" A__ = 1 A__ = 0 for plain_chr in plain_text: A__ = (a + ord(lowercase_ )) % MOD_A...
14
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer lowercase : Union[str, Any] = {'''vocab_file''': '''vocab....
350
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase : List[Any] = { 'configuration_pix2struct': [ 'PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Pix2StructConfig', 'Pix2S...
151
0
def __lowerCamelCase ( lowerCamelCase__ , lowerCamelCase__ ): """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: raise ValueError("Cash flows list cannot be empty" ) lowercase__ : ...
130
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __lowerCamelCase ( ): """simple docstring""" lowercase__ : Dict = ArgumentParser( description=( ...
130
1
"""simple docstring""" import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_STA...
244
"""simple docstring""" from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record lowerCAmelCase__ = '''\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
244
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
28
"""simple docstring""" import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import TokenizerTesterMixi...
290
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowercase__ ( lowercase ): @staticmethod @abstractmethod def UpperCamelCase_ ( lowerCamelCase__ : ArgumentParser ): '''simple docstring''' raise NotImplementedError() ...
369
'''simple docstring''' from __future__ import annotations def A__ ( UpperCAmelCase_ ): if not nums: return 0 _UpperCamelCase : Any = nums[0] _UpperCamelCase : Optional[int] = 0 for num in nums[1:]: _UpperCamelCase , ...
236
0