code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import copy import re class snake_case_ : __lowerCAmelCase = "hp" __lowerCAmelCase = {} __lowerCAmelCase = None @classmethod def snake_case_ ( cls , a_ , a_ ): a_ :...
237
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE_ = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """tokenization_ctrl...
237
1
from __future__ import annotations from typing import Generic, TypeVar lowercase : List[str] = TypeVar("""T""") class A__ ( Generic[T] ): """simple docstring""" def __init__( self , lowercase) -> None: '''simple docstring''' ...
710
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 lowercase : Any = logging.get_logger(__name__) def A_ ( A__ , A__ ) -> List[Any]: a__ : List[str]...
392
0
'''simple docstring''' import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from t...
24
"""simple docstring""" from __future__ import annotations import os from collections.abc import Mapping __UpperCamelCase : Optional[Any] = tuple[int, int] class a : def __init__( self , _snake_case , _snake_case ): """simple docstri...
4
0
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 snake_case__ (__UpperCAmelCase ): """simple d...
717
from typing import TYPE_CHECKING from ....utils import _LazyModule __lowerCAmelCase : int = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys __lowerCAmelCase : Tuple = _LazyModule(__name__, globals()['__fi...
662
0
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class lowerCamelCase__ ( _A): """simple docstring""" a_...
2
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/facebook/dpr...
596
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available SCREAMING_SNAKE_CASE_ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable...
714
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.jso...
116
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case__ : Tuple = { 'configuration_albert': ['A...
278
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, TrainingJobAnalytics ...
67
0
'''simple docstring''' import argparse import os import re import packaging.version __lowerCamelCase = """examples/""" __lowerCamelCase = { """examples""": (re.compile(r'''^check_min_version\(\"[^\"]+\"\)\s*$''', re.MULTILINE), """check_min_version(\"VERSION\")\n"""), """init""...
701
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def UpperCAmelCase__ ( UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAm...
667
0
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class lowerCAmelCase_ ( __magic_name__ ): __lowerCamelCas...
18
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class lowerCAmelCase_ ( __magic_name__ ): __lowerCam...
18
1
"""simple docstring""" import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _a = get_tests_dir("""fixtures/test_sen...
716
"""simple docstring""" import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class _UpperCAmelCase(...
78
0
"""simple docstring""" from __future__ import annotations def a ( __UpperCAmelCase : int | str ) -> bool: __magic_name__: List[str] = str(__UpperCAmelCase ) return n == n[::-1] def a ( __UpperCAmelCase : int = ...
96
from __future__ import annotations from collections.abc import MutableSequence class _A : def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): """simple docstring""" if len(_SCREAMING_SNAKE_CASE ) != degree + 1: raise V...
511
0
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A : int = {"""configuration_mra""": ["""MRA_PRETRAINED_CONFIG_ARCHIVE_MAP""", "...
701
'''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 lowercase ( _lowerCa...
187
0
from maths.prime_factors import prime_factors def snake_case ( lowerCamelCase ): '''simple docstring''' if not isinstance(lowercase__ , lowercase__ ): __lowercase = F'Input value of [number={number}] must be an integer' raise TypeError(lowercase__ ) if ...
80
import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMi...
600
0
'''simple docstring''' import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import Fla...
30
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=_UpperCAmelCase) class __magic_name__ ( _UpperCAmelCase): UpperCamelCase__ = fiel...
30
1
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class lowerCAmelCase_ : lowerCamelCase_ = 42 # [batch_size x 3] lowerCamelCase_ = 42 # [batch_size x 3] lowerCamelCase_ = 42 # [batch_size x 3] lowerCamelCase_ =...
395
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/c...
502
0
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered # since ...
720
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : List[Any] = logging.get_logger(__name__) snake_case_ : Dict = { "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json", #...
253
0
import os def UpperCamelCase__ ( ): '''simple docstring''' __lowerCamelCase = os.path.dirname(os.path.realpath(_A ) ) __lowerCamelCase = os.path.join(_A , """triangle.txt""" ) with open(_A ) as f: __lowerCamelCa...
479
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 _a : ...
479
1
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": _lowercase = argparse.ArgumentParser() parser.add_argument("""--dump_path""", default=None, ty...
427
'''simple docstring''' import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state...
427
1
# using dfs for finding eulerian path traversal def _lowerCAmelCase ( lowerCAmelCase_ :Optional[Any] , lowerCAmelCase_ :Dict , lowerCAmelCase_ :Union[str, Any] , lowerCAmelCase_ :Dict=None )->Optional[int]: '''simple docstring''' snake_case_ ...
283
def _lowerCAmelCase ( lowerCAmelCase_ :List[str] , lowerCAmelCase_ :int )->Optional[int]: '''simple docstring''' snake_case_ = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def _lowe...
283
1
import argparse import collections import json import os import re import string import sys import numpy as np UpperCamelCase_ = re.compile(r"\b(a|an|the)\b", re.UNICODE) UpperCamelCase_ = None def A ( ) -> Optional[int]: '''simple docstring''' UpperCAmelCase_...
561
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = ...
561
1
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DUM...
105
'''simple docstring''' import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase ( lowercase_ ): '''simple docstring''' __snake_case = (IPNDMScheduler,) __snake_case = (('num_in...
215
0
"""simple docstring""" def lowercase ( a__ : Optional[int] ) -> int: assert ( isinstance(UpperCamelCase__ , UpperCamelCase__ ) and number_of_steps > 0 ), F'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if number_of_steps == 1: retu...
703
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmTokeniz...
342
0
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) fr...
103
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transfo...
392
0
import unittest from knapsack import knapsack as k class __lowerCAmelCase ( unittest.TestCase ): def A__ ( self ) -> List[str]: '''simple docstring''' _lowercase =0 _lowercase =[0] _lowercase ...
380
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging ...
380
1
from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_xpu, require_torc...
504
import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( 'The converted...
504
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelC...
297
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 is_tor...
297
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _snake_case = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable...
282
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.d...
282
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor __a = logging.get_logger(__name__) class A__ ( UpperCamelCase ): """simple docstring""" def __init__( self : List[str] , *lowerCAmelCa...
720
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __a = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwiftFormerConfig', 'SwiftF...
257
0
def UpperCamelCase_ ( lowerCAmelCase__ = 50_00_00_00 ): """simple docstring""" _lowerCAmelCase : int = set() _lowerCAmelCase : int = int((limit - 24) ** (1 / 2) ) _lowerCAmelCase : Union[str, Any] = set(range(3 , prime_square_limit + 1 ...
424
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUIDED_IMAGE_V...
424
1
import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Tuple = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_copies # noqa: E402 # This is the ref...
662
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase : Any = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenization_roc_bert': ['RoCBertTok...
662
1
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import StableDi...
35
from typing import TYPE_CHECKING from ...utils import _LazyModule a_ :Tuple = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys a_ :Optional[int] = _LazyMod...
35
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion imp...
701
'''simple docstring''' _lowerCamelCase : Union[str, Any] = """0.18.2""" from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_avail...
512
0
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_re...
72
'''simple docstring''' import sys _UpperCAmelCase : Dict = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' '''6...
72
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowercase = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], } try: if no...
22
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't ...
22
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """tanreinama/GPTSAN-2.8B-spout_is_uniform""": ( """https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_i...
88
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _snake_case ( ): """simple docstring""" _lowerCamelCase : Any = HfArgumentParser(__snake_case ) _lowerCamelCase : int = parser.pa...
88
1
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class a ( __magic_name__ ): @require_torch def __snake_case ( self : int )...
555
'''simple docstring''' import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCAmelCase = "src/transformers" # This is...
555
1
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig a_ = logging.getLogger(__name__) class UpperCAmelCase_ ( snake_case ): UpperCamelCase ="masked_bert" def __init__( self , UpperCamelCase_=3_05_2...
76
def _a ( __UpperCamelCase : int ): if not isinstance(__UpperCamelCase ,__UpperCamelCase ): raise ValueError('''check_bouncy() accepts only integer arguments''' ) lowerCAmelCase__ : List[str] = str(__UpperCamelCase ) lowerCAmelCase__ : List[Any] ...
233
0
from __future__ import annotations __lowerCAmelCase : Optional[int] = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] __lowerCAmelCase : Optional[Any] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def a_ (_lowerCAmelCase : list[float] ...
718
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase ( __snake_case ): __lowerCamelCase = ['image_processor', 'tokenizer'] __lowerCamelCase = 'AutoImageProcessor' __lowerCamelCase = 'AutoT...
164
0
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _A : """simple docstring""" pass
564
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...
504
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase :Optional[int] = { 'configuration_mask2former': [ 'MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Mask2FormerConfig', ],...
707
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def __snake_case ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ) -> Dict: # Initia...
346
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize,...
675
'''simple docstring''' from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge a_ : Any = [ """Prosecutor: \"No videos were used in the crash investigation\" German paper...
675
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCAmelCase = {"""configuration_yolos""": ["""YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """YolosConfig""", """YolosOnnxConfig"""]} try: if not is_vision_available(...
589
def _lowercase ( a__ : int , a__ : int ) -> Dict: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(a__ , int(b / 2 ) ) * actual_power(a__ , int(b / 2 ) ) else: return a * actual_power(a__ , int(b / 2...
589
1
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar _snake_case = TypeVar("""T""") _snake_case = TypeVar("""U""") class lowerCAmelCase ( Generic[T, U] ): def __init__( self :int , _lowercas...
655
from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowerCAmelCase ( ...
655
1
def __magic_name__ ( lowercase = 100 ) -> int: """simple docstring""" lowercase_ : int = n * (n + 1) * (2 * n + 1) / 6 lowercase_ : List[Any] = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_...
436
from ...configuration_utils import PretrainedConfig UpperCAmelCase_ = { """google/tapas-base-finetuned-sqa""": ( """https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json""" ), """google/tapas-base-finetuned-wtq""": ( """https://hug...
436
1
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional @dataclass class UpperCamelCase_ : """simple docstring""" UpperCAmelCase__ : Optional[str] = field( default='''codeparrot/codeparrot''' , metadata={'''help''': '''Mod...
664
'''simple docstring''' import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'): __magic_name__ : str ={ 'linear': PIL.Image.Resampling.BILINEAR, 'bilinear': PIL.Ima...
664
1
'''simple docstring''' 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_...
703
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { "uclanlp/visualbert-vqa": "https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json", "uclanlp/visualbert-...
557
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
696
import numpy as np a_ = [ ['''a''', '''b''', '''c''', '''d''', '''e'''], ['''f''', '''g''', '''h''', '''i''', '''k'''], ['''l''', '''m''', '''n''', '''o''', '''p'''], ['''q''', '''r''', '''s''', '''t''', '''u'''], ['''v''', '''w''', '''x''', '''y''', '''z'''], ] class lowercase__ ...
339
0
"""simple docstring""" import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, ...
614
"""simple docstring""" from __future__ import annotations from collections.abc import Callable def __UpperCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = 1_00 , ) -> float: """simple docstring...
614
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a__: int = { 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], 'tokenization_m2...
190
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ , unittest.TestCase ): __SCREAMING...
190
1
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate __lowerCamelCase = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|'), dataro...
328
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common impor...
328
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPImag...
659
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModel...
659
1
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor...
138
SCREAMING_SNAKE_CASE : List[Any] = [ "Audio", "Array2D", "Array3D", "Array4D", "Array5D", "ClassLabel", "Features", "Sequence", "Value", "Image", "Translation", "TranslationVariableLanguages", ] from .audio import Audio from .features import A...
138
1
"""simple docstring""" from __future__ import annotations from fractions import Fraction def snake_case_ ( A_ : int, A_ : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ...
83
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffuse...
243
0
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_modeling_tf_common import TFModelTesterMixin, ids_tensor...
171
from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def __lowerCamelCase ( ...
171
1
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
326
def A_ ( lowercase_ , lowercase_ , lowercase_ ) -> float: return round(float(moles / volume ) * nfactor ) def A_ ( lowercase_ , lowercase_ , lowercase_ ) -> float: return round(float((moles * 0.08_21 * temperature) / (volume) ) ) def A_ ...
326
1
"""simple docstring""" 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, E...
714
"""simple docstring""" import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ =...
549
0
import math def A_ ( A__ ) -> str: a__ : Any = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(lowercase_ ) def A_ ( A__ = 1 / 1_2345 ) -> str: a__ : Dict = ...
302
'''simple docstring''' import argparse import os import re __lowerCAmelCase = "src/diffusers" # Pattern that looks at the indentation in a line. __lowerCAmelCase = re.compile(R"^(\s*)\S") # Pattern that matches `"key":" and puts `key` in group 0. __lowerCAmelCase = ...
536
0
from __future__ import annotations from typing import Any def __A(lowerCAmelCase ) -> None: """simple docstring""" create_state_space_tree(lowerCAmelCase , [] , 0 ) def __A(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ) -> None: """simple docstring""...
202
import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def __A(lowerCAmelCase ) -> List[str]: """simple docstring""" if "model" in orig_key: _UpperCamelCase = orig_key.replace("""model.""" , """""" ) if "norm1" in orig_key: _UpperCamelCase ...
202
1
def __magic_name__ ( __a : str , __a : str ): '''simple docstring''' UpperCamelCase__ = len(__a ) UpperCamelCase__ = [] for i in range(len(__a ) - pat_len + 1 ): UpperCamelCase__ = True ...
513
import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor lowerCamelCase_ = logging.get_logger(__name__) class __A( __lowerCamelCase ): """simple docstring""" def __init__(self , *SCREAMING_SNAKE_CASE_ , **SCREAMING_SNAKE_...
513
1
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_...
189
class a : def __init__( self : Any , SCREAMING_SNAKE_CASE_ : str = "" , SCREAMING_SNAKE_CASE_ : bool = False ): # Mapping from the first character of the prefix of the node __lowerCamelCase: dict[str, RadixNode] = {} # A node wi...
189
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer lowerCamelCase_ = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.j...
418
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase_ = logging.get_logger(...
418
1
from itertools import permutations def UpperCAmelCase__ ( lowerCamelCase ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False lowercase :Optional[int] = [7, 11, 13, 17] for i, test in enumera...
453
def UpperCAmelCase__ ( lowerCamelCase, lowerCamelCase ): return int((input_a, input_a).count(0 ) != 0 ) def UpperCAmelCase__ ( ): assert nand_gate(0, 0 ) == 1 assert nand_gate(0, 1 ) == 1 assert nand_gate(1, 0 ) == 1 assert nand_gate(1, 1 ) == 0 if __nam...
453
1
'''simple docstring''' from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) lowerCamelCa...
474
'''simple docstring''' import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _UpperCamelCase ( A , unittest.TestCase ): '''simple docstring''' lowerCAm...
474
1
from collections.abc import Generator def _a ( ) -> Generator[int, None, None]: lowerCamelCase_ , lowerCamelCase_ : int = 0, 1 while True: lowerCamelCase_ , lowerCamelCase_ : Any = b, a + b yield b def _a ( lowerCamelCase...
144
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { '''EleutherAI/gpt-neox-20b''': '''https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json''', # See all GPTNeoX models at https:...
144
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _A : Any = {"""configuration_xglm""": ["""XGLM_PRETRAINED_C...
100
'''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...
41
0
import os import jsonlines import numpy as np from tqdm import tqdm _lowercase = 2048 _lowercase = 4096 _lowercase = 42 _lowercase = os.environ.pop("""PROCESS_TRAIN""", """false""") _lowercase = {"""null""": 0, """short""": 1, """long""": 2, """yes""": 3, """...
431
# Function to print upper half of diamond (pyramid) def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : int ) -> Dict: for i in range(0 , UpperCAmelCase_ ): for _ in range(0 , n - i - 1 ): # printing spaces print(''' ''' , end...
431
1
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowercase_ ( lowercase , unittest.TestCase ): '''sim...
117
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load...
117
1
import torch from transformers import AutoModel class UpperCAmelCase__ ( torch.nn.Module ): """simple docstring""" def __init__( self: List[str] , __lowerCAmelCase: Any="sayef/fsner-bert-base-uncased" ) -> Dict: '''simple docstring''' super(__lowerCAmelCase ,...
286
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a_ = {"""processing_layoutxlm""": ["""LayoutXLMProcessor"""]} try: if not is_...
286
1
"""simple docstring""" from __future__ import annotations from scipy.special import comb # type: ignore class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Tuple , UpperCAmelCase_ : list[tuple[float, float]] ) -> int:...
580
"""simple docstring""" from __future__ import annotations import unittest from transformers import 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, rand...
580
1
"""simple docstring""" def _SCREAMING_SNAKE_CASE (__lowerCAmelCase = 10**9 ) -> int: '''simple docstring''' lowercase_ = 1 lowercase_ = 2 lowercase_ = 0 lowercase_ = 0 lowercase_ = 0 while perimeter <= max_perimeter:...
100
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[Any] = logging.get_logger(__name__) UpperCAmelCase : Optional[Any] = { "alibaba-damo/mgp-str-base": "https://huggingface.co/alibaba-damo/mgp-str-base/resol...
100
1
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
249
0
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 logging lowercase_ = logging.get_logger(__name__) lowercase_ =...
703
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 lowercase...
230
0
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
463
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_...
59
0
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 OptionalDepend...
713
def UpperCAmelCase__ ( lowerCamelCase_ : int ): if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise ValueError('Input must be an integer' ) if input_num <= 0: raise ValueError('Input must be positive' ) return sum( d...
577
0
def _a ( SCREAMING_SNAKE_CASE__ : list , SCREAMING_SNAKE_CASE__ : list , SCREAMING_SNAKE_CASE__ : int ) -> int: '''simple docstring''' if len(SCREAMING_SNAKE_CASE__ ) != len(SCREAMING_SNAKE_CASE__ ): raise ValueError("...
663
def _a ( SCREAMING_SNAKE_CASE__ : List[Any]=2_81_23 ) -> Any: '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i ...
663
1
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCAmelCase = logging.get_logger(__name__) class A_ ( __lowerCamelCase ): '''simple docstring''' def __init__( self , *snake_case , **snake_case ): warnings.warn( ...
565
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import logging Upp...
565
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=_lowerCAmelCase ) class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : str = ...
81
from __future__ import annotations def lowerCAmelCase_ ( __lowerCamelCase ): if not nums: return 0 __snake_case : Any = nums[0] __snake_case : str = 0 for num in nums[1:]: __snake_case , __snake_c...
81
1
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class __lowerCAmelCase ( __magic_name__ ): """simple docstring""" @require_torch def ...
707
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffu...
167
0
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def SCREAMING_SNAKE_CASE_ ( __A : Any ) -> List[str]: """simple docstring"""...
570
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( lowercase__ ): snake_case__ : Optional[int] = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE ( self : Optional...
570
1
'''simple docstring''' import re from filelock import FileLock try: import nltk lowerCAmelCase__ = True except (ImportError, ModuleNotFoundError): lowerCAmelCase__ = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) def _A ...
718
'''simple docstring''' import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, ...
624
0
'''simple docstring''' import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __a ( A...
649
'''simple docstring''' def __a ( A__ , A__ ) -> Optional[int]: _enforce_args(A__ , A__ ) if n == 0: return 0 lowerCAmelCase = float("-inf" ) for i in range(1 , n + 1 ): lowerCAmelCase = max( ...
649
1
def lowerCAmelCase ( lowerCAmelCase_ = 1_000_000 ): lowerCAmelCase_ : str = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , _lowerCamelCase ): phi[j] -= phi[j] // i ret...
717
from manim import * class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def lowercase_ ( self ) -> Tuple: lowerCAmelCase_ : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase_ : T...
619
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : Tuple = logging.get_logger...
549
"""simple docstring""" def lowerCamelCase__ ( _lowerCamelCase : list[list[int | float]] ) -> int: lowerCamelCase_ = len(_lowerCamelCase ) lowerCamelCase_ = len(matrix[0] ) lowerCamelCase_ = min(_lowerCamelCase , _lowerCa...
549
1
def UpperCamelCase ( lowercase_ ) -> int: '''simple docstring''' assert ( isinstance(lowercase_ , lowercase_ ) and number_of_steps > 0 ), F'number_of_steps needs to be positive integer, your input {number_of_steps}' if number_of_steps == 1: return 1 lowercase__ ...
495
# Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - generate model_cards - ...
495
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Dict = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''...
105
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class _a ( datasets.BeamBasedBuilder ): """simple docstring""" ...
23
0
"""simple docstring""" from itertools import permutations def a_ ( _lowerCAmelCase : tuple ): '''simple docstring''' if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: ...
645
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.num...
645
1
import json import sys def UpperCamelCase_( snake_case__: str , snake_case__: List[Any] ) -> Dict: with open(snake_case__ , encoding='utf-8' ) as f: UpperCAmelCase__ = json.load(snake_case__ ) UpperCAmelCase__ = ['<details>', '<summ...
146
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand _UpperCamelCase = ( '''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''', '''TS KS 5S 9S A...
146
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_t...
716
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : list ): if len(UpperCAmelCase_ ) <= 1: return lst A__ = 1 while i < len(UpperCAmelCase_ ): if lst[i - 1] <= lst[i]: i += 1 else: A__ ...
500
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = {"configuration_sew": ["SEW_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAv...
624
import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentParser, Tr...
39
0
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration lowercase : Tuple = [ # tf -> hf ("/", "."), ("layer_", "layers."), ("kernel", "weight"), ("b...
703
'''simple docstring''' import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipeline...
542
0
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging a_ : str = ...
194
from typing import Any class A__ : def __init__( self , lowerCamelCase ) -> Dict: """simple docstring""" __magic_name__ : List[str] = data __magic_name__ : List[Any] = None de...
154
0
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset from utils import logger class __UpperCamelCase ( lowercase__ ): def __init__( self :Any ,_UpperCamelCase :Union[str, Any] ,_UpperCamelCase :Any ): snake_case_ : Opt...
267
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __A : Tuple = { 'configuration_audio_spectrogram_transformer': [ 'AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP'...
267
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : List[Any] = { "facebook/timesformer": "https://huggingface.co/facebook/timesformer/resolve/main/config.json", } class ...
63
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available UpperCAmelCase = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else:...
420
0
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import requ...
715
'''simple docstring''' import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPIN...
11
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase__ = {'configuration_encoder_decoder': ['EncoderDecoderConfig']} try: ...
75
'''simple docstring''' import numpy # List of input, output pairs lowercase : Any = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) lowercase : str = (((5_15, 22, 13), 5_55), ((61,...
634
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) class A( UpperCame...
712
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase : Dict = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_ARC...
651
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a : Tuple = logging.get_logger(__name__) a : List[str] = { '''microsoft/focalnet-tiny''': '...
639
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position a : Dict = '''2.13.1''' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('''3.7'''): raise ...
639
1
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer SCREAMING_SNAKE_CASE__ : Union[str, ...
636
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_S...
636
1
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def lowerCamelCase_ ( __UpperCamelCase : Sequence[float] , __UpperCamelCase : int , __Up...
292
'''simple docstring''' from statistics import mean, stdev def lowerCamelCase_ ( __UpperCamelCase : list , __UpperCamelCase : int = 3 ) -> list: """simple docstring""" _A = min(__UpperCamelCase ) _A = max(__UpperCamelCase...
292
1
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase ) -> float: '''simple docstring''' if density <= 0: raise ValueError('''Impossible fluid density''' ) if bulk_modulus <= 0: raise ValueError('''Impossible bulk modulus''' ) ...
593
'''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...
593
1