code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
def __lowerCAmelCase ( a__ = 1000 ) -> int: return sum(e for e in range(3 , a__ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
# 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 required by app...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_toke...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', 'JukeboxVQVAEConfig', ...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
import re def __lowerCAmelCase ( a__ ) -> Optional[Any]: __a = re.compile( R'''^(?:0|94|\+94|0{2}94)''' R'''7(0|1|2|4|5|6|7|8)''' R'''(-| |)''' R'''\d{7}$''' ) return bool(re.search(lowerCamelCase__ , lowerCamelCase__ ) ) if __name__ == "__main__": ...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
import numpy as np def __lowerCAmelCase ( a__ ) -> np.array: return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
def __lowerCAmelCase ( a__ , a__ ): return int((input_a, input_a).count(1 ) != 0 ) def __lowerCAmelCase ( ): assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1 , 0 ) == 1 assert or_gate(1 , 1 ) == 1 if __n...
351
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
0
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast A : Optional[int] = datasets.utils.logging.get_logger(__name__) @dataclass class __A( datase...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
from math import pi, sqrt def __lowerCAmelCase ( a__ ) -> float: if num <= 0: raise ValueError('''math domain error''' ) if num > 171.5: raise OverflowError('''math range error''' ) elif num - int(_lowerCAmelCase ) not in (0, 0.5): raise NotImplementedError('''nu...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import ...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
from __future__ import annotations from random import random class __A: """simple docstring""" def __init__( self , _snake_case = None ) -> Dict: '''simple docstring''' __a = value __a = random() __a ...
355
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_multi_gpu from ac...
33
0
def __lowerCAmelCase ( a__ ) -> int: __a = hex_num.strip() if not hex_num: raise ValueError('''No value was passed to the function''' ) __a = hex_num[0] == '''-''' if is_negative: __a = hex_num[1:] try: __a ...
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class __A( unittest.TestCase ): ...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
def __lowerCAmelCase ( a__ ) -> Any: """simple docstring""" if a < 0: raise ValueError('''Input value must be a positive integer''' ) elif isinstance(_lowercase , _lowercase ): raise TypeError('''Input value must be a \'int\' type''' ) return bin(_lowe...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
0
def __lowerCAmelCase ( a__ , a__ ) -> Optional[Any]: return int((input_a, input_a).count(1 ) != 0 ) def __lowerCAmelCase ( ) -> Tuple: assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1 , 0 ) == 1 assert or_gate(1...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
def __lowerCAmelCase ( a__ ) -> Any: try: __a = float(_a ) except ValueError: raise ValueError('''Please enter a valid number''' ) __a = decimal - int(_a ) if fractional_part == 0: return int(_a ), 1 else: __a ...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTest...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class __A( a__ ): snake_case_ = """Speech2TextFeatureExtractor""" snake_case_ = """Speech2TextTokenizer""" def __init__( self , _snake_case , ...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets A : Dict = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav Kadavath and Akul Arora ...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_config...
364
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING A : List[Any] = logging.get_logger(__name__) A : ...
33
0
def __lowerCAmelCase ( a__ , a__ , a__ ) -> Union[str, Any]: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(lowerCAmelCase__ ) ) def __lowerCAmelCase ( a__ , a__ , a__ , a__ ) -> int:...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
0
"""simple docstring""" 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....
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
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_device from transformers.ut...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
import math import sys def __lowerCAmelCase ( a__ ) -> str: if number != int(__UpperCamelCase ): raise ValueError('''the value of input must be a natural number''' ) if number < 0: raise ValueError('''the value of input must not be a negative number''' ) if number == 0...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
def __lowerCAmelCase ( a__ ) -> Any: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') A : Union[str, Any] = int(input('Enter nu...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def __lowerCAmelCase ( a__ , a__ , a__ ) -> Any: __a = BertConfig.from_json_file(a__ ) ...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
A : Dict = '\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' A : Optional[int] = [{'type': 'code', 'content': INSTALL_CONTENT}] A : ...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = set() # edges = list of graph's edges __a = get_edges(A__ ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) and add his extremity to chosen_vertices and th...
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
import os import sys import unittest A : Optional[int] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_mapping, ...
351
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
0
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset A : Optional[Any] = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (3, 2), ...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedKVPro...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : str = logging.get_logger(__name__) A : List[str] = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-t...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
A : Union[str, Any] = 'Input must be a string of 8 numbers plus letter' A : int = 'TRWAGMYFPDXBNJZSQVHLCKE' def __lowerCAmelCase ( a__ ) -> str: if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): __a = F"""Expected string as ...
355
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_multi_gpu from ac...
33
0
def __lowerCAmelCase ( a__ , a__ ) -> int: __a = [1] for i in range(2 , UpperCAmelCase_ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" __a = [] __a = list(range(UpperCA...
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0
"""simple docstring""" import random def __lowerCAmelCase ( a__ , a__ , a__ = False ) -> Optional[int]: __a = {i: [] for i in range(_A )} # if probability is greater or equal than 1, then generate a complete graph if probability >= 1: return comple...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
0
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_available(): from tran...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : int = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_available(): raise Optional...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import D...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __A( _snake_case ): def SCREAMING_SNAKE_CASE_ ( self , _snake_case ) -> float: '''simple docstring''' ret...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) A : str = '▁' A : Optional...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class __A( unittest.TestCase ): snake_case_ = JukeboxTokenizer snake_case_ = { "artist": "Zac Brown Band", "genres": "Country", ...
364
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING A : List[Any] = logging.get_logger(__name__) A : ...
33
0
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 ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
0
"""simple docstring""" from __future__ import annotations A : List[Any] = 'Muhammad Umer Farooq' A : Any = 'MIT' A : Any = '1.0.0' A : Optional[Any] = 'Muhammad Umer Farooq' A : str = 'contact@muhammadumerfarooq.me' A ...
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
0
import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor A : List[Any] = logging.get_logger(__name__) class __A( UpperCamelCase__ ): def __init__( self , *_snake_case , **_snake_case ) ->...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from ....
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
from ..utils import DummyObject, requires_backends class __A( metaclass=__snake_case ): snake_case_ = ["""transformers""", """torch""", """note_seq"""] def __init__( self , *_snake_case , **_snake_case ) -> Dict: '''simple docstring''' ...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
def __lowerCAmelCase ( a__ ) -> Tuple: if num <= 0: raise ValueError('''Input must be a positive integer''' ) __a = [True] * (num + 1) __a = 2 while p * p <= num: if primes[p]: for i in range(p * p , num + 1 , __lo...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
class __A: def __init__( self , _snake_case = "" , _snake_case = False ) -> None: '''simple docstring''' __a = {} # A node will be a leaf if the tree contains its word __a = is_leaf __a = ...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
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 __A( datasets.BuilderConfig ): snake_case_ = None class __A( datasets.Arr...
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cac...
351
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
0
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
def __lowerCAmelCase ( a__ ) -> int: if n == 1 or not isinstance(a__ , a__ ): return 0 elif n == 2: return 1 else: __a = [0, 1] for i in range(2 , n + 1 ): sequence.append(sequence[i - 1] + sequence[i - 2] ) ...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_t...
355
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_multi_gpu from ac...
33
0
from __future__ import annotations def __lowerCAmelCase ( a__ ) -> list[int]: __a = [True] * limit __a = False __a = False __a = True for i in range(3 , int(limit**0.5 + 1 ) , 2 ): __a = ...
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0
"""simple docstring""" import pytest import datasets # Import fixture modules as plugins A : Dict = ['tests.fixtures.files', 'tests.fixtures.hub', 'tests.fixtures.fsspec'] def __lowerCAmelCase ( a__ , a__ ) -> List[str]: # Mark tests as "unit" by default if not mar...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
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_video_inputs if is_torch_available(): import torch...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
0
from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : List[Any] = { 'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingface/autoformer-tourism-mon...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class __A( a ): snake_case_ = ...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( '''kwargs, expected''' , [ ({'''num_shards''': 0, '''max_num_jobs''': 1}, []), ({'''num_shards''': 10, '''max_num_j...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def __lowerCAmelCase ( a__ , a__ , a__ = None ) -> str: if version.parse(hfh.__version__ ).release < version.parse('''0.11.0''' ).release: # old versions ...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ , a__ ) -> float: if days_between_payments <= 0: raise ValueError('''days_between_payments must be > 0''' ) if daily_interest_rate < 0: raise ValueError('''daily_interest_rate must be >= 0''' ) ...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor from .....
364
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING A : List[Any] = logging.get_logger(__name__) A : ...
33
0
from ..utils import DummyObject, requires_backends class __A( metaclass=a ): snake_case_ = ['''transformers''', '''torch''', '''note_seq'''] def __init__( self , *_snake_case , **_snake_case ) -> Tuple: '''simple docstring''' req...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
0
"""simple docstring""" import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def __lowerCAmelCase ( a__ ) -> int: monkeypatch.setattr('''datasets.utils.deprecation_utils._emitted_deprecation_warnings''' , set() ) @pytest.fixture def __lowerC...
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
0
import collections import importlib.util import os import re from pathlib import Path A : Dict = 'src/transformers' # Matches is_xxx_available() A : int = re.compile(R'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} A : Optional[int] = ...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin A : Union[str, Any] = '\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at ...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_M...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
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.data import Dataset from transf...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoImageProcessor, ViTImageProcessor from transformers.testing_utils import TOKEN, USER, get_tes...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging A : int = logging.get_logger(__name__) A : Any = {'vocab_file': 'vocab.txt'} A : Lis...
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
from typing import Any class __A: def __init__( self , _snake_case ) -> Tuple: '''simple docstring''' __a = data __a = None def __repr__( self ) -> str: '''simple docstring''' retur...
351
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
0
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
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 ...u...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
from __future__ import annotations import bisect def __lowerCAmelCase ( a__ , a__ , a__ = 0 , a__ = -1 ) -> int: if hi < 0: __a = len(a__ ) while lo < hi: __a = lo + (hi - lo) // 2 if sorted_collection[mid] < item: ...
355
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_multi_gpu from ac...
33
0
def __lowerCAmelCase ( a__ ) -> bool: if number < 0: raise ValueError('''number must not be negative''' ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_ava...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : Optional[Any] = { 'YituTech/conv-bert-base': ...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
0
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __lowerCAmelCase ( a__ ) -> Union[str, Any]: __a = os.path.join(args.tf_model_dir , '''parameters.json''' ) __a = json.load...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" import torch from torch import nn class __A( nn.Module ): def __init__( self , _snake_case , _snake_case , _snake_case , _snake_case , _snake_case=1 , _snake_case=False ) -> str: '''simple docstring''' ...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ ) -> bool: if len(a__ ) == 0: return False __a = len(a__ ) // 2 if a_list[midpoint] == item: return True if item < a_list[midpoint]: return binary_search(a_list[:midpoint]...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : Optional[int] = {'configuration_deit': ['DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DeiTConfig', 'DeiTOnnxConfig']} ...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
def __lowerCAmelCase ( a__ , a__ ) -> int: return 1 if input_a == input_a else 0 def __lowerCAmelCase ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , 0 ) == 0 assert xnor_gate(1 , 1 )...
364
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING A : List[Any] = logging.get_logger(__name__) A : ...
33
0
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
0
"""simple docstring""" 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() de...
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
0
from __future__ import annotations import requests A : Optional[int] = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categories created...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor from ...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
import string from math import logaa def __lowerCAmelCase ( a__ , a__ ) -> int: __a = document.translate( str.maketrans('''''' , '''''' , string.punctuation ) ).replace('''\n''' , '''''' ) __a = document_without_punctuation.spl...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) A : Optional[int] = { 'configuration_trocr': ['TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TrOCRConf...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...image_pr...
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils import AudioPipelineOutput, B...
351
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
0
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property from ...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
from math import pow, sqrt def __lowerCAmelCase ( *a__ ) -> bool: __a = len(a__ ) > 0 and all(value > 0.0 for value in values ) return result def __lowerCAmelCase ( a__ , a__ ) -> float | ValueError: return ( round(sqrt(molar_mass_a / molar_m...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
from __future__ import annotations from collections.abc import Iterator class __A: """simple docstring""" def __init__( self , _snake_case ) -> None: '''simple docstring''' __a = value __a = None __a ...
355
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_multi_gpu from ac...
33
0
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/resolve/main/compression_sta...
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0