code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor _A = logging.get_logger(__name__) class lowerCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__(self , *_lowerCamelCase , **_l...
171
"""simple docstring""" from __future__ import annotations def a__ ( lowerCAmelCase , lowerCAmelCase = None , lowerCAmelCase = None ) -> None: if start is None: UpperCAmelCase__ : Dict = 0 if end is None: UpperCAmelCase__ :...
171
1
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.training.common_utils impo...
105
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration __lowercase = { '''tiny.en''': '''https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32accea0...
105
1
"""simple docstring""" import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_a...
72
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class _UpperCamelCase ( lowerCAmelCase ): UpperCAme...
169
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.rob...
277
import inspect import unittest from transformers import ConvNextConfig 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_backbone_common import BackboneTesterMixin from ...te...
277
1
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class lowercase ( A__ ): """simple docstring""" _a = (DDPMScheduler,) def lowerCAmelCase__ ( self , **UpperCamelCase_ ): '''simple docs...
97
"""simple docstring""" import argparse import collections import json import os import re import string import sys import numpy as np _UpperCamelCase : Any = re.compile(r"\b(a|an|the)\b", re.UNICODE) _UpperCamelCase : Union[str, Any] = None def a_ ( ): ...
77
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __lowerCamelCase : Dict = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass el...
140
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) class A__ ( __snake_case ): _UpperCAmelCase :List[Any] = 'timm_backbone' def __init__( self , A_=None , ...
140
1
def _UpperCAmelCase ( snake_case , snake_case ): """simple docstring""" _lowerCAmelCase = [1] for i in range(2 , snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" _lowerCAmelCase ...
82
"""simple docstring""" def UpperCAmelCase__ (snake_case__ : list ): """simple docstring""" if len(snake_case__ ) <= 1: return [tuple(snake_case__ )] _snake_case : List[Any] = [] def generate(snake_case__ : int , snake_case__...
64
0
'''simple docstring''' def __snake_case( _lowerCAmelCase ) -> Optional[Any]: if any(not isinstance(_UpperCAmelCase , _UpperCAmelCase ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in range(len(_Upper...
365
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils im...
43
0
'''simple docstring''' from timeit import timeit def __UpperCAmelCase ( a_: List[Any] ): if number < 0: raise ValueError("the value of input must not be negative" ) _UpperCAmelCase : str = 0 while number: number &= number - 1 result += ...
145
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): '''simple docstring''' __UpperCamel...
43
0
'''simple docstring''' from importlib import import_module from .logging import get_logger A__ : Dict = get_logger(__name__) class snake_case__ : def __init__( self : Union[str, Any] , __a : int , __a : Tuple=None ) -> int: '''simpl...
367
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer A__ : Union[str, Any] = {'''vocab_file''': '''vocab.txt''', '''tokeni...
0
0
def a__ ( snake_case ): """simple docstring""" __SCREAMING_SNAKE_CASE : Dict = len(snake_case ) for i in range(length - 1 ): __SCREAMING_SNAKE_CASE : Union[str, Any] = i for k in range(i + 1 , snake_case ): if collection[k] < collection[least]: ...
303
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase : Dict = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']} try...
18
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : str = ...
213
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE : str = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def UpperCAmelCase__ (UpperCamelCase_ = "mumbai" ): ...
213
1
import os snake_case__ : Any = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} def _a ( lowerCamelCase: str ) -> int: '''simple docstring''' __A = 0 __A = 0 while i...
117
import argparse import copy def _a ( lowerCamelCase: List[Any] ) -> List[str]: '''simple docstring''' __A = {} with open(lowerCamelCase ) as f: for line in f: if line.split()[0] not in dict_of_neig...
117
1
"""simple docstring""" from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class _UpperCAmelCase ( lowerCAmelCase__): def __init__( self : ...
155
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
155
1
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_available ...
252
"""simple docstring""" import argparse lowerCAmelCase__ : List[str] = 'docs/source/_static/js/custom.js' def a_ ( lowerCamelCase ): with open(lowerCamelCase , encoding='utf-8' , newline='\n' ) as f: UpperCAmelCase__ = f.readlines() ...
98
0
'''simple docstring''' import sys A__ : Any =( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693...
220
'''simple docstring''' def UpperCamelCase__ ( lowerCAmelCase , lowerCAmelCase ): """simple docstring""" if len(lowerCAmelCase ) != len(lowerCAmelCase ): raise ValueError("""String lengths must match!""" ) _lowerCAmelCase...
220
1
def UpperCamelCase ( snake_case__ : list , snake_case__ : int , snake_case__ : int = 0 , snake_case__ : int = 0 ) -> int: UpperCamelCase : Dict = right or len(snake_case__ ) - 1 if left > right: return -1 elif list_da...
119
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Effic...
119
1
"""simple docstring""" import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, ...
350
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node UpperCamelCase = 4 UpperCamelCase = 3 class snake_case_ ( __A ): pass ...
333
0
'''simple docstring''' import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate ...
34
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
0
import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import GradientAccumulator, create_op...
370
from math import sqrt def __lowerCamelCase ( UpperCamelCase__ ): '''simple docstring''' snake_case_ = 0 for i in range(1 , int(sqrt(UpperCamelCase__ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase__ ): ...
200
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 from ...test_configuration_common import ConfigTester from ...test_modelin...
33
"""simple docstring""" from __future__ import annotations __A : List[Any] = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] __A : str = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def lowercase ( __snake_case : list[floa...
33
1
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _lowerCamelCase = logging.get_logger(__name__) def a__ ( _SCREAMING_SNAKE_CASE : Dict ) -...
67
'''simple docstring''' import os from pathlib import Path def a__ ( ) -> Union[str, Any]: """simple docstring""" from torch.utils.cpp_extension import load UpperCAmelCase_ : Union[str, Any] = Path(_SCREAMING_SNAKE_CASE ).resolve().parent.parent....
67
1
import baseaa def SCREAMING_SNAKE_CASE__ ( __a ): return baseaa.aaaencode(string.encode('utf-8' ) ) def SCREAMING_SNAKE_CASE__ ( __a ): return baseaa.aaadecode(__a ).decode('utf-8' ) if __name__ == "__main__": import doctest ...
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
1
'''simple docstring''' lowerCAmelCase__ = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git ''' lowerC...
352
'''simple docstring''' import math def _A ( A__ = 100 ): """simple docstring""" __lowercase = sum(i * i for i in range(1 , n + 1 ) ) __lowercase = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) return square_of_sum - sum_of_squar...
52
0
import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoMod...
29
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer UpperCAmelCase__ = {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"} ...
0
0
"""simple docstring""" import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging a_ = logging.get_logger(__name__) def __lowercase ( lowerCamelCase : Tuple , lowerCame...
361
from timeit import timeit a_ = { '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 assert all((key == key[::-1]) is value for key, va...
50
0
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_config_docstrings.py lowercase__ ...
101
import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, requ...
207
0
def lowerCAmelCase_ (lowerCAmelCase__: int ): """simple docstring""" return str(lowerCAmelCase__ ) == str(lowerCAmelCase__ )[::-1] def lowerCAmelCase_ (lowerCAmelCase__: int ): """simple docstring""" ret...
82
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
82
1
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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_a...
193
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase__( UpperCamelCase__ : Any , UpperCamelCase__ : int , UpperCamel...
193
1
# Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version lo...
356
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger lowerCAmelCase = '<<<<<<< This should probably be modified because it mentions: ' lowerCAmelCase = '=======...
93
0
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class a ( a_ ): UpperCAmelCase_ : List[Any] =(EulerDiscreteScheduler,) UpperCAmelCase_ : Optional[Any]...
220
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class a ( a_ ): def __init__( self , _lowerCamelCase , _lowerCamelCase=None , _lower...
220
1
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch SCREAMING_SNAKE_CASE : Union[str, Any] = '''sshleifer/bart...
358
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Dict = {name: getattr(transform...
84
0
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version A : str = { '''<''': operator.lt, '''<=''': operator.le, '''==''': operator.eq, '''!=''': operator.ne, '''>=''': operator.ge, '''>'''...
274
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from tra...
274
1
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration SCREAMING_SNAKE_CASE_: List[str] =HfArgumentParser(InitializationArguments) SCREAMING_SNAKE_CASE_: int =parser.parse_args() #...
106
'''simple docstring''' import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditiona...
106
1
from abc import ABC, abstractmethod from typing import List, Optional class __lowercase (_snake_case ): def __init__( self ) ->Optional[int]: '''simple docstring''' self.test() def UpperCamelCase__ ( self ) ->Optional[Any]: '''simple docstr...
275
'''simple docstring''' import unittest from knapsack import greedy_knapsack as kp class lowercase__ ( unittest.TestCase ): '''simple docstring''' def UpperCAmelCase_ ( self ): _SCREAMING_SNAKE_CASE : str = [10, 20, 30, 40, 50, 60] ...
200
0
from math import sqrt def lowerCAmelCase_ ( _snake_case : int = 1000000 ) -> int: '''simple docstring''' __magic_name__ : str = 0 __magic_name__ : Union[str, Any] = 0 __magic_name__ : Optional[Any] = 42 while num_cuboids <= li...
359
import numpy class _snake_case : def __init__( self , _a , _a ): __magic_name__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is the #...
41
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : Dict ={ """configuration_git""": ["""GIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GitConfig""", """GitVisionConfig"""], """processing_git""": ["""GitProcessor"""], } t...
262
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowerc...
262
1
import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerForObjectDe...
359
from abc import ABC, abstractmethod from typing import List, Optional class _a ( UpperCamelCase__ ): def __init__( self: Optional[int] ) -> Union[str, Any]: """simple docstring""" self.test() def ...
93
0
import os def A_ ( ) -> int: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : O...
52
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''microsoft/unispeech-large-1500h-cv''': ( '''https://huggingface.c...
72
0
"""simple docstring""" import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a : Tuple = { """facebook/mask2former-swin-small-coco-instance""": ( """https://huggingface...
352
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def lowercase__(A="ro" , A="en" , A="wmt16" , A=None ) ->None: """simple docstring""" try: import datasets except (ModuleNotFound...
150
0
import unittest import numpy as np from transformers import MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING, TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING from transformers.pipelines import AudioClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, ...
5
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar SCREAMING_SNAKE_CASE_:List[Any] = TypeVar("""KEY""") SCREAMING_SNAKE_CASE_:Dict = TypeVar("""VAL""") @dataclass(frozen=SCREAMING_SNAKE_CASE__ , slo...
116
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available f...
369
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
188
0
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import to...
82
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class __lowerCAmelCase ( lowerCamelCase__ ): # to overwrite at feature extractactor specifi...
82
1
"""simple docstring""" import doctest from collections import deque import numpy as np class __lowerCAmelCase : '''simple docstring''' def __init__( self ): __a = [2, 1, 2, -1] __a = [1, 2, 3, 4] def __UpperCAmelCase ( self...
11
"""simple docstring""" from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowerCAmelCase ( __SCREAMING_SNAKE_CASE ): ...
11
1
"""simple docstring""" import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ....
84
"""simple docstring""" __UpperCamelCase = 0 # The first color of the flag. __UpperCamelCase = 1 # The second color of the flag. __UpperCamelCase = 2 # The third color of the flag. __UpperCamelCase = (red, white, blue) def lowercase (SCREAMING_SNAKE...
113
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase_ ( a__ ): @staticmethod @abstractmethod def snake_case_ ( SCREAMING_SNAKE_CASE_ ) -> int: raise NotImplementedError() @abstractmethod def snake...
371
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --host <host> --key...
103
0
"""simple docstring""" def lowerCamelCase ( _UpperCamelCase : int = 4_0_0_0_0_0_0 ) -> int: '''simple docstring''' __UpperCAmelCase : int = [0, 1] __UpperCAmelCase : Optional[Any] = 0 while fib[i] <=...
115
"""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()): raise OptionalDependencyNotAvailable() except Option...
115
1
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepI...
350
"""simple docstring""" import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCase ( a ,unittest.TestCase ): '''simple docstring'''...
68
0
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ =...
79
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets lowerCamelCase_ = datasets.logging.get_logger(__name__) lowerCamelCase_ = '''\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C an...
79
1
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ....
362
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
292
0
"""simple docstring""" import pytest _snake_case = '__dummy_dataset1__' _snake_case = '\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/"\nURLS = {"train": REPO_URL + "wikiann-bn...
294
"""simple docstring""" import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _snake_case = logging.get_logger(__name__) class UpperCamelCase ( snake_case_ ): def __init__( self : Any ...
294
1
# 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 appli...
300
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _snake_case = logging.get_logger(__name__) class UpperCAmelCase_ ( a): def __init__( self, *__a, **__a): '''simple docstring''' warnings....
300
1
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInve...
198
lowerCamelCase : 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 import s...
233
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import DebertaVaConfig, 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,...
107
'''simple docstring''' from __future__ import annotations import collections import pprint from pathlib import Path def __lowerCamelCase ( lowerCAmelCase_ ) -> str: return "".join(sorted(lowerCAmelCase_ ) ) def __lowerCamelCase ( lowerCAmelCase_ ) -> list[str]: ...
107
1
'''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 __lowerCAmelCase (lowercase_ ...
2
"""simple docstring""" import os import numpy import onnx def a_ ( lowerCamelCase , lowerCamelCase ): UpperCAmelCase__ = a.name UpperCAmelCase__ = b.name UpperCAmelCase__ = '' UpperCAmelCase__ = '' ...
98
0
class A__ ( snake_case__ ): """simple docstring""" pass class A__ ( snake_case__ ): """simple docstring""" pass class A__ : """simple docstring""" def __init__( self ): snake_case ...
213
import math class A__ : """simple docstring""" def a_ ( self , __snake_case , __snake_case ): snake_case = 0.0 snake_case = 0.0 for i in range(len(__snake_case ) ): da += math.pow((sample[i] - weights[...
213
1
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.u...
154
def __UpperCamelCase ( _A : Dict ) ->List[str]: """simple docstring""" lowerCamelCase_ =[0] * len(_A ) lowerCamelCase_ =[] lowerCamelCase_ =[] lowerCamelCase_ =0 for values in graph.values(): for i in ...
154
1
import datasets from .evaluate import evaluate _UpperCAmelCase = '\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang},\n booktitle={EMNLP},\n year={2016}\n}\n'...
328
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _UpperCAmelCase = transforms.Comp...
328
1
import doctest from collections import deque import numpy as np class lowerCAmelCase__ : '''simple docstring''' def __init__( self) -> None: _A : Tuple = [2, 1, 2, -1] _A : Dict = [1, 2, 3, 4] def _lowerC...
11
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'vocab_file': 'vocab.json', 'tokenizer_config_file': 'tokenizer_confi...
11
1
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def UpperCamelCase_ ( lowerCAmelCase__ : int ): """simple docstring""" lowerCAmelCase_ : int = int(number**0.5 ) ...
371
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar lowercase__ : Any = TypeVar("""_T""") class UpperCamelCase__ ( Generic[_T] ): """simple docstring""" def __init__( self ...
289
0
import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_imag...
259
from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) A__ : int = { '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json''', } class __snake_ca...
103
0
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils import logging...
354
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin _lowerCamelCase : str = "\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenag...
159
0
from __future__ import annotations def UpperCamelCase( __UpperCamelCase : str ): return [ord(__UpperCamelCase ) - 96 for elem in plain] def UpperCamelCase( __UpperCamelCase : list[int] ): return "".join(chr(elem + 96 ) for elem in encoded ) def UpperCamelCase( ): lowerCAmelCase...
103
import unittest from transformers import MPNetConfig, 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, ids_tensor, random_attention_mask from ...test_pipeline_mixi...
103
1
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def __SCREAMING_SNAKE_CASE ( lowerCAmel...
358
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class a ( UpperCAmelCase ): _lowercase = ["image_proc...
189
0
from __future__ import annotations def _UpperCAmelCase ( snake_case , snake_case ): """simple docstring""" if b == 0: return (1, 0) ((_lowerCAmelCase) , (_lowerCAmelCase)) = extended_euclid(snake_case , a % b ) _lowerCAmelCase = a // b ...
82
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_flax import FlaxTimestepEmbedding, ...
209
0
'''simple docstring''' def __UpperCamelCase ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase ): return round(float(moles / volume ) * nfactor ) def __UpperCamelCase ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase ): return round(float((moles * 0.0_821 * temperat...
37
'''simple docstring''' import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorc...
37
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : List[str] , _lowerCAmelCase : str ) -> List[str]: global f # a global dp table for knapsack if f[i][j] < 0: ...
23
from __future__ import annotations from typing import Any def lowercase_ ( _A : list[Any] ): """simple docstring""" create_state_space_tree(_A , [] , 0 ) def lowercase_ ( _A : list[Any] , _A : list[Any] , _A : ...
184
0
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...sch...
365
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
100
0
"""simple docstring""" from collections.abc import Callable import numpy as np def _snake_case ( UpperCamelCase : Callable , UpperCamelCase : float , UpperCamelCase : float , UpperCamelCase : float , UpperCamelCase : float ): UpperCAmelCase : Any...
109
"""simple docstring""" import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def _snake_case ( *UpperCamelCase : str , UpperCamelCase : Optional[Union[Dict, Any]] = None , UpperCamelCase : Tuple=True , UpperCamelCase ...
109
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __UpperCAmelCase : Optional[int] = logging.get_logger(__name__) __UpperCAmelCase : List[str] = { "...
361
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def a ( SCREAMING_SNAKE_CASE_ : dict ): ...
315
0
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { "facebook/encodec_24khz": "https://huggingface.co/facebook/encodec_24khz/resolve/main...
299
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_p...
322
0
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent __UpperCamelCase = {'UserAgent': UserAgent().random} def lowercase (SCREAMING_SNAKE_CASE_ : Optional[int] ) -> Any: SCREAMING_SNA...
365
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> bool: SCREAMING_SNAKE_CASE = int(number**0.5 ) return number == sq * sq def ...
38
0
"""simple docstring""" 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 ...
46
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType S...
46
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _snake_case = { 'configuration_conditional_detr': [ 'CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP',...
324
"""simple docstring""" from __future__ import annotations import time _snake_case = list[tuple[int, int]] _snake_case = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1...
324
1
from math import isclose, sqrt def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> tuple[float, float, float]: __lowerCamelCase : Tuple = point_y / 4 / point_x __lowerCamelCase : Tuple = 2 * normal_gradient / (1...
73
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class __magic_name__ ( _UpperCamelCase ): @require_torch def __lowercase ( ...
89
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = { "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json", "goog...
154
"""simple docstring""" from collections import namedtuple __lowerCamelCase = namedtuple("from_to", "from_ to") __lowerCamelCase = { "cubicmeter": from_to(1, 1), "litre": from_to(0.0_0_1, 10_00), "kilolitre": from_to(1, 1), "gallon": from_to(0.0_0_4_5_4, 2_6_4...
154
1
'''simple docstring''' import os def _lowerCAmelCase ( _UpperCamelCase : Union[str, Any] ) -> Optional[Any]: """simple docstring""" _SCREAMING_SNAKE_CASE =len(grid[0] ) _SCREAMING_SNAKE_CASE =len(_UpperCamelCase ) _SCREAMING_SNAKE...
47
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( _lowerCamelCase: list[int] , _lowerCamelCase: list[int] , _lowerCamelCase: int ): __SCREAMING_SNAKE_CASE : List[Any] = list(range(len(_lowerCamelCase ) ) ) __...
112
0
def lowerCAmelCase_ ( snake_case_ = 1000 ): _A : List[Any] = 3 _A : Tuple = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a a += 1 ...
343
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( ...
343
1
'''simple docstring''' from __future__ import annotations class a__ : def __init__( self : List[Any] , a : Tuple ): """simple docstring""" __lowerCamelCase = order # a_{0} ... a_{k} __lowerCamelCase = [1.0] + [0.0] * order ...
67
"""simple docstring""" import json import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImagePr...
301
0
"""simple docstring""" import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness lowercase__ = '\\n@misc{chen2021evaluating,\n title={Evaluat...
359
"""simple docstring""" import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForCo...
161
0
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class UpperCamelCase__( __A ...
221
"""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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension,...
221
1
"""simple docstring""" from manim import * class A_ (lowercase__ ): '''simple docstring''' def UpperCamelCase__ ( self ): """simple docstring""" UpperCAmelCase_ : List[str] = Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase_ : List[Any] = ...
352
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _a = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try...
23
0
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class a ( unittest.TestCase ...
335
"""simple docstring""" import math class a : """simple docstring""" def __init__( self: List[Any] , UpperCamelCase: List[str]=0 ): # a graph with Node 0,1,...,N-1 """simple docstring""" A__ = n A__...
335
1
import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py lowerCamelCase__ = '''src/diff...
356
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, FlaxMTaFo...
63
0
from typing import Any class SCREAMING_SNAKE_CASE_ : def __init__( self : Any , lowerCamelCase_ : Any ): """simple docstring""" UpperCamelCase = data UpperCamelCase = None class SCREAMING_SNAKE_CASE_ : def __init__( self : O...
343
"""simple docstring""" import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops ...
224
0
from __future__ import annotations _UpperCAmelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE :list[list[int]] , SCREAMING_SNAKE_CASE :list[int] , SCREAMING_SNAKE_CASE :list[int]...
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 unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _UpperCamelCase : Optional[int] = False class a ( unittest...
220
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( __snake_case : int ): '''simple docstring''' return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number...
220
1
"""simple docstring""" # 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...
318
"""simple docstring""" 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.d...
318
1
'''simple docstring''' import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class A_ : @property def lowercase ( self :...
22
'''simple docstring''' 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, ...
324
0
import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput UpperCamelCase__ : int = """scheduler_config.json""" ...
330
def SCREAMING_SNAKE_CASE__ ( snake_case_ ) -> Union[str, Any]: """simple docstring""" stooge(snake_case_, 0, len(snake_case_ ) - 1 ) return arr def SCREAMING_SNAKE_CASE__ ( snake_case_, snake_case_, snake_case_ ) -> ...
330
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ = { '''configuration_longformer''': [ '''LONGFORMER_PRE...
79
"""simple docstring""" def lowercase ( _SCREAMING_SNAKE_CASE : list ): '''simple docstring''' if len(_SCREAMING_SNAKE_CASE ) <= 1: return lst _UpperCAmelCase = 1 while i < len(_SCREAMING_SNAKE_CASE ): if lst[i - 1] <= lst...
260
0
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTe...
222
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'vocab_file': 'vocab.json', 'merg...
222
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCAmelCase ) class _UpperCamelCase ( lowerCAmelCase ): UpperCAmelCase_ = field(default="""au...
169
from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): import torch from ..m...
169
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) a_ = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP', ...
365
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _lowercase ( unittest.TestCase ): def SCREAMING_SNAKE_CASE__ ( self : List[str] ) -> Optional[Any]: """simple docstring"...
50
0
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin Uppe...
345
def __lowercase ( __lowerCAmelCase : int , __lowerCAmelCase : float , __lowerCAmelCase : float ): return round(float(moles / volume ) * nfactor ) def __lowercase ( __lowerCAmelCase : float , __lowerCAmelCase : floa...
240
0
from __future__ import annotations from collections import deque class lowerCamelCase_ : def __init__( self : List[str] ,__lowerCamelCase : list[str] ): '''simple docstring''' a = [] self.adlist.append( ...
353
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() UpperCamelCase__ : Optional[int] = logging.get_logger(__name__) UpperCamelCase__ : str = { ...
330
0
def snake_case__ ( lowerCAmelCase_, lowerCAmelCase_, lowerCAmelCase_, lowerCAmelCase_ ): """simple docstring""" global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: SCREAMING_SNAKE_CASE =mf_knapsack(i - 1, _lo...
334
'''simple docstring''' import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" lowerCamelCase__ = """MCTCTFeatureExtractor""" lowerCame...
23
0
from itertools import product def __lowercase ( lowerCamelCase : Optional[Any] , lowerCamelCase : Union[str, Any] ): UpperCamelCase_ : Union[str, Any] = sides_number UpperCamelCase_ : Union[str, Any] = max_face_number * dice_number UpperCamelCase_ : Tuple = [0]...
359
from manim import * class _lowercase ( snake_case_ ): def SCREAMING_SNAKE_CASE__ ( self : Optional[Any] ) -> Any: """simple docstring""" UpperCamelCase_ : str = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_ : Optional[Any] ...
50
0
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase ): '''simple docstring''' def __init__( self : Optional[Any] , lowercase : Dict ,...
282
from collections.abc import Sequence def a_ ( __lowercase : Sequence[float] , __lowercase : float ) -> float: return sum(c * (x**i) for i, c in enumerate(__lowercase ) ) def a_ ( __lowercase : Sequence[float] , __lowercase : float ) -> float: ...
282
1
"""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_tensor, rand...
356
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a__ : List[str] = { '''configuration_biogpt''': ['''BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BioGptConfig'''],...
195
0