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''' def UpperCamelCase__ ( __SCREAMING_SNAKE_CASE ) -> str: snake_case__ , snake_case__ : Optional[int] = [], [] while len(__SCREAMING_SNAKE_CASE ) > 1: snake_case__ , snake_case__ : Tuple = min(...
270
'''simple docstring''' 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...
270
1
from __future__ import annotations from random import random class __lowerCAmelCase : """simple docstring""" def __init__( self , lowerCamelCase__ = None ) -> Optional[Any]: '''simple docstring''' __lowerCamelCase = ...
167
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def lowerCamelCase_ ( UpperCamelCase__ : Optional[Any] ) ->...
167
1
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block @dataclass ...
197
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def __snake_case ( __A ,__A = "cpu" ,__A = None ) -> None: lowercase : Optional[int] = torch.load(__A ,map_location=__A ) for k, v in tqdm(state_...
607
0
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from transfo...
703
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json', } class __UpperCAmelCase( A__ ...
236
0
class __magic_name__ : def __init__( self , __snake_case = "" , __snake_case = False ) -> None: '''simple docstring''' # Mapping from the first character of the prefix of the node __a ={} # A node will be a leaf if the tree co...
242
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCAmelCase : Optional[int] = { "configuration_layoutlmv3": [ ...
242
1
import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils im...
720
"""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 ...
304
0
"""simple docstring""" import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids...
82
# Copyright 2022 The HuggingFace Team and The OpenBMB 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...
397
0
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMS...
721
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __lowerCamelCase ( snake_case__ ,snake_case__ ,snake_case__ ,snake_case__ ,sn...
569
0
import argparse import json import subprocess def __lowerCamelCase (UpperCAmelCase__ : List[Any] , UpperCAmelCase__ : int ): SCREAMING_SNAKE_CASE = [] SCREAMING_SNAKE_CASE = ( F"curl -H \"Accept: application/vnd.github+json\" -H \...
403
import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def __lowerCamelCase (UpperCAmelCase__ : int , UpperCAmelCase__ : Optional[Any] , UpperCAmelCa...
403
1
import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def lowerCAmelCase_ ( snake_case_ : int ) -> List[str]: '''simple docstring''' return 1 / (1 + np.exp(-z )) def lowerCAmelCase_ ( snake_case_ : Optional[Any] ...
712
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_: Dict ={ 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Au...
415
0
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase__ : Any = logging.get_logger(__name__) lowercase__ : List[str] = {'''voc...
8
'''simple docstring''' import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.c...
262
0
from math import ceil def __a ( __lowerCAmelCase = 1001 ) -> int: SCREAMING_SNAKE_CASE : Any = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): SCREAMING_SNAKE_CASE : List[Any] = 2 * i + 1 SCREAMING...
308
# 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, HfDocTestParser # allow having m...
308
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig", "CLIPSegVisionC...
109
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a : Any = { "configuration_time_series_transformer": [ "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimeSeriesTransformerConfig", ], } try:...
637
0
'''simple docstring''' import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation....
233
'''simple docstring''' import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_co...
233
1
'''simple docstring''' def A (__lowerCamelCase :int = 3 , __lowerCamelCase :int = 7 , __lowerCamelCase :int = 1000000 ): _lowerCAmelCase = 0 _lowerCAmelCase = 1 for current_denominator in range(1 , limit + 1 ): _lowerCAmelCase ...
5
'''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) warnings.warn( ...
5
1
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
240
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position _UpperCAmelCase = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'): rais...
240
1
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_safe...
148
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_te...
18
0
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 from t...
720
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowercase_ = { '''configuration_clip''': [ ...
336
0
"""simple docstring""" def UpperCAmelCase ( A : Tuple ): '''simple docstring''' _UpperCAmelCase = len(__lowercase ) _UpperCAmelCase = sum(__lowercase ) _UpperCAmelCase = [[False for x in range(s + 1 )] for y in range(n +...
573
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureEx...
357
0
"""simple docstring""" import math def _lowerCAmelCase ( lowerCamelCase__ : float, lowerCamelCase__ : float ) -> float: if initial_intensity < 0: raise ValueError("The value of intensity cannot be negative" ) # handling of negative values of ...
295
"""simple docstring""" import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files", [ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "...
295
1
def UpperCAmelCase_ ( __UpperCAmelCase : Optional[Any] = 10_00 ) -> Optional[int]: return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
31
'''simple docstring''' import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCAmelCase : def __init__(self : Optional[Any] , A__...
310
0
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from tr...
614
"""simple docstring""" import baseaa def __UpperCamelCase ( SCREAMING_SNAKE_CASE ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode("utf-8" ) ) def __UpperCamelCase ( SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" ...
614
1
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel lowercase_ = False lowercase_ = True lowercase_ = False if __name__ == "__main__": lowercase_ = argparse.ArgumentParser() parser.a...
74
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : Any = logging.get_logger(__name__) A_ : Optional[int] = { 'facebook/xmod...
265
0
"""simple docstring""" import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from di...
101
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { '''microsoft/git-base''': '''https://huggingface.co/microsoft/git-base/resolve...
101
1
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging lowercase_ = logging.get_logger(__name__) def a__ ( snake_case , snake_case ): """simple docstring""" __SCREAMING_SNAKE_CASE : Tu...
74
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __UpperCamelCase ( unittest.TestCase ): """simp...
74
1
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": __UpperCamelCase : Dict = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Trans...
372
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __UpperCamelCase : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependenc...
372
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See...
209
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import...
209
1
'''simple docstring''' import baseaa def __UpperCAmelCase ( a_: str ): return baseaa.baaencode(string.encode("utf-8" ) ) def __UpperCAmelCase ( a_: bytes ): return baseaa.baadecode(a_ ).decode("utf-8" ) if __name__ == "__main__": ...
257
'''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 __a = get_tests_dir('fixtur...
257
1
'''simple docstring''' from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class UpperCAmelCase_ (_UpperCAmelCase ): """simple docstring""" lowerCamelCase : Optional[int] = 'EncodecFeatureE...
13
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchau...
580
0
# We ignore warnings about stepping the scheduler since we step it ourselves during gradient accumulation import warnings from .state import AcceleratorState, GradientState warnings.filterwarnings("ignore", category=UserWarning, module="torch.optim.lr_scheduler") class _lowerCAmelCase : def __...
279
from collections.abc import Iterable from typing import Any class _lowerCAmelCase : def __init__( self , _UpperCamelCase = None ) -> str: lowerCAmelCase_ = value lowerCAmelCase_ = None # Added in order to delete a node easier lowe...
279
1
import datasets _lowercase = '''\ @InProceedings{conneau2018xnli, author = "Conneau, Alexis and Rinott, Ruty and Lample, Guillaume and Williams, Adina and Bowman, Samuel R. and Schwenk, Holger and Stoya...
157
import math def _A (UpperCamelCase : list , UpperCamelCase : int = 0 , UpperCamelCase : int = 0 ) ->list: '''simple docstring''' lowerCamelCase__ : Tuple = end or len(UpperCamelCase ) for i in range(UpperCamelCase , UpperCamelCase ): ...
157
1
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE) class _a ( __SCREAMING_SNAKE_CASE): """simple docstring""" # `task` is not ...
705
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils ...
95
0
"""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_CON...
567
'''simple docstring''' import warnings from functools import wraps from typing import Callable def UpperCAmelCase_ ( lowerCamelCase_ ): """simple docstring""" @wraps(lowerCamelCase_ ) def _inner_fn(*lowerCamelCase_ , **lowerCamelCase_ ): warnings.warn( (f'''\'{fn.__name__}\'...
378
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from ...
705
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowercase ( __A : bytes , __A : int ) -> np.array: '''simple docstring''' snake_case : List[str] = f"""{sampling_rate}""" snake_...
315
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DU...
471
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow ...
471
1
def a__ (__lowercase :str , __lowercase :str ) -> bool: _A : Dict = len(__lowercase ) + 1 _A : Optional[int] = len(__lowercase ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether prefix string of # length i of input_s...
717
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 ...
332
0
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase : Dict = logging.get_logger(__name__) _lowerCAmelCase : ...
438
"""simple docstring""" import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkp...
438
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import ConfigTester...
249
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def lowerCamelCase_ ( UpperCamelCase_ = 8 ): _a : int = ascii_letters + digits + punctuation return "".join(secrets.choice(UpperCamelCase_ ) fo...
249
1
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
134
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def UpperCamelCase ( _a ) -> List[str]: '''simple docstri...
257
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, id...
27
'''simple docstring''' import warnings 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 ( ...
27
1
def a_ ( lowerCAmelCase_ : list, lowerCAmelCase_ : int = 0 ): __lowerCAmelCase = length or len(lowerCAmelCase_ ) __lowerCAmelCase = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __lowerCAmelCase ...
53
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { """EleutherAI/gpt-neox-20b""": """https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json""", ...
525
0
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class A__ ( nn.Module ): ...
38
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """camembert-base""": """h...
38
1
'''simple docstring''' def __a(SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _lowerCAmelCase = [True] * (num + 1) _lowerCAmelCase = 2 while p * p <= num:...
18
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqCo...
18
1
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( _UpperCamelCase ): """simple docst...
421
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def a_ ( lowerCAmelCase_ : Any ): __lowerCAmelCase = args.pruning_method __lowerCAmelCase = args.threshold __lowerCAmelCase ...
421
1
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __lowerCamelCase = '''\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
467
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...tes...
254
0
"""simple docstring""" import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet impor...
272
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessi...
272
1
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowerCAmelCase__ = logging.getLogger() @unittest.skip('Temporarily d...
41
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''KEY''') lowerCAmelCase__ = TypeVar('''VAL''') @dataclass(frozen=lowerCamelCase__ , slots=lowerCamelCase...
41
1
"""simple docstring""" import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap __snake_case : int = "Usage of script: script_name <size_of_canvas:int>" __snake_case : Optional[Any] = [0] ...
712
"""simple docstring""" import re from filelock import FileLock try: import nltk __snake_case : Any = True except (ImportError, ModuleNotFoundError): __snake_case : Optional[int] = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk....
615
0
'''simple docstring''' import tensorflow as tf from ...tf_utils import shape_list class __magic_name__ ( tf.keras.layers.Layer ): """simple docstring""" def __init__( self , lowerCamelCase , lowerCamelCase , lowerCamelCase , l...
111
'''simple docstring''' 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 re...
111
1
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "vocab_file": "vocab.json", "merges_file": "merge...
664
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determi...
664
1
def lowerCamelCase__ ( _a , _a , _a=False): if isinstance(_a , _a) and isinstance(_a , _a): SCREAMING_SNAKE_CASE : Tuple = len(set_a.intersection(_a)) if alternative_union: SCREAMING_SNAKE_CASE : Dict = len(_a) + len(_a) else: SCREA...
25
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils....
130
0
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from tr...
233
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale,...
233
1
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
32
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ) def __l...
0
0
from math import sqrt def _lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE_CASE ): ...
709
from __future__ import annotations import pandas as pd def _lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = [0] * no_of_processes A_ = [0] * no_of_processes ...
563
0
'''simple docstring''' def lowercase_ ( __A : int ) -> int: """simple docstring""" assert ( isinstance(__A , __A ) and number_of_steps > 0 ), F'number_of_steps needs to be positive integer, your input {number_of_steps}' if number_of_steps == 1: r...
94
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import...
431
0
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionSchedule...
212
import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_v...
212
1
"""simple docstring""" from maths.prime_factors import prime_factors def snake_case ( lowerCAmelCase_ ) -> int: if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): _snake_case = f"""Input value of [number={number}] must be an integer""" raise Type...
103
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
1
from __future__ import annotations import collections import pprint from pathlib import Path def __lowerCamelCase ( __lowerCAmelCase : str ) -> str: return "".join(sorted(__lowerCAmelCase ) ) def __lowerCamelCase ( __lowerCAmelCase : ...
719
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_image_p...
515
0
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, r...
81
# 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 required by...
256
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 _A ( UpperCamelCase ...
172
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqa...
172
1
from __future__ import annotations __a :str = '#' class _a : """simple docstring""" def __init__( self : int ): A_ = {} def __A ( self : int , UpperCAmelCase : str ): A_ ...
86
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : int = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
72
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
207
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def SCREAMING_SNAKE_CASE( ) -> int: a__ : List[str] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "path": ["test_1....
207
1
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class __snake_case ( nn.Module ): _a : int _a : int _a : float= 0.0 _a : int= 1 ...
336
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokeni...
392
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor _lowerCAmelCase = logging.get_logger(__name__) class lowerCAmelCase_( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' def __init__( self...
708
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gp...
160
0
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
45
'''simple docstring''' import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py snake_case = """.""" if __name__ == "__main__": snake_case = os.path.join(REPO_PATH, """utils/documentation_tes...
378
0
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 _UpperCamelCase = "\\n@misc{chen2021evaluating,\n title={Evaluating Large Language Models T...
720
from __future__ import annotations def _lowercase ( lowercase__ ): if len(lowercase__ ) == 0: return array __lowerCAmelCase, __lowerCAmelCase : List[str] = min(lowercase__ ), max(lowercase__ ) # Compute the variables __lowerCAmelCase : ...
583
0
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_fla...
71
'''simple docstring''' from __future__ import annotations def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' if partitions <= 0: raise ValueError("""partitions must be a positive number!""" ) if partitions > number_of_bytes: raise ValueE...
667
0
from __future__ import annotations __UpperCAmelCase = [True] * 1_0_0_0_0_0_1 __UpperCAmelCase = 2 while i * i <= 1_0_0_0_0_0_0: if seive[i]: for j in range(i * i, 1_0_0_0_0_0_1, i): __UpperCAmelCase = False i += 1 def _snake_case ( SCREAMING_SNAKE_CASE ) ...
720
from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ChannelDimension, ImageInput, ...
503
0
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Tuple = logging.get_logger(__name__) _lowerCAmelCase : Optional[int] = { "huggingface/time-series-transformer-tou...
289
"""simple docstring""" import requests _lowerCAmelCase : List[Any] = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def __snake_case ( SCREAMING_SNAKE_CASE__ : str ) -> None: '''simple docstring''' _UpperCAmelCase : List[str] ...
289
1
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments __SCREAMING_SNAKE_CASE =logging.getLogger(__name__) @dataclass class __magic_name__ ( __UpperCAmel...
89
from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function __SCREAMING_SNAKE_CASE =1.0_5_4_5_7_1_8_1_7e-3_4 # unit of ℏ : J * s __SCREAMING_SNAKE_CASE =3e8 # unit of c : m * s^-1 def a ...
89
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _A = logging.get_logger(__name__) _A = { """microsoft/focalnet-tiny""": """https://h...
299
"""simple docstring""" from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class _lowerCamelCase ( a_ ): def __init__( self : Optio...
299
1
from __future__ import annotations from dataclasses import dataclass @dataclass class a__ : """simple docstring""" A__ : Optional[int] = 42 A__ : int = None A__ : str = None def ...
714
from queue import PriorityQueue from typing import Any import numpy as np def __snake_case ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ,...
314
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _A = { "configuration_funnel": ["FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP", "FunnelConfig"], "convert_funnel_original_tf_check...
290
'''simple docstring''' from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) # pylint: disab...
301
0
class __UpperCamelCase : def __init__( self : Dict ): '''simple docstring''' UpperCAmelCase_ = "" UpperCAmelCase_ = "" UpperCAmelCase_ = [] def __A ( self : List[Any] , lowerCAmelCase : int , lowerCAmelCase : ...
707
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_res...
268
0
'''simple docstring''' import copy import os import cva import numpy as np from matplotlib import pyplot as plt class __SCREAMING_SNAKE_CASE : def __init__( self : Union[str, Any] ): '''simple docstring''' lowercase : Tuple ='''''' lo...
92
'''simple docstring''' def _snake_case ( A_ : Optional[int] ): """simple docstring""" a_ : str = len(A_ ) for i in range(length - 1 ): a_ : List[Any] = i for k in range(i + 1 , A_ ): if collection[k] < collection[least]: ...
577
0
'''simple docstring''' import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def lowerCAmelCase_ ( __a , __a , __a ) -> Any: """simple docstring""" lowerCamelCase__: str =AutoConfig.from_pretrained(__a ) ...
703
def lowerCAmelCase_ ( __a , __a ) -> float: """simple docstring""" if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": imp...
437
0
from pathlib import Path import fire from tqdm import tqdm def lowercase__ ( _UpperCamelCase="ro" , _UpperCamelCase="en" , _UpperCamelCase="wmt16" , _UpperCamelCase=None) -> None: """simple docstring""" try: import datasets ...
280
def lowercase__ ( _UpperCamelCase , _UpperCamelCase) -> bool: """simple docstring""" return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
280
1
'''simple docstring''' from __future__ import annotations UpperCAmelCase__ :int = """Muhammad Umer Farooq""" UpperCAmelCase__ :Dict = """MIT""" UpperCAmelCase__ :Dict = """1.0.0""" UpperCAmelCase__ :str = """Muhammad Umer Farooq""" UpperCAmelC...
711
'''simple docstring''' from __future__ import annotations import typing from collections.abc import Iterable import numpy as np UpperCAmelCase__ :List[str] = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 UpperCAmelCase__ :Optional[int] = typing.Union[...
483
0
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_configuration_common import ConfigT...
89
import unittest from transformers import XLMConfig, 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_...
89
1
'''simple docstring''' from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTraining...
581
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class a__: def __init__( self ) -> List[Any]: snake_case__ ={} def _lowercase ( self , _UpperCAmelCase , _UpperCAmel...
581
1
class lowerCamelCase_ : def __init__( self : Dict , __A : Tuple , __A : Optional[int] , __A : int ): __A : List[str] = name __A : Optional[int] = value __A : Optional[Any] = weight def __repr_...
17
'''simple docstring''' 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 _UpperCamelC...
42
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) __UpperCAmelCase : int = { "studio-ousia/luke-base": "https://huggingface.co/studio-ousia/luke-base/resolve...
706
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def a ( SCREAMING_SNAKE_CASE_ : bool = True , *SCREAMING_SNAKE_CASE_ : List[str] , **SCREAMING_SNAKE_CASE_ : Tuple ...
643
0
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import Generat...
38
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
0
"""simple docstring""" def __lowerCamelCase ( lowerCAmelCase__ ): if not isinstance(lowerCAmelCase__ ,lowerCAmelCase__ ): raise ValueError('multiplicative_persistence() only accepts integral values' ) if num < 0: raise ValueErr...
709
"""simple docstring""" from ..utils import DummyObject, requires_backends class snake_case_ ( metaclass=_lowerCamelCase ): """simple docstring""" SCREAMING_SNAKE_CASE_: List[str] = ["""note_seq"""] def __init__( self , ...
554
0
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random...
540
import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class SCREAMING_SNAKE_CASE_ ( unittest.Te...
181
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_ = { '''configuration_timesformer''': ['''TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimesformerConfig'''], } try: ...
705
"""simple docstring""" def lowercase__ ( lowerCAmelCase : int , lowerCAmelCase : int ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) == 0 ) def lowercase__ ( ) -> None: """simple do...
183
0
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": lowerCAmelCase : Tuple = argparse.ArgumentParser() parser.add_argument("""--dump_path""", def...
202
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets __UpperCAmelCase : List[str] = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, ...
471
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { "facebook/convnextv2-tiny-1k-2...
383
def A ( lowercase__ : int ) -> bool: if p < 2: raise ValueError("""p should not be less than 2!""" ) elif p == 2: return True UpperCamelCase__ :Optional[int] = 4 UpperCamelCase__ :int = (1 << p) - 1 for _ in range(p - 2 ): UpperCamelCase__ ...
383
1
'''simple docstring''' from __future__ import annotations class _UpperCAmelCase : """simple docstring""" def __init__( self : List[str] , __UpperCAmelCase : int ): '''simple docstring''' _A = data _A = None...
330
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def a_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: """simple docstring""" snake_case: int ...
350
0
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple...
717
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ : Any = { """configuration_trajectory_transformer""": [ """TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_...
394
0
'''simple docstring''' from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def A_( A...
3
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase : Optional[Any] = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } tr...
3
1
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class a__ ( _lowercase ): def __init__(self : str, ...
718
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from ...
355
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowercase = {} try: if not is_sentencepiece_available(): raise OptionalDependen...
91
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ...
333
0
__lowercase : Optional[int] ="""Input must be a string of 8 numbers plus letter""" __lowercase : str ="""TRWAGMYFPDXBNJZSQVHLCKE""" def a__ ( lowercase__ ): '''simple docstring''' if not isinstance(lowercase__ , lowercase__ ...
550
__lowercase : Dict ="""0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_loader imp...
550
1
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin c...
48
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = { "google/umt5-small...
48
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-...
712
"""simple docstring""" SCREAMING_SNAKE_CASE__ = "0.18.2" from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_ve...
104
0
def _lowerCAmelCase ( _lowerCAmelCase ,_lowerCAmelCase ): '''simple docstring''' A_ : Tuple = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): A_ : Dict = n - k # Calculate C(n,k) for i in range(A__ ): result ...
569
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { '''facebook/xglm-564M''': '''https://huggingface.co/facebook/xglm-564M/resolve/main/config.json''', ...
426
0
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 lowercase__ = 0b10_11_00_11_11_10_11_00_10_01_00_00...
712
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers impo...
63
0
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_mode...
614
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, Diffusio...
635
0
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _SCREAMING_SNAKE_CASE ( unittest.TestCase ): '''simple docstring''' def _snake_case ( self : List[Any] ): SCREAMING_SNA...
703
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __A : Union[str, Any] = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetConfig']} ...
698
0