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
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class A_ : def __init__( self : int , snake_case_ : str ): _UpperCAmelCase = data _UpperCAmelCase = [0X67_45_23_01, 0...
22
'''simple docstring''' import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test...
22
1
_UpperCAmelCase : Any = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] _UpperCAmelCase : Optional[An...
200
def __lowerCamelCase ( UpperCamelCase__ ): '''simple docstring''' snake_case_ = len(UpperCamelCase__ ) for _ in range(UpperCamelCase__ ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1] ...
200
1
def lowercase ( SCREAMING_SNAKE_CASE__ : int ) -> int: if n == 1 or not isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): return 0 elif n == 2: return 1 else: _snake_case : Optional[Any] = [0, 1] for i in range(2 , n + 1 ): sequence.appen...
317
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE_ ) class snake_case ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' ...
317
1
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCAmelCase : pass
155
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowercase__ : List[str] = logging...
155
1
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.tes...
13
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
110
0
from collections.abc import Sequence from queue import Queue class __snake_case : def __init__( self ,snake_case ,snake_case ,snake_case ,snake_case=None ,snake_case=None ): '''simple docstring''' lowercase : Any = start lowercase : ...
285
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def _snake_case( ) -> tuple[list[int], int]: lowercase : List[Any] = [randint(-1_000 , 1_000 ) for i in range(10 )] lowercase : ...
285
1
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( snake_case__): __a : int = (KDPMaDiscreteScheduler,) ...
246
'''simple docstring''' from typing import Any def UpperCamelCase_ ( _UpperCAmelCase : list , _UpperCAmelCase : list , _UpperCAmelCase : dict , _UpperCAmelCase : dict , _UpperCAmelCase : dict , ) -> list: """simple docstring""" _validat...
31
0
"""simple docstring""" import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class UpperCamelCase ( lowerCAmelCase__ , unit...
312
"""simple docstring""" import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_...
312
1
'''simple docstring''' def UpperCamelCase_ ( _UpperCAmelCase : str , _UpperCAmelCase : Dict ) -> int: """simple docstring""" return x if y == 0 else greatest_common_divisor(__A , x % y ) def UpperCamelCase_ ( _UpperCAmelCase : Dict , ...
31
'''simple docstring''' def _UpperCamelCase ( __A ) -> int: '''simple docstring''' UpperCamelCase__ = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def _UpperCamelCase ( __A = 100 ) ...
80
0
"""simple docstring""" import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowercase ( lowerCAmelCase__ : int , lowerCAmelCase__ : Dict=None ) -> Tuple: __a ...
11
"""simple docstring""" from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline lowercase_ ...
11
1
'''simple docstring''' import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class lowercase__ ( lowercase ): # to overwrite at feature extractacto...
83
'''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 ( AutoConfig, Au...
83
1
import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common im...
360
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def lowercase_ ( _lowerCamelCase : int , _lowerCamelCase : Any , _lowerCamelCase : str): lowercase__ : Optional[Any] = AutoConfig.from_pretrain...
333
0
"""simple docstring""" import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets UpperCAmelCase_ : Optional[Any] = datasets.logging.get_logger(__name__) UpperCAmelCase_ : List[str] ...
91
"""simple docstring""" def _A (__a = 50 ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): ...
91
1
def snake_case( __magic_name__ ): '''simple docstring''' lowercase : int = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def snake_case( __magic_name__ = 1_00 ): '''simple do...
365
class _A : # Public class to implement a graph def __init__( self : List[Any] , _A : int , _A : int , _A : list[list[bool]] ) -> None: """simple docstring""" lowercase : Tuple = row...
116
0
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from a...
113
"""simple docstring""" from __future__ import annotations def lowercase (SCREAMING_SNAKE_CASE_ : str ) -> list[int]: return [ord(SCREAMING_SNAKE_CASE_ ) - 96 for elem in plain] def lowercase (SCREAMING_SNAKE_CASE_ : list[int] ) -> str: return "...
113
1
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( snake_case : int )-> list: '''simple docstring''' if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence UpperCAmelCase__ : Opti...
298
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class lowerCAmelCase__ ( __magic_name__ ): def __a ( self : List[Any] , snake_case__ : str ): '''simple docstring''' wi...
298
1
import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = R'\n Args:\n input_ids (`torch.LongTensor` of shape `(ba...
279
'''simple docstring''' from ....utils import logging lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class __lowerCAmelCase (lowercase_ ): '''simple docstring''' def __init__(self : Optional[int] , UpperCamelCase : Union[str, Any] ...
2
0
"""simple docstring""" from manim import * class __A ( _SCREAMING_SNAKE_CASE ): """simple docstring""" def SCREAMING_SNAKE_CASE ( self ) -> Tuple: a =Rectangle(height=0.5 , width=0.5 ) a =Rectangle(hei...
215
"""simple docstring""" import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testi...
215
1
lowercase = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" lowercase = [{"type": "code", "content": INSTALL_CONTENT}] lowercase = { ...
178
from typing import TYPE_CHECKING from ...utils import _LazyModule lowercase = {"processing_wav2vec2_with_lm": ["Wav2Vec2ProcessorWithLM"]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys lowercase = _LazyModule(__name__, globals...
178
1
import baseaa def _UpperCamelCase (a__ :str ): """simple docstring""" return baseaa.baaencode(string.encode("""utf-8""" ) ) def _UpperCamelCase (a__ :bytes ): """simple docstring""" return baseaa.baadecode(UpperCame...
363
import json import os import torch from diffusers import UNetaDModel os.makedirs("hub/hopper-medium-v2/unet/hor32", exist_ok=True) os.makedirs("hub/hopper-medium-v2/unet/hor128", exist_ok=True) os.makedirs("hub/hopper-medium-v2/value_function", exist_ok=True) def _UpperCamelCase (a__ :int...
87
0
"""simple docstring""" import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowercase__ : Union[str, Any] = pytest.mark.integration @pytest.mark....
264
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e...
276
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """sayakpaul/vit-msn-base""": """https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json""", # See all ViT MSN models at https://hu...
357
import os from collections.abc import Iterator def __lowerCAmelCase ( SCREAMING_SNAKE_CASE_ = "." ): for dir_path, dir_names, filenames in os.walk(SCREAMING_SNAKE_CASE_ ): lowercase__ = [d for d in dir_names if d != "scripts" and d[0] not in "._"] for filename in filenames: ...
224
0
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformer...
57
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def __lowerCamelCase ( *UpperCamelCase__ ): '''simple docstring''' if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): snake_case...
365
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Dict = { """configuration_blip""": [ """BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", "...
200
0
from __future__ import annotations import os from typing import Any import requests A__: Union[str, Any] = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user A__: Any = BASE_URL + '''/user''' ...
149
from collections import deque class _a : """simple docstring""" def __init__( self: Union[str, Any] , __lowerCamelCase: str , __lowerCamelCase: int , __lowerCamelCase: int ): '''simple docstring''' UpperC...
149
1
"""simple docstring""" import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class a__ ( unittest.TestCase ): def lowercase ( ...
363
"""simple docstring""" def lowercase__ ( _UpperCAmelCase ) -> int: '''simple docstring''' assert isinstance(_UpperCAmelCase , _UpperCAmelCase ), f'''The input value of [n={number}] is not an integer''' if number == 1: ret...
53
0
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replica...
59
from __future__ import annotations UpperCAmelCase__ = list[list[int]] # assigning initial values to the grid UpperCAmelCase__ = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5], ...
339
0
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCamelCase ( a_ ) -> float: return np.dot(a_ , a_ ) class a_ : '''simple docstring''' def __init...
14
lowerCamelCase_ = 6_5_5_2_1 def lowerCamelCase ( a_ ) -> int: lowerCAmelCase_ = 1 lowerCAmelCase_ = 0 for plain_chr in plain_text: lowerCAmelCase_ = (a + ord(a_ )) % MOD_ADLER ...
14
1
from __future__ import annotations from math import pi, sqrt def lowerCamelCase_ ( UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : List[str] ) -> tuple: """simple docstring""" if inductance <= 0: raise ValueE...
90
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging ...
48
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 Data...
360
import os import string import sys __lowerCamelCase = 1 << 8 __lowerCamelCase = { """tab""": ord("""\t"""), """newline""": ord("""\r"""), """esc""": 27, """up""": 65 + ARROW_KEY_FLAG, """down""": 66 + ARROW_KEY_FLAG, """right""": 67 + ARROW_KEY_FLAG, """left"""...
10
0
'''simple docstring''' import gc import threading import time import psutil import torch class __a : def __init__( self : Optional[int] ) -> Optional[Any]: """simple docstring""" UpperCAmelCase_ : Tuple = psutil.Proces...
125
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets snake_case_ : Union[str, Any] = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Unders...
125
1
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configur...
369
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_fea...
254
0
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def A_ ( ): """simple docstring""" _a = { '''repo_name''': ['''test_repo1''', '''test_repo2''', '''test_...
320
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
106
0
"""simple docstring""" import argparse import os 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_task_guides.py SCREAMING_SNAKE_CASE__ = "src/transformers"...
370
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate impo...
149
0
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() __lowerCamelCas...
221
from math import log from scipy.constants import Boltzmann, physical_constants a : Any = 300 # TEMPERATURE (unit = K) def lowerCamelCase__ ( __lowerCamelCase : float , __lowerCamelCase : float , __lowerCamelCase : float , ): if don...
114
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json', } class _lowercase ( __Uppe...
355
"""simple docstring""" import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _A = { 'tiny.en': 'https://openaipublic.azureedge.net/main/whisp...
205
0
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase__ ( ) -> tuple[list[int], int]: UpperCamelCase_ = [randint(-1000 , 1000 ) for i in range(10 )] UpperCamelCase_ = ra...
122
_A = [0, 2, 4, 6, 8] _A = [1, 3, 5, 7, 9] def lowerCamelCase__ ( a__ : int , a__ : int , a__ : list[int] , a__ : int ) -> int: if remaining_length == 0: if digits[0] == 0 or digits[-1] == 0: return ...
122
1
'''simple docstring''' import os import sys import transformers a__ : Tuple = '3' print('Python version:', sys.version) print('transformers version:', transformers.__version__) try: import torch print('Torch version:', torch.__version__) print('Cuda available:'...
355
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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/...
243
0
'''simple docstring''' from __future__ import annotations a_ : int = """#""" class snake_case : """simple docstring""" def __init__( self ): """simple docstring""" lowerCamelCase_ = {} def snake_case ( ...
55
'''simple docstring''' import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): im...
27
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils import logg...
350
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def UpperCAmelCase ( _lowerCamelCase , ...
256
0
'''simple docstring''' import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig fr...
56
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : str = logging.get_logger(__name__) _lowercase : Dict = { 'microsoft/swinv2-tiny-patch4-window8-256': ( 'https://huggingface.co/microsoft/swin...
332
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelC...
365
"""simple docstring""" from math import factorial def snake_case ( A__ = 1_00 ): return sum(int(A__ ) for x in str(factorial(A__ ) ) ) if __name__ == "__main__": print(solution(int(input('''Enter the Number: ''').strip())))
253
0
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) # TODO: upload to AWS UpperCAmelCase : Dict = { """yjernite/retribert-base-uncased""": ( """https://huggingface.co/yjernite/r...
95
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate imp...
95
1
def lowerCamelCase_ ( UpperCamelCase__ : bytes ) -> str: """simple docstring""" return "".join([hex(UpperCamelCase__ )[2:].zfill(2 ).upper() for byte in list(UpperCamelCase__ )] ) def lowerCamelCase_ ( UpperCamelCase__ : str ...
360
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_dat...
348
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={ "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.json" ), }...
334
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 _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ...
334
1
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DD...
352
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase (...
343
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ : Optional[Any] = { """configuration_trajectory_transformer""": [ """TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
91
def lowerCamelCase__ ( _A , _A ): '''simple docstring''' _enforce_args(_A , _A ) if n == 0: return 0 snake_case_ = float("-inf" ) for i in range(1 , n + 1 ): snake_case_ = max( _A , prices[i - 1]...
187
0
'''simple docstring''' import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ...
135
'''simple docstring''' def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' if density <= 0: raise ValueError("""Impossible fluid density""" ) if bulk_modulus <= 0: raise ValueError("""Impossible bulk modulus""" ) return (bulk_modulus / de...
135
1
"""simple docstring""" import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepar...
183
"""simple docstring""" 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(...
202
0
"""simple docstring""" import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import Token...
353
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .util...
205
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ...
76
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def __magic_name__ ( A : NDArray[floataa], A : NDArray[floataa], A : list[int], A : int, ): '''simple docstring''' a , a = coefficient_matr...
107
0
"""simple docstring""" a_ = '''Alexander Joslin''' import operator as op from .stack import Stack def a__ ( __lowercase ) -> int: _A = {"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub} _A = Stack() _A = S...
354
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = {"ctrl": "https://huggingface.co/ctrl/resolve/main/config.json"} class snake_case ( _UpperCamelCase): __UpperCamelCase ...
163
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _UpperCamelCase = r''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to cont...
254
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
300
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __snake_case : '''simple docstring''' lowerCAmelCase__ = None def UpperCAmelCase__ ( self : Tuple ): __snake_case: ...
293
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
293
1
'''simple docstring''' import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer lowerCAmelCase_ : Dict = logging.getLogger(__name__) def _lowerCamelCase ( ) -> Optional[int]: _a = argparse.ArgumentParser(...
63
from __future__ import annotations def __lowerCamelCase ( lowerCamelCase__ : int , lowerCamelCase__ : int ): '''simple docstring''' if b == 0: return (1, 0) ((lowerCamelCase) , (lowerCamelCase)) = extended_euclid(lowerCamelCase__ , a % b...
252
0
from typing import Any def __A ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , ) -> list: _validation( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , ...
363
def __A ( __lowerCamelCase ) -> int: if not numbers: return 0 if not isinstance(__lowerCamelCase , (list, tuple) ) or not all( isinstance(__lowerCamelCase , __lowerCamelCase ) for number in numbers ): raise ValueError("""numbers must be an iterable of ...
347
0
import itertools import os import re snake_case : str = re.compile(R'''([A-Z]+)([A-Z][a-z])''') snake_case : Tuple = re.compile(R'''([a-z\d])([A-Z])''') snake_case : Optional[int] = re.compile(R'''(?<!_)_(?!_)''') snake_case : Optional[Any] ...
94
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case_ : Union[str, Any] = { "configuration_pix2struct": [ "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Pix...
125
0
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transfo...
27
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __A : int = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try:...
27
1
"""simple docstring""" import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class __lowerCamelCase ( tf.keras.layers.Layer ): '''simple...
241
'''simple docstring''' from itertools import product def lowercase__( __UpperCamelCase: int ,__UpperCamelCase: int ): """simple docstring""" SCREAMING_SNAKE_CASE : Tuple = sides_number SCREAMING_SNAKE_CASE : str = max_face_number * dic...
251
0
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _lowerCAmelCase ( _...
135
'''simple docstring''' import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) lowerCamelCase :Optional[int] ...
135
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase : List[str] = { "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_torch_av...
316
"""simple docstring""" import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device ...
316
1
"""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 ...
365
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
100
0
"""simple docstring""" import argparse import collections import json import os import re import string import sys import numpy as np __A = re.compile(R"\b(a|an|the)\b", re.UNICODE) __A = None def UpperCamelCase__ ( ): snake_case : Option...
148
"""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,...
148
1
import collections import inspect import unittest from transformers import SwinvaConfig 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 ConfigTeste...
360
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase ( ...
301
0
import re from filelock import FileLock try: import nltk _lowerCAmelCase : int = True except (ImportError, ModuleNotFoundError): _lowerCAmelCase : Any = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) def __snake_ca...
300
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
300
1
"""simple docstring""" def __snake_case ( SCREAMING_SNAKE_CASE__ : int ) -> int: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): raise TypeError("Input value must be an 'int' type" ) _UpperCA...
202
"""simple docstring""" from collections.abc import Callable class UpperCAmelCase_ : def __init__( self : Dict , A : Callable | None = None ): # Stores actual heap items. _UpperCAmelCase : list = [] # Stores ...
202
1
import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import cached_property from ...test...
259
"""simple docstring""" import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL __lowerCAmelCase : Dict =version.parse(version.parse(torch.__version__).base_version) < version.parse(...
197
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _lowerCAmelCase = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''...
369
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { '''vocab_file''': '''vocab....
184
0
'''simple docstring''' import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger lowerCamelCase_ = get_logger(__name__) class _UpperCAmelCase ( enum.Enum ): """simple docstring""" snake_case ...
79
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import numpy as np import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor ...
79
1
import inspect 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_config_docstrings.py __UpperCAmelCase = '''src/transformers''' # This is to make sure the...
42
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_blip_2''': [ '''BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Blip2Config''', '''Blip2QFormerConfig''', '''Blip...
42
1
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def snake_case__ ( __lowerCamelCase :...
238
"""simple docstring""" def snake_case__ ( ): """simple docstring""" return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] _lowercase : str = generate_large_matrix() _lowercase : str = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1...
238
1
def lowercase__ ( __snake_case : str , __snake_case : int , __snake_case : List[str] ): '''simple docstring''' if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation(__snake_case , n - 1 , __...
145
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging ...
145
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json', } ...
11
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging A =logging.get_logger(__name__) A ={ 'facebook/encodec_24khz': 'https://huggingface.co/facebook/encodec_24khz/resolve/main/confi...
34
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor UpperCAmelCase = logging.get_logger(__name__) class UpperCAmelCase_ ( _lowercase): def __init__( self : Optional[Any] , *__UpperCamelCase : ...
362
"""simple docstring""" import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase_ ( _lowercase): ...
54
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _lowerCAmelCase = R''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to contro...
37
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
137
0
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ = 0 , SCREAMING_SNAKE_CASE__ = 0 ) -> Any: '''simple docstring''' snake_case : List[Any] = right or len(__a ) - 1 if left > right: ret...
350
'''simple docstring''' import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path"...
83
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case : Union[str, Any] = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARC...
94
def __lowerCamelCase ( UpperCAmelCase_ : int = 100_0000 ): """simple docstring""" a :Any = set(range(3 , UpperCAmelCase_ , 2 ) ) primes.add(2 ) for p in range(3 , UpperCAmelCase_ , 2 ): if p not in primes: ...
94
1
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def UpperCAmelCase__ (snake_case__ : Optional[int] , snake_case__ : List[str] , snake_case__ : int ): """simple docstring""" _snake_case : Dic...
132
"""simple docstring""" import torch from torch import nn class lowercase( nn.Module ): '''simple docstring''' def __init__( self: Any, a_: List[str], a_: Union[str, Any], a_: int, a_: int, a_: List[Any]=1, a_: Union[str, Any]=Fa...
132
1
_snake_case : Optional[int] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def lowerCAmelCase_ ( ): __snake_case : Tuple = input("Enter message: " ) __snake_case : Any = input("Enter key [alphanumeric]: " ) __snake_case : str = input("Encrypt/D...
123
from __future__ import annotations _snake_case : Any = "Muhammad Umer Farooq" _snake_case : Optional[int] = "MIT" _snake_case : Union[str, Any] = "1.0.0" _snake_case : Optional[Any] = "Muhammad Umer Farooq" _snake_case : List[Any] = "contact@muhammadu...
123
1
"""simple docstring""" import os def _snake_case ( ): with open(os.path.dirname(UpperCamelCase ) + """/p022_names.txt""" ) as file: UpperCAmelCase : str = str(file.readlines()[0] ) UpperCAmelCase : Optional[int] = names.replace("""\"""" , """""" ...
76
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggin...
76
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : List[Any] = logging.get_logger(__name__) UpperCAmelCase_ : Tuple = { 'transfo-xl-wt103': 'https://huggingface.co/transfo-xl-wt103/resolve/main/config.json', } class ...
32
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase_ : str = logging.get_logger(__name__) UpperCAmelCase_ : List[str] = { '...
32
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
24
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : Optional[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[str] = { """tanreinama/GPTSAN-2.8B-spout_is_uniform""": ( """https://huggingface...
24
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer else: lowerCamelCase_ ...
244
"""simple docstring""" def __lowerCAmelCase ( ) -> Union[str, Any]: """simple docstring""" snake_case : Dict = [] snake_case : List[Any] = 1 while len(lowercase ) < 1e6: constant.append(str(lowercase ) ) i += 1 ...
203
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase: str = { """configuration_rag""": ["""RagConfig"""], """retrieval_rag""": ["""RagRetriever"""], """tokeniza...
355
"""simple docstring""" from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __SCREAMING_SNAKE_CASE ( ): _lowercase : Dict = [randint(-1000 , 1000 ) for i in range(10 )] _lowercase :...
336
0
'''simple docstring''' from jiwer import compute_measures import datasets UpperCamelCase__: List[Any] = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From...
23
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SCREAMING_S...
23
1
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _A = logging.get_logger(__name__) _A = '▁' _A = {'vocab_file': 'prophetnet.tokenizer'} _A = ...
360
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffuser...
117
0
import numpy as np def __A ( __lowerCAmelCase )-> np.array: """simple docstring""" return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
39
import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def __A ( )-> Tuple: """simple docstring""" raise RuntimeError('CUDA out of me...
39
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCamelCase_ : Dict = logging.get_logger(__name__) class _a ( __lowerCAmelCase ): def __init__( self ,*_SCREAMI...
352
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __a ( _UpperCamelCase: Tuple ) -> Union[str, Any]: """simple docstring""" _snake_case = os.path.j...
142
0
from __future__ import annotations from typing import TypedDict class snake_case ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' snake_case_ : str snake_case_ : int def lowercase ( SCREAMING_SNAKE_CASE__ : st...
317
import torch from torch import nn class snake_case ( nn.Module ): '''simple docstring''' def __init__( self : int , lowerCAmelCase : Tuple , lowerCAmelCase : int , lowerCAmelCase : Any , lowerCAmelCase : T...
317
1
import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging __UpperCAmelCase = logging.get_logger(__name__) de...
139
import numpy as np import qiskit def snake_case_ (__A : int = 8 , __A : int | None = None ) -> str: __lowerCAmelCase : List[Any] = np.random.default_rng(seed=__A ) # Roughly 25% of the qubits will contribute to the key. # So we...
139
1
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _snake_case : Tuple = logging.get_logger(__name__) _snake_case : List[Any] = { "post_extract_proj": "feature...
123
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _snake_case : Tuple = logging.get_logger(__name__) _snake_case : Optional[Any] = ...
123
1
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def _A ( A__ , A__ , A__ , A__ , A__ , A__ ): """simple docstring""" if (ksize % 2) == 0: __lowercase = ksize + 1 ...
353
'''simple docstring''' def _A ( A__ = 1000 ): """simple docstring""" __lowercase , __lowercase = 1, 1 __lowercase = 2 while True: __lowercase = 0 __lowercase = fa + fa __lowercase , __lowercase = fa, f index += 1 for _...
52
0
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTo...
177
"""simple docstring""" from jiwer import compute_measures import datasets __A = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation m...
177
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a ={ """configuration_mask2former""": [ """MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Mask2FormerConfig""", ], } try: if not...
113
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 a ="""src/transformers""" a ="""docs/source/en""" ...
113
1
"""simple docstring""" from __future__ import annotations def __magic_name__ ( lowercase , lowercase , lowercase , lowercase ): # noqa: E741 while r - l > 1: SCREAMING_SNAKE_CASE_: Any =(l + r) // 2 if v[m] >= key: SCREAMING_SN...
173
"""simple docstring""" import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __A = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Au...
135
0
"""simple docstring""" lowercase__ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowercase__ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowercase__ = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday', 5: 'Friday', 6: 'Saturday', } def __a ( _S...
370
"""simple docstring""" import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determ...
203
0
'''simple docstring''' 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 ...
80
"""simple docstring""" import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE_ = get_...
301
0
"""simple docstring""" import inspect 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_config_docstrings.py lowerCAmelCase_ : List[Any] = """...
352
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionMod...
248
0
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType,...
219
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 import logging if version.parse(fai...
219
1
'''simple docstring''' import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conve...
199
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, D...
199
1