code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from ...processing_utils import ProcessorMixin class a ( __lowerCamelCase ): __lowerCAmelCase : int = """WhisperFeatureExtractor""" __lowerCAmelCase : Optional[int] = """WhisperTokenizer""" def __init__( self :Dict ,__lowercase ...
230
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A__ = { '''configuration_ctrl''': ['''CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CTRLConfig'''], '''tokenization_ctrl''': ['''CTRLTokenizer'''], } ...
230
1
import math def UpperCAmelCase__ (UpperCamelCase_ ): """simple docstring""" snake_case = [True] * n snake_case = False snake_case = False snake_case = True for i in range(3 ,int(n**0.5 + 1 ) ,2 ): ...
213
from __future__ import annotations from scipy.special import comb # type: ignore class A__ : """simple docstring""" def __init__( self , __snake_case ): snake_case = list_of_points # Degree determines the flexibility of the curve. # De...
213
1
import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils....
103
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
0
'''simple docstring''' import argparse 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...
264
'''simple docstring''' def snake_case_ ( __SCREAMING_SNAKE_CASE : int , __SCREAMING_SNAKE_CASE : float , __SCREAMING_SNAKE_CASE : float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def snake_case_ ( ...
264
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import C...
230
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class a : def __init__( self : Union[str, Any] ): _UpperCAmelCase = {} def lowerCAmelCase_ ( self : Optional[int] , __lowerCAmelCase ...
289
0
'''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_schedule_with_warmup, set...
251
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from...
251
1
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_image_processi...
43
"""simple docstring""" def lowercase ( _SCREAMING_SNAKE_CASE : List[Any] ): '''simple docstring''' _UpperCAmelCase = len(_SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr _UpperCAmelCase = arr.index(m...
260
0
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef _SCREAMING_SNAKE_CASE = ( """This metric will be removed from the library soon, metrics shou...
364
from math import pi def lowercase( UpperCamelCase_ , UpperCamelCase_ ) -> float: '''simple docstring''' return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(9_0, 1_0))
165
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { 'YituTech/...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCAmelCase = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } try: if not is_torch_availa...
341
1
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transformers.convert_switch_t...
354
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _A : UpperCamelCase__ : int UpperCamelCase__ : TreeNode | None = None UpperCamelCase__ : TreeNode | None = None __snake_case :Optio...
131
0
'''simple docstring''' import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def UpperCamelCase_ ( _UpperCAmelCase : int = 3 ) -> qiskit.result.counts.Counts: """simple docstring""" if isins...
31
'''simple docstring''' import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transform...
31
1
"""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, rescale, resiz...
371
"""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 ( ...
253
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( a): '''simple docstring''' def __init__( self , *__lowerCamelCase , **__lowerCamelC...
11
import os import string import sys lowerCamelCase = 1 << 8 lowerCamelCase = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 27, '''up''': 65 + ARROW_KEY_FLAG, '''down''': 66 + ARROW_KEY_FLAG, '''right''': 67 + ARROW_KEY_FLAG, '''left''': ...
188
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=__snake_case ) class a__ ( __snake_case ): # `task` is not a ClassVar since we want it to be part of the `asdict` output f...
197
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class a__ ( __snake_case ): def __init__( self , UpperCAmelCase , UpperCAmelCase=None , UpperCA...
197
1
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_rembert import RemB...
210
import gc import threading import time import psutil import torch class _UpperCamelCase : """simple docstring""" def __init__( self ) -> str: '''simple docstring''' __lowercase = psutil.Process() __lowercase = False def _...
210
1
"""simple docstring""" 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 _lowerCAmelCase : Any = logging.getL...
202
"""simple docstring""" 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 .....
202
1
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __snake_case ( a ): def __init__( self : ...
51
from string import ascii_lowercase, ascii_uppercase def a__ ( _UpperCamelCase : str ): if not sentence: return "" __lowerCamelCase = dict(zip(_UpperCamelCase ,_UpperCamelCase ) ) return lower_to_upper.get(sentence[0] ,sentence[0] ) +...
330
0
"""simple docstring""" import string import numpy def a__ ( lowerCAmelCase__ , lowerCAmelCase__ ): return b if a == 0 else greatest_common_divisor(b % a , lowerCAmelCase__ ) class lowercase__ : '''simple docstring''' ...
241
"""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
1
'''simple docstring''' import math import unittest def lowercase__( __UpperCamelCase: int ): """simple docstring""" assert isinstance(__UpperCamelCase ,__UpperCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" ...
251
'''simple docstring''' import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCamelCase_ = argparse.ArgumentParser( description=( "Extraction some layers of the full BertForMaskedLM or RObertaForMaske...
251
1
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import...
354
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase_ : Tuple = WebClient(token=os.environ['CI_SLACK_BOT_TOKEN']) def _l...
346
0
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments ...
187
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class lowerCAmelCase__ : def __init__( self : Any , SCREAMING_SNAKE_CASE__ : List[str] , SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : int ) -> Dict: ...
270
0
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make...
356
"""simple docstring""" def UpperCAmelCase__ ( lowerCAmelCase__ :int ) -> bool: '''simple docstring''' lowercase = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(2_7)) print(perfect_cub...
32
0
"""simple docstring""" def lowerCAmelCase ( __UpperCamelCase ): """simple docstring""" assert ( isinstance(lowerCamelCase__ , lowerCamelCase__ ) and number_of_steps > 0 ), f'number_of_steps needs to be positive integer, your input {number_of_steps}' if number_of_steps...
266
'''simple docstring''' import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import Nest...
206
0
'''simple docstring''' 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_attenti...
360
'''simple docstring''' from __future__ import annotations def __magic_name__ ( A ) -> None: create_state_space_tree(A , [] , 0 , [0 for i in range(len(A ) )] ) def __magic_name__ ( A , A , A , A , ) -> None: if index ...
332
0
'''simple docstring''' from math import factorial A_ : dict[str, int] = {str(digit): factorial(digit) for digit in range(1_0)} def snake_case_ ( lowerCAmelCase_ )-> int: '''simple docstring''' if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): ...
215
'''simple docstring''' from __future__ import annotations import queue class lowercase : """simple docstring""" def __init__( self ,a_ ) -> str: _UpperCAmelCase : Optional[Any] = data _UpperCAmelCase : Optional[int] = None ...
215
1
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__ = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for Indian...
87
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/config.json", "xlnet-large-cased": "https://huggingfac...
87
1
"""simple docstring""" from collections.abc import Callable import numpy as np def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ) -> np.ndarray: lowercase__ ...
16
"""simple docstring""" import string def lowerCamelCase__ ( _lowerCamelCase : str ) -> None: for key in range(len(string.ascii_uppercase ) ): lowerCamelCase_ = '' for symbol in message: if symbol in string.ascii_upp...
183
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer lowerCAmelCase__ =logging.get_logger(__name__) low...
366
def a__ ( A__ ): SCREAMING_SNAKE_CASE_ : int = [] SCREAMING_SNAKE_CASE_ : int = [] SCREAMING_SNAKE_CASE_ : Optional[int] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Prio...
162
0
'''simple docstring''' def snake_case__ ( ) -> int: '''simple docstring''' return 1 def snake_case__ ( _A: int ) -> int: '''simple docstring''' return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def snake_case__ ( _A: int ) -> int: ...
272
'''simple docstring''' import os import string import sys __lowercase = 1 << 8 __lowercase = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 2_7, '''up''': 6_5 + ARROW_KEY_FLAG, '''down''': 6_6 + ARROW_KEY_FLAG, '''right''': 6_7 + ARROW_KEY_FLAG, ...
272
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): if density <= 0: raise ValueError("""Impossible fluid density""" ) if bulk_modulus <= 0: raise ValueError("""Impossible bulk modulus""" ) return (bulk_modulus / density) ** 0.5...
283
'''simple docstring''' import numpy class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase): UpperCAmelCase__ : Dict = input_array # Random initial weights are assigned where first argument is t...
283
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalDetrForSegmentation, ...
270
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ : List[Any] = { "configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "ResNetConf...
270
1
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available f...
361
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __a ( snake_case__ ): """simple docstring""" SCREAMING_SNAKE_CASE_ = ['image_processor', 'tokenizer'] SCREAMING_SNAKE_CASE_ ...
157
0
def _A ( _lowercase ) -> bool: """simple docstring""" __UpperCamelCase = set() # To detect a back edge, keep track of vertices currently in the recursion stack __UpperCamelCase = set() return any( node not in visited a...
310
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_mul...
310
1
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowerCamelCase_ ( _a ): """simple docstring""" def wrapper(*_a , **_a ): lowerCAmelCase__ : ...
211
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ......
211
1
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _snake_case : SCREAMING_SNAKE_CASE__ = None SCREAMING_SNAKE_CASE__ = False SCREAMING_SNAKE_CASE__ = False SCREAMING_SNAKE_CASE__ = ...
94
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Dict = logging.get_logger(__name__) UpperCAmelCase_ : Union[str, Any] = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', ...
32
0
import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_av...
369
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
35
0
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : str , _lowerCamelCase : list[str] | None = None , _lowerCamelCase : dict[str, float] | None = None , _lowerCamelCase : bool = False , ) -> int: '''simple docstring...
232
"""simple docstring""" from __future__ import annotations def lowercase__ ( snake_case_ :list[float] , snake_case_ :list[float] ): __UpperCAmelCase = sorted(numsa + numsa ) __UpperCAmelCase , __UpperCAmelCase = divmod(len(snake_case_ )...
332
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor...
244
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
244
1
UpperCamelCase = [ (1000, '''M'''), (900, '''CM'''), (500, '''D'''), (400, '''CD'''), (100, '''C'''), (90, '''XC'''), (50, '''L'''), (40, '''XL'''), (10, '''X'''), (9, '''IX'''), (5, '''V'''), (4, '''IV'''), (1, '''I'''), ] def lowerca...
87
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class a (metaclass=UpperCamelCase__ ): """simple docstring""" __UpperCAmelCase : Optional[int] = ["""speech"""] def __init__( self : Tuple , *lowerCamelCase : Optional[Any] ...
368
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, 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 l...
134
0
"""simple docstring""" from __future__ import annotations from functools import lru_cache from math import ceil lowerCAmelCase__ = 100 lowerCAmelCase__ = set(range(3, NUM_PRIMES, 2)) primes.add(2) lowerCAmelCase__ = 42 for prime in range(3, ceil(NUM_PRIMES**0.5), 2): ...
108
"""simple docstring""" class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ = "" , snake_case__ = False ): """simple docstring""" lowerCAmelCase : dict[str, RadixNode] = {} ...
108
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def __lowercase ( _Up...
369
def __lowercase ( _UpperCamelCase = 50 ) ->int: """simple docstring""" lowercase : str = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2, 5 ): for...
173
0
def lowercase_( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' for i in range(len(SCREAMING_SNAKE_CASE_ ) - 1 , 0 , -1 ): lowerCamelCase : Tuple = False for j in range(SCREAMING_SNAKE_CASE_ , 0 , -1 ): if unsorted[j] < unsorted[j...
283
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) fro...
283
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) __magic_name__: Dict = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BeitConfig""", ""...
352
__magic_name__: List[Any] = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" __magic_name__: Dict = [{"type": "code", "content": INSTALL_CONTENT}...
138
0
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWit...
33
def a__ ( _UpperCamelCase : int ): __lowerCamelCase = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
330
0
"""simple docstring""" from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def __lowerCAmelCase (_UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): if not arr: return None, None, 0 if low == high: ...
182
"""simple docstring""" # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_t...
182
1
def a_ ( _A ) -> Optional[Any]: """simple docstring""" if len(_A ) < 2: return collection def circle_sort_util(_A , _A , _A ) -> bool: snake_case__ = False if low == high: ...
307
from ..utils import DummyObject, requires_backends class _a ( metaclass=UpperCamelCase__ ): _lowercase : Any = ['''torch''', '''scipy'''] def __init__( self: int , *UpperCamelCase_: Any , **UpperCamelCase_: Optional[Any] ) -> List[st...
110
0
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = [ ['attention...
81
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A : int ={ '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''Mvp...
41
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_available(): ...
35
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggin...
354
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...
235
0
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient a_ = WebClient(token=os.environ['CI_SLACK_BOT_TOKEN']) def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : A...
76
"""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/LICENS...
221
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule _SCREAMING_SNAKE_CASE : Tuple = {"""processing_wav2vec2_with_lm""": ["""Wav2Vec2ProcessorWithLM"""]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys _SC...
358
"""simple docstring""" from __future__ import annotations import unittest from transformers import RoFormerConfig, 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...
157
0
"""simple docstring""" import unittest import numpy as np from datasets import load_dataset 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 ImageProcess...
81
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Optional[Any] = {'con...
134
0
from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class UpperCamelCase__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : Tuple = 'openai/whisper-base' _SCREAMING_SNAKE_CASE : Optional[Any] = ( 'This is a too...
368
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart impor...
90
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) class __A( a ): snake_case_ = '''encoder-decoder''' snake_case_ = True def __init__( self , **_snake_case ) -> ...
6
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProc...
296
0
"""simple docstring""" from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrin...
359
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
0
"""simple docstring""" import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging __a = logging.get_logger(__name__) __a = r"\n Args:\n input_ids (`torch.LongTensor` of shape `(b...
66
"""simple docstring""" import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE_ = get_...
301
0
'''simple docstring''' import numpy as np def lowerCamelCase__ ( A : np.array ): '''simple docstring''' return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
367
'''simple docstring''' import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax import ji...
91
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, ...
40
'''simple docstring''' _snake_case = 8.3_1_4_4_5_9_8 def _A ( snake_case , snake_case ) -> float: if temperature < 0: raise Exception("Temperature cannot be less than 0 K" ) if molar_mass <= 0: raise Exception("Molar mass cannot be less than or equal to 0 kg/mol" ...
250
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor __UpperCamelCase : List[str] = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE ( a_ ): """simple docstring""" def __init__( self ...
74
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' whe...
74
1
"""simple docstring""" lowerCamelCase_ : int = """ # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install gi...
81
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : Any = logging.get_...
81
1
"""simple docstring""" import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, B...
314
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class snake_case_( a__ ): __UpperCamelCase = (DDPMScheduler,) def lowerCamelCase__ ( self : List[Any] , **UpperCamelCase_ :...
314
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig lowerCamelCase_ = { '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/config.json''', ''...
79
from math import ceil def __UpperCAmelCase ( __a : int = 1_001 ) -> int: """simple docstring""" _a : List[Any] = 1 for i in range(1 ,int(ceil(n / 2.0 ) ) ): _a : Optional[Any] = 2 * i + 1 _a : Optional[int] = 2...
235
0
import copy import re class snake_case_ : UpperCAmelCase__ : Union[str, Any] = 'hp' UpperCAmelCase__ : Any = {} UpperCAmelCase__ : List[str] = None @classmethod def lowerCamelCase__( cls :Dict ,__snake_case :Dict ...
359
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import *
109
0
def __lowercase ( __lowerCAmelCase : str ): return credit_card_number.startswith(('34', '35', '37', '4', '5', '6') ) def __lowercase ( __lowerCAmelCase : str ): a__ = credit_card_number a__ = 0 a__ ...
240
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer snake_case : Dict = logging.get_logger(__name__) sn...
240
1
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , __a , __a ): if depth < 0: raise ValueError('Depth cannot be less than 0' ) if not scores: raise ValueError('Scores cannot be empty' ) if de...
364
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
0
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_availab...
331
'''simple docstring''' def lowerCamelCase ( ): """simple docstring""" return 1 def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def lowerCamelCase ( lowerCAmelCase : int ): """s...
331
1
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __A : Union[str, Any] = HfArgumentParser(InitializationArguments) __A : Any = parser.pars...
369
"""simple docstring""" import logging import os from .state import PartialState class _a ( logging.LoggerAdapter): """simple docstring""" @staticmethod def lowercase__ ( __UpperCamelCase : Optional[Any] )->List[Any]: _UpperCAmelCase = ...
326
0
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import i...
117
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
0
class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase , _lowerCamelCase ): UpperCamelCase_: List[str] = name UpperCamelCase_: str = val def __str__( self ...
369
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.array: UpperCamelCase_: Dict = F'''{sampling_rate}''' UpperCamelCase_: Any = '1' UpperC...
292
0
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation ...
54
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) UpperCAmelCase_ : Dict = logging.getLogger(__name__)...
91
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase : Any = { """configuration_blip""": [ """BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
357
def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> int: def count_of_possible_combinations(SCREAMING_SNAKE_CASE__ ) -> int: if target < 0: return 0 if target == 0: return 1...
285
0
"""simple docstring""" import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import A...
74
"""simple docstring""" import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() _lowercase = logging.get_logger(__name_...
74
1
from numpy import exp, pi, sqrt def UpperCAmelCase ( a_ , a_ = 0.0 , a_ = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": import doctest doctes...
124
import argparse import os import re import packaging.version SCREAMING_SNAKE_CASE :int = 'examples/' SCREAMING_SNAKE_CASE :str = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R'^__vers...
124
1
'''simple docstring''' from statistics import mean import numpy as np def A_ ( snake_case , snake_case , snake_case , snake_case ): SCREAMING_SNAKE_CASE:List[Any] = 0 # Number of processes finished SCREAMING_SNAKE_CASE:Dict = 0 ...
139
'''simple docstring''' from __future__ import annotations def A_ ( snake_case , snake_case , snake_case , ): if (stress, tangential_force, area).count(0 ) != 1: raise ValueError("You cannot supply more or less than 2 values" ) elif stress < 0...
139
1
'''simple docstring''' 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 ...tes...
371
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
0
from math import factorial snake_case_ = {str(d): factorial(d) for d in range(10)} def lowerCamelCase__ ( snake_case_ : int ) -> int: return sum(DIGIT_FACTORIAL[d] for d in str(snake_case_ ) ) def lowerCamelCase__ ( ) ->...
24
"""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
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableU...
71
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowercase: List[Any] = { "tiny.en": "https://openaipublic.azureedge.net/main/whisper/models/d3dd...
71
1
from typing import Dict, Iterable, 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_c...
117
from __future__ import annotations def _a ( lowerCamelCase: list[float] , lowerCamelCase: Tuple ) -> List[str]: '''simple docstring''' print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(lowerCamelCase ): ...
117
1
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer SCRE...
124
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE :int = {'configuration_encoder_decoder': ['EncoderDecoderConfig']} try: if not is_torch_avai...
124
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _a : Optional[Any]= { "configuration_m2m_100": ["M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP", "M2M100Config", "M2M100OnnxCo...
172
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ ...
104
0
"""simple docstring""" import qiskit def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int ) -> qiskit.result.counts.Counts: '''simple docstring''' __lowerCamelCase : Any = qiskit.Aer.get_backend("aer_simulator" ) # Create a Quantum Circuit a...
64
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> str | Literal[False]: '''simple docstring''' __lowerCamelCase : Optional[int] ...
64
1
"""simple docstring""" import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pi...
224
"""simple docstring""" from math import isqrt, loga def A__ ( UpperCamelCase ): A = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , UpperCamelCase , UpperC...
292
0
"""simple docstring""" from __future__ import annotations def __lowercase ( snake_case_ : list[int] ,snake_case_ : int ) ->list[list[int]]: '''simple docstring''' __A : list[list[int]] = [] __A : list[int] = [] ...
291
"""simple docstring""" from decimal import Decimal, getcontext from math import ceil, factorial def __lowercase ( snake_case_ : int ) ->str: '''simple docstring''' if not isinstance(snake_case_ ,snake_case_ ): raise TypeError('''Undefined for no...
291
1
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ ) -> list[int]: '''simple docstring''' UpperCAmelCase = 2 UpperCAmelCase = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append...
273
from datetime import datetime import requests def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ ) -> bytes: '''simple docstring''' UpperCAmelCase = '''https://downloadgram.net/wp-json/wppress/video-downloader/video?url=''' UpperCAmelCase = requests.get(base_url + url...
273
1
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, re...
135
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase :Dict = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvail...
135
1
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __magic_name__ ( A : List[Any], A : Tuple, A : int, A : List[str] ): ''...
107
"""simple docstring""" # 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 ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.p...
261
0
"""simple docstring""" import os def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase = "input.txt" ): with open(os.path.join(os.path.dirname(__UpperCAmelCase ) , __UpperCAmelCase ) ) as input_file: _lowercase : Dict = [ [int(__UpperCAmelCase ) f...
336
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () UpperCAmelCase: Optional[Any] = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defin...
336
1
"""simple docstring""" import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def A_ ( _lowercase ): '''simple docstring''' snake_case_ :Optional[int] = FileLock(str(tmpdir / """foo.lock""" ) ) snake_case_ :Tuple = FileLock(str(tmpd...
66
from ..utils import DummyObject, requires_backends class _lowercase ( metaclass=A__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = ['''keras_nlp'''] def __init__( self :Tuple , *lowerCAmelCase__ :Optional[Any] , **lowerCAmelC...
9
0
"""simple docstring""" def _lowerCAmelCase ( ) ->List[Any]: for n in range(1, 1_0_0_0_0_0_0 ): yield n * (n + 1) // 2 def _lowerCAmelCase ( UpperCAmelCase__ : List[Any] ) ->str: A__ : Union[str, Any] = 1 A...
296
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
296
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ :List[str] = { '''configuration_clap''': [ '''CLAP_PRETRAINED_MODEL_ARCHIVE_LIST''', '''ClapAudioConfig''', '''ClapConfig''', ...
71
import random from .binary_exp_mod import bin_exp_mod def A ( a_ ,a_=1_000 ) -> Optional[Any]: if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __UpperCamelCase : List[An...
71
1
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_available...
368
"""simple docstring""" SCREAMING_SNAKE_CASE__:Any = { """A""": """.-""", """B""": """-...""", """C""": """-.-.""", """D""": """-..""", """E""": """.""", """F""": """..-.""", """G""": """--.""", """H""": """....""", """I""": """..""", """J""": """.---""", """K""": """-.-""", """L""": """.-..""", """M""": ""...
268
0
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=1024 , lowerCAmelCa...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowerCAmelCase = {'''configuration_swin''': ['''SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SwinConfig''', '''SwinOnnxConfig''']} try: ...
89
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar _lowerCAmelCase : Union[str, Any] = TypeVar("T") _lowerCAmelCase : Tuple = TypeVar("U") class UpperCAmelCase_ ( Generic[T, U] ): ...
202
"""simple docstring""" from __future__ import annotations from typing import Any def __snake_case ( SCREAMING_SNAKE_CASE__ : list[Any] ) -> None: '''simple docstring''' create_state_space_tree(SCREAMING_SNAKE_CASE__ , [] , 0 ) def __snake_...
202
1
"""simple docstring""" A_ = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def UpperCAmelCase__ (snake_case__ : Dict , snake_case__ : int , s...
64
"""simple docstring""" import argparse import hashlib # hashlib is only used inside the Test class import struct class lowercase: '''simple docstring''' def __init__( self: List[Any], a_: List[str] ): '''simple docstring''' ...
64
1
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], [...
361
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_common i...
200
0
from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class a__ ( UpperCAmelCase ): """sim...
245
# 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 # # Unless requ...
245
1
"""simple docstring""" import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class __lowerCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCamelCase ( self : int...
360
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available ...
161
0
from math import pi, sqrt def __snake_case ( _UpperCAmelCase ): if num <= 0: raise ValueError('''math domain error''' ) if num > 1_71.5: raise OverflowError('''math range error''' ) elif num - int(_UpperCAmelCase ) not in (0, 0.5): raise NotImplementedErro...
49
def a_ ( _A = 1000 ) -> int: """simple docstring""" return sum(e for e in range(3 , _A ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f'''{solution() = }''')
307
0
"""simple docstring""" from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def a__ ( snake_case__ = True , *snake_case__ , **snake_case__ ) -> str: if not is_tqdm_available(): raise Imp...
351
"""simple docstring""" import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, Rober...
168
0