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''' def UpperCAmelCase_ (__a : Union[str, Any] , __a : List[Any] = 0 ): """simple docstring""" _a : Tuple = length or len(__SCREAMING_SNAKE_CASE ) _a : Dict = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: ...
271
"""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, UNetaDConditio...
217
0
"""simple docstring""" def lowercase__ ( _UpperCAmelCase ) -> int: '''simple docstring''' if not isinstance(__UpperCAmelCase , __UpperCAmelCase ): lowercase : str = f'''Input value of [number={number}] must be an intege...
355
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a__ ( SCREAMING_SNAKE_CASE__, unittest.TestCase ): _l...
53
0
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""",...
58
from math import pi, sqrt, tan def lowerCamelCase_ ( UpperCamelCase__ : float ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * s...
90
0
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig snake_case__ = { """facebook/ma...
4
'''simple docstring''' import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline snake_case...
4
1
"""simple docstring""" def _A ( UpperCamelCase_ : Any) -> List[str]: '''simple docstring''' __lowercase ,__lowercase = [], [] while len(UpperCamelCase_) > 1: __lowercase ,__lowercase = min(UpperCamelCase_), max(UpperCamelCase_) start.append(Uppe...
17
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor UpperCAmelCase : Dict = logging.get_logger(__name__) class lowerCamelCase__ ( A ): """simple docstring""" def __init__( self ...
320
"""simple docstring""" from collections.abc import Sequence def lowerCamelCase ( _UpperCamelCase : Sequence[float] , _UpperCamelCase : float ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCamelCase ) ) def low...
320
1
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataStructureLi...
7
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say th...
218
0
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { '''configuration_trajectory_transformer''': [ '''TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP'''...
217
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class __...
217
1
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig A__ : List[str] ={ '''f...
70
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : List[Any] =logging.get_logger(__name__) a__ : List[Any] ={ '''BAAI/AltCLIP''': '''https://huggingface.co/BAAI/AltCLIP/resolve...
53
0
import heapq def lowerCAmelCase__ ( lowerCamelCase_ : dict): '''simple docstring''' lowerCAmelCase__ : list[list] = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a P...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
1
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig __snake_case ={ """facebook/maskfo...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
'''simple docstring''' def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' if b == 0: return 1 if (b % 2) == 0: return actual_power(__UpperCAmelCase , int(b / 2 ) ) * actual_power(__UpperCAmelCase , int(b / 2 ) ) else: ...
356
'''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 GenerationT...
135
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor __snake_case = logging.get_logger(__name__) class __lowerCamelCase ( a__ ): '''simple docstring''' def __init__( self , *__UpperCAmelCase , **__Upp...
320
"""simple docstring""" from __future__ import annotations def A_ ( _lowerCAmelCase : float, _lowerCAmelCase : float, _lowerCAmelCase : float, ): """simple docstring""" if (stress, tangential_force, area).count(0 ) != 1: raise ValueError('''You c...
320
1
"""simple docstring""" import os def lowerCamelCase (a_ :List[str]) -> int: lowercase :int = len(grid[0]) lowercase :Dict = len(a_) lowercase :List[str] = 0 lowercase :List[str] = 0 lowerc...
172
"""simple docstring""" def lowerCamelCase (a_ :list , a_ :list , a_ :int , a_ :int , a_ :int) -> int: if index == number_of_items: return 0 lowercase :Optional[int] = 0 lowercase :str = 0 lowercase ...
172
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel ...
217
"""simple docstring""" from __future__ import annotations def a__ ( __SCREAMING_SNAKE_CASE ) -> bool: __lowerCAmelCase: Tuple = str(__SCREAMING_SNAKE_CASE ) return len(__SCREAMING_SNAKE_CASE ) == 9 and set(__SCREAMING_SNAKE_CASE ) == set("123456789" ) ...
217
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDepende...
361
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers...
91
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging a_ = logging.get_logger(__name__) def __lowercase ( snake_case_ : Union[tf.Tensor, np.ndarray] ) ->Optional[int]: '''simple docstring''' ...
179
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : List[str] = { "google/pix2st...
93
0
"""simple docstring""" UpperCamelCase : Union[str, Any] = [ [0, 1_6, 1_3, 0, 0, 0], [0, 0, 1_0, 1_2, 0, 0], [0, 4, 0, 0, 1_4, 0], [0, 0, 9, 0, 0, 2_0], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def A ( snake_case :Dict , snake_case :Tuple , snake...
263
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def A ( snake_case :str , snake_case :str = "cpu" , snake_case :Union[str, None] = None ) -> None: __UpperCamelCase = torch.load(snake_case , map_location=snake_case ) ...
263
1
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> Dict: snake_case_ = len(UpperCAmelCase ) snake_case_ = sum(UpperCAmelCase ) snake_case_ = [[False for x in range(s + 1 )] for y in range(n + 1 )] for ...
69
"""simple docstring""" import re def lowercase_ ( _lowerCamelCase: str ) -> bool: '''simple docstring''' __lowerCamelCase : Union[str, Any] = re.compile( r"^(?:0|94|\+94|0{2}94)" r"7(0|1|2|4|5|6|7|8)" r"(-| |)" r"\d{7}$" ) ...
135
0
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMix...
367
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _UpperCAmelCase : Any = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig...
45
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int= logging.get_logger(__name__) _a : Optional[Any]= { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/reso...
172
"""simple docstring""" import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch...
172
1
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelera...
107
'''simple docstring''' __lowerCAmelCase = range(2, 20 + 1) __lowerCAmelCase = [10**k for k in range(ks[-1] + 1)] __lowerCAmelCase = {} def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCA...
107
1
import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax import jit from tra...
222
"""simple docstring""" import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
91
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowerCamelCase ( snake_case_ ): """simple docstring""" lowerCAmelCase__ = ["image_processor", "tokenizer"] lowerCAmelCase__ = ...
297
import inspect import unittest from transformers import DecisionTransformerConfig, 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_commo...
297
1
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _lowerCAmelCase :Tuple = ...
263
"""simple docstring""" from __future__ import annotations import math def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : bool , UpperCamelCase__ : list[int] , UpperCamelCase__ : float ): if depth < 0: ...
263
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common ...
350
'''simple docstring''' import pytest import datasets # Import fixture modules as plugins a : int = ['tests.fixtures.files', 'tests.fixtures.hub', 'tests.fixtures.fsspec'] def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase ) -> Tuple: '''simple docstring''' for it...
72
0
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datase...
38
"""simple docstring""" import math def lowercase ( lowerCAmelCase__ : list , lowerCAmelCase__ : int ) -> int: __a = len(lowerCAmelCase__ ) __a = int(math.floor(math.sqrt(lowerCAmelCase__ ) ) ) __a = 0 while arr...
45
0
'''simple docstring''' import argparse import importlib from pathlib import Path # Test all the extensions added in the setup lowerCAmelCase_ : List[Any] = [ 'kernels/rwkv/wkv_cuda.cu', 'kernels/rwkv/wkv_op.cpp', 'kernels/deformable_detr/ms_deform_attn.h', 'kernels/deformable_...
361
'''simple docstring''' import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin lowerCAmel...
346
0
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class snake_case__ (_UpperCamelCase ): """simple docstring""" def __init__( self : Dict , __lowerCa...
107
from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRUE_VALUES, FEATU...
107
1
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging snake_case_ ...
355
"""simple docstring""" import math def _lowerCAmelCase ( lowercase_ ): assert isinstance(lowercase_ , lowercase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
181
0
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( _A , _A , _A , _A , _A , ): a : List[str] = len(_A ) # If row is equal to the size of the board it means there are a queen in each row in # the current board (possible_boar...
297
'''simple docstring''' from __future__ import annotations import math class a__: def __init__( self : List[str] , __snake_case : int ): a : str = size # approximate the overall size of segment tree with given value a : Optional[i...
297
1
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase_ = logging.get_logger(__name__) class a_ ( _snake_case ): def __init__( self :Union[str, Any] , *_lowercase :str , **_...
368
import os import unicodedata 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 SPIECE_UNDERLINE, logging UpperCamelCase_ = logging.get_logger(__name__) Upp...
344
0
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( A_ , A_ , A_ , A_ ): lowerCAmelCase__ : int = [False] * len(A_ ) lowerCAmelCase__ : Union[str, Any] = [] queue.append(A_ ) lowerCAmelCase__ : str = True while queue: lowerCAmelCase__ : ...
106
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCAmelCase__ = logging.get_logger(__name__) # TODO: upload to AWS lowerCAmelCase__ = { '''yjernite/retribert-base-uncased''': ( '''https://huggingface.co/yjernite/re...
72
0
import argparse import json 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 a...
193
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
193
1
"""simple docstring""" _UpperCamelCase : Union[str, Any] = 8.3_1_4_4_5_9_8 def a_ ( _lowerCAmelCase : float , _lowerCAmelCase : float ): '''simple docstring''' if temperature < 0: raise Exception('Temperature cannot be less than 0 K' ) ...
77
'''simple docstring''' from timeit import timeit UpperCAmelCase_ = { 'MALAYALAM': True, 'String': False, 'rotor': True, 'level': True, 'A': True, 'BB': True, 'ABC': False, 'amanaplanacanalpanama': True, # "a man a plan a canal panama" } # Ensure our test data is valid ...
346
0
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _lowerCamelCase( unittest.TestCase ): def Upper...
84
from collections import defaultdict def UpperCamelCase_( lowerCamelCase_ ) -> int: _lowercase : Optional[Any] = 1 _lowercase : Union[str, Any] = True for v in tree[start]: if v not in visited: ret += dfs(lowerCamelCase_ ) if ret % 2 == ...
84
1
def UpperCAmelCase ( ) -> Tuple: """simple docstring""" for n in range(1 , 1_0_0_0_0_0_0 ): yield n * (n + 1) // 2 def UpperCAmelCase ( a_ ) -> List[Any]: """simple docstring""" __A = 1 __A = 2 while i * i <= n: __A ...
15
'''simple docstring''' import pprint import requests UpperCamelCase__ = '''https://zenquotes.io/api''' def a__ ( ) -> list: return requests.get(API_ENDPOINT_URL + '''/today''' ).json() def a__ ( ) -> list: return requests...
181
0
import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, req...
356
import requests _UpperCAmelCase : Union[str, Any] = """https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=""" def __lowerCamelCase ( UpperCamelCase__ ): '''simple docstring''' snake_case_ = requests.get(_NEWS_API + bbc_news_api_key ...
200
0
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class __A ( __A ): def __lt__( self : Any , UpperCAmelCase_ : Optional[int] ): return self[-1] < other[-1] def __...
138
'''simple docstring''' import datasets from .evaluate import evaluate UpperCamelCase__ : int = '\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev an...
344
0
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, prepare_image_inputs if is_torch_available(): im...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000000): '''simple docstring''' lowerCAmelCase__ : int = set(range(3 ,lowerCamelCase_ ,2)) primes.add(2) for p in range(3 ,lowerCamelCase_ ,2): if p not in primes: continue primes.differ...
94
1
import argparse import os # New Code # import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from ...
193
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer a__: Dict = logging.get_logger(__name__) ...
193
1
'''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.tes...
52
'''simple docstring''' import unittest from knapsack import greedy_knapsack as kp class lowercase_ (unittest.TestCase ): """simple docstring""" def SCREAMING_SNAKE_CASE ( self : Any ): __lowercase = [1_0, 2_0, 3_0, 4_0, 5_0, 6_0] __lowercase ...
52
1
"""simple docstring""" def _snake_case ( lowercase__ : dict ) -> set: '''simple docstring''' lowerCAmelCase_ :Any = set() # edges = list of graph's edges lowerCAmelCase_ :List[Any] = get_edges(lowercase__ ) # While there are st...
84
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, Trai...
84
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer lowercase__ = logging.ge...
356
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def UpperCamelCase( UpperCAmelCase_ , UpperCAm...
280
0
from __future__ import annotations import time import numpy as np __A = [8, 5, 9, 7] __A = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __A = [ [3, 2, 1, 4], [0, 2, 5, 2], [5, 1, 0, 5], [1, 5, 3...
90
'''simple docstring''' class lowercase__ : '''simple docstring''' def __init__( self , __snake_case = "" , __snake_case = False ): # Mapping from the first character of the prefix of the node _SCREAMING_SNAKE_CASE : dict[str, RadixNode] ...
200
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class UpperCamelCas...
360
'''simple docstring''' 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 impo...
345
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case : List[str] = { '''configuration_bigbird_pegasus''': [ '''BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BigBirdPegasusConfig''', '...
94
from maths.prime_factors import prime_factors def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): a :Dict = F'''Input value of [number={number}] must be an integer'''...
94
1
from __future__ import annotations from random import random class lowercase_ : def __init__( self : str , A__ : int | None = None ) -> Tuple: _snake_case = value _snake_case = random() _snake_case = None _s...
370
__A = { '''Pillow''': '''Pillow<10.0.0''', '''accelerate''': '''accelerate>=0.20.3''', '''av''': '''av==9.2.0''', '''beautifulsoup4''': '''beautifulsoup4''', '''black''': '''black~=23.1''', '''codecarbon''': '''codecarbon==1.2.0''', '''cookiecutter''': '''cookiecutter==1.7.3''',...
278
0
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_for...
52
import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets __lowerCamelCase : List[Any] = """ @inproceedings{xu-etal-2016-optimizing, title = {Optimizing Statistical Machine Translation for Text Simplification}, ...
52
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import ...
331
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase : List[Any] = logging.get_logger(__name__) # TODO: upload to AWS UpperCAmelCase : Optional[int] = { 'yjernite/retribert-base-uncased': ( 'https...
331
1
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 Conversation ...
65
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
280
0
import argparse import os import torch from transformers.utils import WEIGHTS_NAME __UpperCAmelCase = ['''small''', '''medium''', '''large'''] __UpperCAmelCase = '''lm_head.decoder.weight''' __UpperCAmelCase = '''lm_head.weight''' def __lowerCamelCase ( __magic_nam...
42
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__)...
42
1
"""simple docstring""" from __future__ import annotations def _SCREAMING_SNAKE_CASE ( __snake_case : list[int | float] , __snake_case : int , __snake_case : int ): '''simple docstring''' if len(_a ) == 0: raise ValueError('find_max() arg is an empty sequence...
220
from ..utils import DummyObject, requires_backends class _snake_case ( metaclass=__snake_case ): '''simple docstring''' A__ : Tuple = ["flax"] def __init__( self: str ,*lowerCamelCase_: int ,**lowerCamelCase_: List[str] ) -> str: requires...
345
0
'''simple docstring''' import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_su...
371
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_...
219
0
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def snake_case ( snake_case__...
180
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor _A = logging.get_logger(__name__) class A ( __UpperCAmelCase ): def __init__( self, *UpperCamelCase__, **UpperCamelCase__ ): """simple docstring""" warnings.warn...
278
0
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class A__ ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self: List[Any]) -> Dict: ...
368
"""simple docstring""" import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.nump...
58
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transf...
331
'''simple docstring''' import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand lowerCAmelCase :Tuple = ( '''4S 3H 2C 7S 5H''', '''9D 8H 2C 6S 7H''', '''2D 6D 9D TH 7D''', '''TC 8C 2S JH 6C''', '''JH 8S TH AH QH''', '...
331
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case_ = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''EncodecConfig''', ], '''feature_extraction_encod...
216
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .tokeniza...
216
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowercase : Any = { "configuration_layoutlmv2": ["LAYOUTLMV2_PRETRAINED_CON...
42
'''simple docstring''' import tensorflow as tf from ...tf_utils import shape_list class __UpperCAmelCase ( tf.keras.layers.Layer ): def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=1 , ...
42
1
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDA...
358
class __snake_case : def __init__( self ,snake_case ,snake_case=None ,snake_case=None ): '''simple docstring''' lowercase : Tuple = data lowercase : List[Any] = previous lowercase : List[str] = next_...
285
0
import operator as op def SCREAMING_SNAKE_CASE_ ( __magic_name__ : Tuple ) -> int: """simple docstring""" UpperCamelCase :Dict = [] UpperCamelCase :Union[str, Any] = lambda __magic_name__ , __magic_name__ : int(x / y ) # noqa: E731 inte...
38
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between c...
219
0
def __lowerCamelCase ( a_ : list ) -> list: if len(a_ ) < 2: return collection def circle_sort_util(a_ : list , a_ : int , a_ : int ) -> bool: __SCREAMING_SNAKE_CASE :List[Any] ...
367
"""simple docstring""" import math import unittest def __lowerCamelCase ( a_ : int ) -> bool: assert isinstance(a_ , a_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: ...
239
0
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path a : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) a : list[int] = [ord(letter) for l...
105
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerat...
58
0
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 __snake_case ( unittest.TestCase ): def lowerCamelCase ( self...
367
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def A (__A : BertModel , __A : str , __A : str ) -> int: """simple docstring""" UpperC...
7
0
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowercase__ =datasets.utils.logging.get_logger(__name__) class UpperCamelCase__ ( folder_based_builder.FolderBasedBuilderConfig ): _SCREAMING_SNAKE_...
216
from __future__ import annotations from typing import Any class UpperCamelCase__ : def __init__(self : Union[str, Any] , snake_case_ : int ): __a : Dict = num_of_nodes __a : list[list[int]] = [] __a : dict[int, int] = {} def lowerCAmelCase (self : ...
216
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ = logging.get_logger(__name__) snake_case__ = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/rwkv-4-430m-pile"""...
353
'''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_al...
4
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __magic_name__ ( metaclass=_UpperCamelCase ): lowerCAmelCase : str = ['note_seq'] def __init__( self : Tuple ,*_UpperCAmelCase : List[Any] ,**_UpperCAmelCase...
89
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration _UpperCAmelCase : Optional[int] = 5_0000 _UpperCAmelCase : Dict = 5000 _UpperCAmelCase , _UpperCAmelCase : Optional[int] = os.path.split(__fi...
285
0
import torch from torch import nn class snake_case_ ( nn.Module ): def __init__( self : List[Any] , _snake_case : int , _snake_case : Dict , _snake_case : Tuple , _snake_case : Optional[Any] , _snake_case : ...
232
from math import isqrt def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE :int ) -> list[int]: __lowerCAmelCase : Tuple = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , SCREAMING_SNAKE_CASE , SCR...
232
1
"""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 A_ (_UpperCAmelCase )...
61
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a = ...
271
"""simple docstring""" import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel a = logging.getLo...
271
1
"""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_feat...
54
def _snake_case( SCREAMING_SNAKE_CASE__ : Optional[Any] , SCREAMING_SNAKE_CASE__ : Union[str, Any] ) -> Tuple: '''simple docstring''' A__ = 0 A__ = len(SCREAMING_SNAKE_CASE__ ) - 1 while left <= right: ...
7
0
'''simple docstring''' import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_toke...
9
'''simple docstring''' 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 ( ...
9
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase (metaclass=__lowercase ): """simple docstring""" _UpperCAmelCase :Any = ['''keras_nlp'''] def __init__( self , *_UpperCAmelCase , **_UpperCAmelCase ): ...
177
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
0
"""simple docstring""" def _A (__a = 10_00 ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 2**power SCREAMING_SNAKE_CASE_ : List[str] = str(_UpperCAmelCase ) SCREAMING_SNAKE_CASE_ : Union[str, Any] = list(_Upp...
350
"""simple docstring""" from scipy.stats import pearsonr import datasets UpperCAmelCase_ : List[Any] = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculat...
318
0
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position lowercase : Optional[Any] = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < versi...
232
# XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path lowercase : Optional[int] = Path(__file__).resolve().parents[3] / 'src' sys.path.insert(1, str(git_repo_path)) import dataclasses # ...
232
1
"""simple docstring""" from __future__ import annotations import math import random from typing import Any class _A : def __init__( self ): """simple docstring""" lowercase = [] lowercase ...
366
"""simple docstring""" def UpperCAmelCase__ ( lowerCAmelCase__ :int ) -> int: '''simple docstring''' if not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): raise TypeError("""only integers accepted as input""" ) else: lowercase ...
32
0
'''simple docstring''' import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class UpperCAmelCase__ ( lowerc...
271
'''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__) __lowerCAmel...
271
1
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json" ), } ...
360
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } class a_ ( _snake_case ): ...
344
0
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
9
from __future__ import annotations import bisect def _UpperCamelCase ( lowercase__ , lowercase__ , lowercase__ = 0 , lowercase__ = -1 ): if hi < 0: __SCREAMING_SNAKE_CASE : Union[str, Any] = len(lowercase__ ) while lo < ...
9
1
"""simple docstring""" import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffu...
254
"""simple docstring""" import inspect import os import re from transformers.configuration_utils import PretrainedConfig 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_c...
254
1
def _a ( a :int ) -> list[int]: if num <= 0: raise ValueError('''Input must be a positive integer''' ) a = [True] * (num + 1) a = 2 while p * p <= num: if primes[p]: for i in range(p * p , num + 1 , a ): a = False p ...
0
'''simple docstring''' from __future__ import annotations import os from typing import Any import requests __lowercase : Optional[Any] = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user __lowercase : Any = ...
318
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE_: str =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: List[Any] ={ ...
365
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : Any , snake_case_ : int ) -> Optional[Any]: '''simple docstring''' UpperCAmelCase_ = 0 if s...
106
0
def _lowerCAmelCase ( __lowerCAmelCase ) -> list: """simple docstring""" if len(__A ) <= 1: return lst snake_case__ : List[Any] = 1 while i < len(__A ): if lst[i - 1] <= lst[i]: i += 1 else: ...
230
import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig UpperCAmelCase_ : Optional[Any] = logging.get_logger(__name__) UpperCAmelCase_ : str ...
32
0
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase( __a ): '''simple docstring''' lowercase__ = (EulerDiscreteS...
132
"""simple docstring""" from collections.abc import Generator from math import sin def UpperCAmelCase__ (snake_case__ : bytes ): """simple docstring""" if len(snake_case__ ) != 32: raise ValueError("""Input must be of length 32""" ) _snake_case : Optional[int] ...
132
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> int: assert column_title.isupper() lowerCamelCase__ : Dict = 0 lowerCamelCase__ : str = len(UpperCamelCase ) - 1 lowerCamelCa...
41
"""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 __SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) __SCREAMI...
347
0
def lowerCAmelCase__ ( _a : Optional[Any] , _a : List[Any] , _a : List[Any] , _a : Any ): if height >= 1: move_tower(height - 1 , _a , _a , _a ) move_disk(_a , _a ) move_tower(height - 1 , _a , _a , _a ...
368
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCAmelCase__ ( _a : str ): snake_case_ : str = FileLock(str(tmpdir / "foo.lock" ) ) snake_case_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock" ...
36
0
'''simple docstring''' 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, ) ...
254
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase = { '''configuration_trajectory_transformer''': [ '''TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Tr...
254
1
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset fro...
355
'''simple docstring''' from collections.abc import Iterable from typing import Any class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase = None): '''simple docstring''' __A : str = value __A ...
190
0
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleCh...
34
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import...
106
0
'''simple docstring''' from bisect import bisect from itertools import accumulate def A_( A : Optional[Any] , A : Optional[Any] , A : List[Any] , A : Union[str, Any]): UpperCamelCase = sorted(zip(A , A) , ...
356
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_...
251
0
"""simple docstring""" def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->Dict: """simple docstring""" lowerCAmelCase__ :list[list[str]] = [[] for _ in range(_a )] lowerCAmelCase__ :Optional[Any] = key - 1 if key <= 0: raise Val...
293
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], } try: if not ...
131
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCRE...
76
"""simple docstring""" import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def _snake_case ( UpperCamelCase : np.ndarray ): return input_array.reshape((input_array.size, 1) ) def _snake_cas...
76
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCamelCase_ = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], } try: ...
268
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import BitConfig, ...
36
0
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( _a ): """simple docstring""" a_ = (PNDMScheduler,) a_ = (("""num_inference_...
368
from datetime import datetime import matplotlib.pyplot as plt import torch def SCREAMING_SNAKE_CASE ( snake_case_ : int ): for param in module.parameters(): snake_case__ : Tuple = False def SCREAMING_SNAKE_CASE ( ): snake_case__ : Any = "...
286
0
'''simple docstring''' import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem fro...
55
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers imp...
190
0
from __future__ import annotations def UpperCamelCase ( __lowercase : Dict ,__lowercase : Dict ): '''simple docstring''' A_ : Union[str, Any] = 0 A_ : Union[str, Any] = len(__snake_case ) - 1 while i < j: if nums[i...
362
from __future__ import annotations import requests _UpperCAmelCase = set( """approved_at_utc approved_by author_flair_background_color author_flair_css_class author_flair_richtext author_flair_template_id author_fullname author_premium can_mod_post category clicked content_categories created_utc ...
192
0
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPip...
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""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __a ( snake_case__ ): """simple docstring""" SCREAMING_SNAKE_CASE_ = ['image_processor', 'tokenizer'] SCREAMING_SNAKE_CASE_ ...
157
"""simple docstring""" from __future__ import annotations import math def _lowerCAmelCase ( UpperCAmelCase : int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
157
1
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( __A ): '''simple docstring''' lowerCamelCase__ =(UnCLIPScheduler,) def __UpperCamelCase ( self : List[str] , **a ...
76
def lowerCamelCase__ ( _a , _a): _validate_point(_a) _validate_point(_a) if len(_a) != len(_a): raise ValueError("Both points must be in the same n-dimensional space") return float(sum(abs(a - b) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a): if point: if...
76
1
'''simple docstring''' def a_ ( _UpperCAmelCase : int ) -> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) __snake_case : Tuple = [True] * (num + 1) __snake_case : Tuple = 2 while p * p <=...
0
'''simple docstring''' from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, requi...
0
1