code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from __future__ import annotations def lowercase__( __SCREAMING_SNAKE_CASE : list[int] , __SCREAMING_SNAKE_CASE : int ): if len(__SCREAMING_SNAKE_CASE ) == 0: return False lowercase_ : Any = len(__SCREAMING_SNAKE_CASE ) // 2 ...
425
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput clas...
425
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtract...
717
"""simple docstring""" def A__ ( UpperCamelCase__ ): '''simple docstring''' _SCREAMING_SNAKE_CASE = int(UpperCamelCase__ ) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCamelCase__ ) _SCREAMING_SNAKE_CASE , ...
168
0
'''simple docstring''' import unittest import numpy as np def lowerCAmelCase_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ = None , ): '''simple docstring''' A : Tuple = np.shape(snake_case...
634
'''simple docstring''' from random import randint, random def lowerCAmelCase_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ = False , snake_case__ = False , snake_case__ = 5 , ): '''simple...
634
1
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __UpperCamelCase( _A : bytes , _A : int ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = F'''{sampling_rate}''' Up...
718
'''simple docstring''' import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ...
496
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowercase : List[str] = { """configuration_mvp""": ["""MVP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MvpConfig""", """MvpOnnxConfi...
210
'''simple docstring''' from __future__ import annotations import math _lowercase : Dict = """2020.9.26""" _lowercase : Any = """xcodz-dot, cclaus, dhruvmanila""" def lowerCamelCase__ ( A : float , A : float , A : float , A : float , A : float ): ...
210
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaV...
245
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils ...
245
1
def _lowerCAmelCase ( UpperCamelCase__: int = 50 ) -> int: """simple docstring""" A = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
641
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( __snake_case ): """simple docstring""" lowerCAmelCase = (IPNDMScheduler,) lowerCAmelCase = (('num_inference_steps', 5_0)...
641
1
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ...t...
710
import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() _lowerCAmelCase = logging.get_logger(__name__) de...
236
0
'''simple docstring''' from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_singl...
199
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE = {"""configuration_deit""": ["""DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """D...
199
1
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from ....
87
"""simple docstring""" import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impor...
87
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_config...
334
'''simple docstring''' import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() __A : int = logging.get_logger(__name__) __A : List[Any] = { 'post_extract_proj':...
334
1
'''simple docstring''' import gc import threading import time import psutil import torch class snake_case__ : def __init__( self : Tuple ) -> Optional[Any]: '''simple docstring''' __snake_case : str = psutil.Process() __snake_case :...
718
'''simple docstring''' import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_...
124
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { """microsoft/unispeech-sat-base-100h-libri-ft""": ( """https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/...
221
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a = False class SCREAMING_SNAKE_CASE__ ( unittest.Tes...
169
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING A__ = logging.get_logger(__name__) A__ = { '''sa...
219
import unittest from transformers import DonutProcessor A__ = '''naver-clova-ix/donut-base''' class a ( unittest.TestCase ): def __lowerCamelCase ( self :Optional[int] ): snake_case__ : str = DonutProcessor.from_pretrained(__lowercase )...
219
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowercase (__SCREAMING_SNAKE_CASE ): """simple docstring""" _UpperCAmelCase = ["""image_processor""", """tokenizer""...
101
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 UpperCAmelCase_...
423
0
from math import sqrt def A ( _UpperCAmelCase : Optional[int] ) -> bool: '''simple docstring''' assert isinstance(__snake_case , __snake_case ) and ( number >= 0 ), "'number' must been an int and positive" _UpperCAmelCase = True ...
712
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_xlnet impo...
639
0
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils impo...
143
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: '''simple docstring''' __SCREAMING_SNAKE_CASE = (boundary[1] - boundary[0]) / steps __SCREAMING_SNAKE_CASE = boundary[0] __SCREAMING_SNAKE_CASE ...
109
0
import operator def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase = False , UpperCAmelCase = None ): lowercase__ : Optional[int] = operator.lt if reverse else operator.gt lowercase__ : Optional[int] = solution or [] if not arr: return solution lowercas...
716
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compu...
428
0
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging _SCREAMING_SNAKE_CASE = "\\n\n" _SCREAMING_SNAKE_CASE = "\nPerplexity (PPL) is one of the most common metrics for evaluating la...
181
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { "RUCAIBox/mvp": "https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json", } class SCREAMING_SNAKE_CASE_ (...
181
1
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelF...
41
'''simple docstring''' import torch from diffusers import StableDiffusionPipeline lowercase = '''path-to-your-trained-model''' lowercase = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') lowercase = '''A ph...
41
1
def _UpperCamelCase ( snake_case__, snake_case__, snake_case__, snake_case__ ) -> int: __UpperCAmelCase , __UpperCAmelCase : Dict = len(snake_case__ ), len(grid[0] ) if ( min(snake_case__, snake_case__ ) < 0 or row == ro...
382
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _snake_case = '''src/transformers''' _snake_cas...
382
1
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def UpperCAmelCase ( lowercase , lowercase , lowercase = "x" , lowercase = 10**-10 , lowercase = 1 , ): """simple docstring""" __lowercase = ...
717
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 I...
522
0
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable UpperCAmelCase__ = { '''configuration_gpt_neox_japanese''': ['''GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXJapane...
186
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_ten...
186
1
"""simple docstring""" import heapq as hq import math from collections.abc import Iterator class A_: """simple docstring""" def __init__( self , A ): _lowerCamelCase : Optional[int] = str(id_ ) _lowerCamelCase : Tuple ...
703
"""simple docstring""" import numpy as np def UpperCAmelCase_ ( __a : np.array ): '''simple docstring''' return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
349
0
def a_ ( lowerCAmelCase_ : str ): return credit_card_number.startswith(('34', '35', '37', '4', '5', '6') ) def a_ ( lowerCAmelCase_ : str ): __lowerCAmelCase = credit_card_number __lowerCAmelCase = 0 __lowerCAmelCase ...
53
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_...
215
0
from __future__ import annotations class A_ : def __init__( self : Union[str, Any] , __SCREAMING_SNAKE_CASE : int ): __a = order # a_{0} ... a_{k} __a = [1.0] + [0.0] * order # b_{0} ... b_{k} __a = [1.0] + [0.0] * order # x[n-1] ... x...
525
import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class A_ ( a_ , a_ , ...
525
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.con...
82
def _A ( __snake_case :int = 400_0000 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = [] __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__snake_case ) __SCRE...
693
0
'''simple docstring''' import sys import turtle def _lowerCAmelCase ( __snake_case : tuple[float, float] , __snake_case : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def _lower...
338
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxMod...
338
1
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device UpperCAmelCase_ : Optional[int] = False class SCREAMING_SNAKE_C...
570
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAut...
570
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__ : Optional[Any] = logging.get_logger(__name__) UpperCamelCase__ : str = { "speechbrain/m-ctc-t-large": "https://huggingface.co/speechbrain/m-ctc-t...
715
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ) -> List[Any]: """simple docstring""" with offline(Offli...
0
0
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRContextEncoderTokenize...
12
import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def A__ ( ): SCREAMING_SNAKE_CASE__: U...
64
0
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, logging from .ben...
711
def _SCREAMING_SNAKE_CASE ( __snake_case ) -> list[int]: _UpperCAmelCase = [0 for i in range(len(__snake_case ) )] # initialize interval's left pointer and right pointer _UpperCAmelCase , _UpperCAmelCase = 0, 0 for i in range(1 , len(__sn...
402
0
"""simple docstring""" 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, torc...
337
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) class __magic_name__ ( lowerCAmelCase_ ): SCREAMING_SNAKE_CASE = 'encoder-decoder' SCREAMING...
242
0
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class UpperCAmelCase__ ( datasets.BeamBasedBuilder ): """simple docstring""" ...
709
'''simple docstring''' from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def UpperCAmelCase_ (__a : str = "isbn/0140328726" ): """simple docstring""" _a : Dict = olid.strip().strip('/' ) # Remove leading/tr...
319
0
"""simple docstring""" import cmath import math def a__ ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ) -> complex: UpperCAmelCase__ : str = math.radians(lowerCAmelCase ) UpperCAmelCase__ : Optional[int] = math.radians(...
182
"""simple docstring""" import requests def a__ ( lowerCAmelCase , lowerCAmelCase ) -> None: UpperCAmelCase__ : List[str] = {"""Content-Type""": """application/json"""} UpperCAmelCase__ : List[str] = requests.post(lowerCAmelCase , json={"""text"""...
182
1
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule,...
704
import argparse import torch from datasets import load_dataset from donut import DonutModel from transformers import ( DonutImageProcessor, DonutProcessor, DonutSwinConfig, DonutSwinModel, MBartConfig, MBartForCausalLM, VisionEncoderDecoderModel, XLMRobertaTok...
369
0
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_common import T...
20
"""simple docstring""" import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark i...
264
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_rembert impor...
701
from PIL import Image def _a ( lowerCamelCase__ , lowerCamelCase__ ) -> Image: def brightness(lowerCamelCase__ ) -> float: return 1_28 + level + (c - 1_28) if not -255.0 <= level <= 255.0: raise ValueError('level must be between -255.0 (black) and 255.0 (white)' ...
144
0
def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ = 0 , UpperCamelCase__ = 0 ) -> int: '''simple docstring''' UpperCAmelCase = right or len(lowerCAmelCase_ ) - 1 if left > right: return -1 ...
130
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def __a ( lowerCAmelCase_ : Namespace ) -> Optional[int]: '''simple docstring''' return ConvertCommand( args.model_type ,args.tf_checkpoint...
593
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase: int =logging.get_logger(__name__) _UpperCamelCase: str ={'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class __lowercase( SCREAMING_SNAKE_CASE ): """simp...
585
from __future__ import annotations import math class __lowercase: """simple docstring""" def __init__( self : str , _lowerCAmelCase : int ) -> None: _lowerCAmelCase = size # approximate the overall size of segment tree with given value ...
585
1
'''simple docstring''' from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_availabl...
523
'''simple docstring''' import numpy as np def UpperCamelCase__ ( _lowercase : np.array ) -> np.array: return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
523
1
import torch def _lowerCAmelCase ( ): if torch.cuda.is_available(): lowercase__ = torch.cuda.device_count() else: lowercase__ = 0 print(F'''Successfully ran on {num_gpus} GPUs''' ) if __name__ == "__main__": main()
700
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
0
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): """simple docstring""" _A : Tuple = (DDPMScheduler,) def lowerCamelCase(self , **lowerC...
180
"""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 cache...
180
1
'''simple docstring''' 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...
347
'''simple docstring''' import sys from collections import defaultdict class a_ : def __init__( self : Union[str, Any] ) -> Optional[int]: snake_case: Any =[] def UpperCamelCase ( self : List[str] , a_ : ...
347
1
"""simple docstring""" import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils impo...
552
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer lowercase_ = logging.get_...
552
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common imp...
352
'''simple docstring''' import numpy as np import qiskit def lowerCAmelCase (__A = 8 , __A = None): """simple docstring""" _a = np.random.default_rng(seed=__A) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. _...
352
1
import numpy as np import torch from ..models.clipseg import CLIPSegForImageSegmentation from ..utils import is_vision_available, requires_backends from .base import PipelineTool if is_vision_available(): from PIL import Image class __magic_name__ ( lowercase_ ): U...
628
'''simple docstring''' import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class...
379
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_convbert import ConvBertTokenizer a_ : List[str] = logging.get_logger(__name__) a_ : ...
710
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 f...
678
0
'''simple docstring''' from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder SCREAMING_SNAKE_CASE_ = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase ( ...
597
'''simple docstring''' def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): return abs(SCREAMING_SNAKE_CASE__ ) if a == 0 else greatest_common_divisor(b % a , SCREAMING_SNAKE_CASE__ ) def lowerCAmelCase__ ( SCREAMING_SNAKE_C...
597
1
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def lowercase ( ): import os as original_os from os import path as original_path from os import rename as original_rename from os.path import di...
704
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, sl...
141
0
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...
9
from __future__ import annotations from fractions import Fraction def A ( __UpperCamelCase , __UpperCamelCase ) -> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def A ( __UpperCamelCase ) -> list[str]:...
9
1
'''simple docstring''' def __snake_case (__UpperCAmelCase ): if not grid or not grid[0]: raise TypeError('''The grid does not contain the appropriate information''' ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] lowerCamelCase_ : ...
718
'''simple docstring''' def __snake_case (__UpperCAmelCase ): """simple docstring""" return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
418
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def lowerCAmelCase_ ( snake_c...
78
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table imp...
78
1
import numpy as np from PIL import Image def A_ ( lowercase_ , lowercase_ , lowercase_ ) ->np.ndarray: """simple docstring""" SCREAMING_SNAKE_CASE = np.array(lowercase_ ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
259
import argparse from collections import defaultdict import yaml __UpperCAmelCase = "docs/source/en/_toctree.yml" def A_ ( lowercase_ ) ->Optional[Any]: """simple docstring""" SCREAMING_SNAKE_CASE = defaultdict(lowercase_ ) for doc in model_doc: counts[doc["...
259
1
from bisect import bisect from itertools import accumulate def A__( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ): _snake_case : Any = sorted(zip(__lowerCAmelCase , __lowerCAmelCase ) , key=lambda __l...
304
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class lowercase ( a_ ): """simple ...
304
1
def A_( A , A ): _validate_point(A ) _validate_point(A ) if len(A ) != len(A ): raise ValueError("""Both points must be in the same n-dimensional space""" ) return float(sum(abs(a - b ) for a, b in zip(A , A ) ) ) def A_( A ): if point:...
486
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback,...
486
1
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class a__ : def __init__( self , _a , ...
361
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { """microsoft/wavlm-base""": """https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json""", # See all WavLM models at https://...
654
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_a...
702
def __lowercase ( UpperCAmelCase__ = 10 , UpperCAmelCase__ = 1_000 , UpperCAmelCase__ = True ): """simple docstring""" assert ( isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) ...
102
0
"""simple docstring""" 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 Model...
610
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteSche...
426
0
'''simple docstring''' import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, Wa...
537
'''simple docstring''' # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def _lowerCamelCase( UpperCamelCase__ : List[Any] , UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : List[Any] ) -> List[Any]: A : Any = { ...
537
1
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_...
6
'''simple docstring''' import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class __SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ): '''simple docstring''' lowerCAmelCase__ : Dict = (PNDMScheduler,) ...
125
0
lowerCAmelCase__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowerCamelCase_ ( UpperCAmelCase_ : float , UpperCAmelCase_ : float , UpperCAmelCase_ : float ) -> float: '''simple docstring''' if moles < 0 or kelvin < 0 or volume <...
702
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase__ = False class lowercase ( unittest.TestCase ): """simple docstring""" def...
648
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 ImageProcessingSavingTestMixin, pr...
698
"""simple docstring""" import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, ...
698
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfi...
98
'''simple docstring''' def _snake_case ( A ) -> int: return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def _snake_case ( A ) -> bool: lowerCAmelCase__ = 0 lowerCAmelCase__ = number while duplicate > 0: ...
98
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : List[Any] = { '''kssteven/ibert-roberta-base''':...
613
'''simple docstring''' import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup __snake_case : int = logging.get_logger(__name__...
660
0
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
711
"""simple docstring""" import logging import os import sys from pathlib import Path from unittest.mock import patch from parameterized import parameterized from run_eval import run_generate from run_eval_search import run_search from transformers.testing_utils import CaptureStdout, TestCasePlus, slow fr...
296
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : List[Any] = logging.get_logger(__name__) lowerCAmelCase_ : Optional[int] = { ...
527
'''simple docstring''' from __future__ import annotations def UpperCAmelCase ( A : list[int] , A : int ): if len(A ) < k or k < 0: raise ValueError('''Invalid Input''' ) SCREAMING_SNAKE_CASE : Dict = sum(array[:k] ...
527
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __SCREAMING_SNAKE_CASE = { """configuration_roc_bert""": ["""ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RoCBertConfig"""], """tokenization_...
700
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE = { """configuration_instructblip""": [ """INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """InstructBlipConfig""", """I...
17
0
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transfo...
97
"""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 UpperCAme...
420
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __UpperCAmelCase = { "configuration_perceiver": ["PERCEIVER_PRETRAINED_CONFIG_A...
709
'''simple docstring''' import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithNoAtt...
692
0
from math import ceil, sqrt def lowerCamelCase__ ( _a = 1000000): SCREAMING_SNAKE_CASE : List[Any] = 0 for outer_width in range(3 , (limit // 4) + 2): if outer_width**2 > limit: SCREAMING_SNAKE_CASE : str = max(ceil(sqrt(outer_width**2 - limit)) , 1) e...
25
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ...
527
0
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ......
662
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset from...
662
1
from __future__ import annotations from collections.abc import Iterator class _a : def __init__( self: Union[str, Any] , UpperCamelCase_: int ) -> None: """simple docstring""" lowercase__ = value lowercase...
43
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _A ( _lowercase , unittest.TestCase ): ...
402
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_available(): ...
604
import heapq import sys import numpy as np _lowerCAmelCase : str = tuple[int, int] class __snake_case : def __init__( self ): """simple docstring""" lowerCAmelCase__ = [] lowerCAmelCase__ = set() def SCREAMING_SNAKE_CASE_ ( ...
604
1
UpperCamelCase__ : Optional[Any] = 0 # The first color of the flag. UpperCamelCase__ : Dict = 1 # The second color of the flag. UpperCamelCase__ : int = 2 # The third color of the flag. UpperCamelCase__ : Tuple = (red, white, blue) ...
387
import os import pytest from attr import dataclass _a : int = 'us-east-1' # defaults region @dataclass class UpperCamelCase_ : """simple docstring""" A = 42 A = '''arn:aws:iam::558105141721:role/sagemaker_execution_role''' A = { '...
479
0
'''simple docstring''' from __future__ import annotations def A__ ( A : str , A : str): '''simple docstring''' UpperCamelCase : List[Any] = get_failure_array(A) # 2) Step through text searching for pattern UpperCamelCase : Any = 0...
720
'''simple docstring''' import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state ...
435
0
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration _UpperCAmelCase = [ # tf -> hf ("""/""", """."""), ("""layer_""", """layers."""), ("""k...
558
import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_avail...
61
0
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def __UpperCAmelCase ( _UpperCAmelCase : Union[str, Any] ) -> List[str]: __snake_case = FileLock(str(tmpdir / "foo.lock" ) ) __snake_case = FileLock(s...
680
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : List[Any] = { ...
680
1
import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAM...
519
def _UpperCAmelCase ( UpperCAmelCase : int = 600_851_475_143 ): """simple docstring""" try: __lowerCamelCase : Any = int(UpperCAmelCase ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable...
519
1
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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMas...
704
from __future__ import annotations import numpy as np def lowercase_( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' lowerCamelCase , lowerCamelCase : Dict = np.shape(SCREAMING_SNAKE_CASE_ ) if rows != columns: lowerCamelCase : int ...
231
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_distilbert import DistilBertTokenizer a_ :Tuple = logging.get_logger(__name__) a_ :int = {'vo...
35
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, infer_sha...
230
0
from __future__ import annotations def __lowerCAmelCase ( __magic_name__ , __magic_name__ , __magic_name__ ): 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" ) i...
703
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Optional[int] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : str = { 'google/canine-s': 'https://huggingface.co/google/canine-s/resolve/main/config.json', # See ...
206
0
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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltFo...
639
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging UpperCamelCase_ = logging.get_logger(__name__) def _lowerCAmelCase ( __magic_name__ : List[str]...
92
0
from collections.abc import Sequence def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(UpperCamelCase__ ) ) def __lowerCamelCase ( UpperCamelCase__ , Uppe...
108
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING _UpperCAmelCase : Dict = logging.get_logger(__name__) class lowercase ( lowercase_ ): __SCREAMING_SNAKE_CASE : Any = '...
108
1
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever lowercase_ : Union[str, Any] = logging.getLogger(__name__) class _lowerCamelCase ( UpperCamelCase_ ): def __init__...
64
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __lowercase ( __snake_case ): _A = (DEISMultistepSc...
461
0
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class lowerCamelCase_ ( unittest.TestCase ): def __magic_name__ ( self ): a_ = Vector([1, 2, 3] ) self.ass...
703
import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_...
403
0
"""simple docstring""" import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase__ ( snake...
341
"""simple docstring""" def _a ( _snake_case ): """simple docstring""" UpperCAmelCase = len(_snake_case ) for i in range(_snake_case ): for j in range(i + 1 , _snake_case ): if numbers[j] < numbers[i]: ...
341
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
30
'''simple docstring''' _lowercase : int = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def lowerCamelCase ( ) -> None: lowercase_ : List[Any] = input("""Enter message: """ ) lowercase_ : str = input("""Enter key [alphanumeric]: """ ) lowerca...
30
1
"""simple docstring""" class lowercase__ : '''simple docstring''' def __init__( self , snake_case = "" , snake_case = False ) -> None: # Mapping from the first character of the prefix of the node _UpperCAmel...
573
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config...
573
1
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": __snake_case: Any = argparse.ArgumentParser( description=( "Extraction some layers of the full RobertaForMaskedLM or GPT2LMHead...
460
'''simple docstring''' from __future__ import annotations def _snake_case ( A_ : int ): """simple docstring""" a_ : Optional[Any] = 2 a_ : int = [] while i * i <= n: if n % i: i += 1 else: n //= i ...
460
1
"""simple docstring""" import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditi...
532
'''simple docstring''' from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputF...
435
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
711
from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE =logging.get_logger(__name__) __SCREAMING_SNAKE_CASE ={ """google/realm-cc-news-pretrained-embedder""": ( """https://huggingface.co/google/realm-cc-news-pretrained-embedde...
89
0
"""simple docstring""" from string import ascii_uppercase UpperCAmelCase : Optional[Any] = {str(ord(c) - 55): c for c in ascii_uppercase} def _SCREAMING_SNAKE_CASE (__lowerCAmelCase , __lowerCAmelCase ) -> str: '''simple docstring''' if isinstance(_...
567
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def _SCREAMING_SNAKE_CASE () -> Generator[int, None, None]: '''simple docstring''' lowercase_ = {} lowercase_ = 2 while True: lowe...
567
1
"""simple docstring""" import argparse import os from accelerate.utils import ComputeEnvironment from .cluster import get_cluster_input from .config_args import cache_dir, default_config_file, default_yaml_config_file, load_config_from_file # noqa: F401 from .config_utils import _ask_field, _ask_options, _con...
720
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeli...
628
0
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.trai...
486
'''simple docstring''' from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowerCAmelCase :Dict = datasets.utils.logging.get_logger(__name__) class _lowerCamelCase ( folder_based_builder.FolderBasedBuil...
561
0
'''simple docstring''' import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class ...
716
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCAmelCase_ : List[str] = { '''configuration_layoutlmv2''': ['''L...
156
0
"""simple docstring""" import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness a = '''\ @misc{chen2021evaluating, title={Evaluating L...
7
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
140
0
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers _A = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def lowercase_ ( ) -> List[Any]: lowerCAmelCase__ : int = os.path.dirname(os.path.realpath(__UpperCAmelCase ) ) ...
507
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar _A = TypeVar("""_T""") class _lowerCamelCase ( Generic[_T] ): def __init__( self : Optional[Any] , UpperCamelCase : Iterable[_T] | None = None ) -> None: ...
507
1
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : Optional[int] = { ...
368
'''simple docstring''' from math import loga def __lowerCamelCase ( UpperCAmelCase_ ) ->int: if a < 0: raise ValueError('Input value must be a positive integer' ) elif isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('Input value ...
368
1
def _A( UpperCamelCase__ : Optional[Any] ) -> Optional[int]: '''simple docstring''' stooge(UpperCamelCase__ , 0 , len(UpperCamelCase__ ) - 1 ) return arr def _A( UpperCamelCase__ : Tuple , UpperCamelCase__ : ...
362
import argparse import copy def _A( UpperCamelCase__ : Union[str, Any] ) -> Tuple: '''simple docstring''' __lowercase = {} with open(UpperCamelCase__ ) as f: for line in f: if line.split()[0] not in dict_of_neighbour...
362
1