code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import torch from diffusers import DiffusionPipeline class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __init__( self, _a, _a ) -> Optional[Any]: super().__init__() self.register_modules(unet=_a, scheduler=_a ) def __ca...
693
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY i...
693
1
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, ...
693
from __future__ import annotations import math def _A ( __snake_case :int , __snake_case :int , __snake_case :bool , __snake_case :list[int] , __snake_case :float ) -> int: """simple docstring""" if depth < 0: raise ValueError("Depth cannot be les...
693
1
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoModelW...
693
def _A ( __snake_case :bytes ) -> str: """simple docstring""" return "".join([hex(__snake_case )[2:].zfill(2 ).upper() for byte in list(__snake_case )] ) def _A ( __snake_case :str ) -> bytes: """simple docstring""" if (len(__sna...
693
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, ) _snake_case : Any = {'configuration_xgl...
693
from functools import lru_cache def _A ( __snake_case :int ) -> set: """simple docstring""" __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: n //= i ...
693
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _snake_case : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
693
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def _A ( __snake_c...
693
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _snake_case : Optional[int] = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_t...
693
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _snake_case : str = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __init__( self, *_a, **_a ) -> ...
693
1
def _A ( __snake_case :int , __snake_case :int ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def _A ( ) -> None: """simple docstring""" assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , ...
693
from math import sqrt def _A ( __snake_case :int ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(__snake_case ) + 1 ) ): if n % i == 0 and i != sqrt(__snake_case ): total += i + n // i e...
693
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=__SCREAMING_SNAKE_CASE ) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CA...
693
def _A ( __snake_case :int , __snake_case :float , __snake_case :float ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def _A ( __snake_case :float , __snake_case :float , __snake_case :float ) -> float...
693
1
from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def _A ( __snake_case :str , __snake_case :str , __snake_case :Optional[str] = None ) -> str: """simple docstring""" if version.parse(hfh._...
693
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_mo...
693
1
def _A ( __snake_case :Any , __snake_case :Optional[int] , __snake_case :str , __snake_case :int , __snake_case :List[str] , __snake_case :Any ) -> Dict: """simple docstring""" if index == r: for j in range(__snake_case ): print(data[j] , end=" ...
693
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _A ( __snake_case :BertModel , __snake_case :str , __snake_case :str ) -> List[str]: """simple docstring""" __SCREAMING_SNAKE_CASE ...
693
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
693
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging _snake_case : str = logging.get_logge...
693
1
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils impo...
693
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_...
693
1
def _A ( __snake_case :str ) -> bool: """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError("String must only contain alphabetic characters." ) __SCREAMING_SNAKE_CASE = sorted(string.lower() ) return len(__snake_case ) == ...
693
def _A ( __snake_case :int = 400_0000 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = [] __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__snake_case ) __SCRE...
693
1
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TOKE...
693
from __future__ import annotations _snake_case : str = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] _snake_case : Optional[int] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _A ( __snake_case :list[float] ) ...
693
1
# flake8: noqa # Lint as: python3 _snake_case : int = [ 'VerificationMode', 'Version', 'disable_progress_bar', 'enable_progress_bar', 'is_progress_bar_enabled', 'experimental', ] from .info_utils import VerificationMode from .logging import disable_progress_...
693
from typing import Any class __SCREAMING_SNAKE_CASE : def __init__( self, _a ) -> Any: __SCREAMING_SNAKE_CASE = data __SCREAMING_SNAKE_CASE = None def __repr__( self ) -> str: return f'''Node({self.da...
693
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _snake_case : List[Any] = { 'configuration_roformer': ['ROFORMER_PR...
693
import argparse import json from tqdm import tqdm def _A ( ) -> Optional[int]: """simple docstring""" __SCREAMING_SNAKE_CASE = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=__snake_case , defau...
693
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _A ( ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = ArgumentParser( descripti...
693
def _A ( __snake_case :int = 10**9 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 while peri...
693
1
print((lambda quine: quine % quine)('print((lambda quine: quine %% quine)(%r))'))
693
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast...
693
1
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler fr...
693
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CASE__ =(IPNDMScheduler,) SCREAMING_SNAKE_CASE__ =(("""num_inference_steps""", 50),...
693
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : Dict = logging.get_logger(__name__) _snake_case : Dict = { 'funnel-transformer/small': 'https://huggingface.co/funnel-transformer/small/resolve/main/config.json', ...
693
import random from .binary_exp_mod import bin_exp_mod def _A ( __snake_case :List[Any] , __snake_case :Union[str, Any]=1000 ) -> int: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __...
693
1
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import Confi...
693
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def _A ( __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int ) -> np.ndarray: """simple doc...
693
1
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _snake_case : List[str] = get_tests_dir('f...
693
def _A ( __snake_case :int ) -> int: """simple docstring""" assert isinstance(__snake_case , __snake_case ), f'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __SCREAMING_SNAKE_CASE = f'''The inp...
693
1
from __future__ import annotations def _A ( __snake_case :list , __snake_case :int ) -> List[str]: """simple docstring""" if len(__snake_case ) <= 1 or n <= 1: return insert_next(__snake_case , n - 1 ) rec_insertion_sort(__snake_case , n - 1 ...
693
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY i...
693
1
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __SCREAMING_SNAKE_CASE ( unittest.TestCase ): def __lowerCAmelCase ( self ) -> ...
693
from __future__ import annotations import math def _A ( __snake_case :int , __snake_case :int , __snake_case :bool , __snake_case :list[int] , __snake_case :float ) -> int: """simple docstring""" if depth < 0: raise ValueError("Depth cannot be les...
693
1
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING,...
693
def _A ( __snake_case :bytes ) -> str: """simple docstring""" return "".join([hex(__snake_case )[2:].zfill(2 ).upper() for byte in list(__snake_case )] ) def _A ( __snake_case :str ) -> bytes: """simple docstring""" if (len(__sna...
693
1
def _A ( __snake_case :int , __snake_case :int ) -> bool: """simple docstring""" return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
693
from functools import lru_cache def _A ( __snake_case :int ) -> set: """simple docstring""" __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: n //= i ...
693
1
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# _snake_case : Any = [ # (stable-diffusion, HF Diffusers) ('time_embed.0.weight', 'time_embeddin...
693
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def _A ( __snake_c...
693
1
import logging from transformers import PretrainedConfig _snake_case : Optional[Any] = logging.getLogger(__name__) _snake_case : Union[str, Any] = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summ...
693
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _snake_case : str = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __init__( self, *_a, **_a ) -> ...
693
1
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup _snake_case : int = logging.get_logger(__name__) ...
693
from math import sqrt def _A ( __snake_case :int ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(__snake_case ) + 1 ) ): if n % i == 0 and i != sqrt(__snake_case ): total += i + n // i e...
693
1
import sys def _A ( __snake_case :Dict ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = len(__snake_case ) __SCREAMING_SNAKE_CASE = [[0 for x in range(__snake_case )] for x in range(__snake_case )] __SCREAMING_SNAKE_CASE = ...
693
def _A ( __snake_case :int , __snake_case :float , __snake_case :float ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def _A ( __snake_case :float , __snake_case :float , __snake_case :float ) -> float...
693
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available _snake_case : Tuple = { 'configuration_ernie': ['ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ErnieConfig', 'ErnieOnnxConfig'], } try: ...
693
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_mo...
693
1
from __future__ import annotations from typing import Any def _A ( __snake_case :list[Any] ) -> None: """simple docstring""" create_state_space_tree(__snake_case , [] , 0 ) def _A ( __snake_case :list[Any] , __snake_case :list[Any] ...
693
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _A ( __snake_case :BertModel , __snake_case :str , __snake_case :str ) -> List[str]: """simple docstring""" __SCREAMING_SNAKE_CASE ...
693
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case : List[str] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Autof...
693
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging _snake_case : str = logging.get_logge...
693
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _snake_case : Tuple = {'configuration_encoder_decoder': ['EncoderDecoderConfig']} try: if not...
693
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_...
693
1
import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __SCREAMING_SNAKE_CASE ( unittes...
693
def _A ( __snake_case :int = 400_0000 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = [] __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__snake_case ) __SCRE...
693
1
from maths.prime_check import is_prime def _A ( __snake_case :int ) -> int: """simple docstring""" if not isinstance(__snake_case , __snake_case ): __SCREAMING_SNAKE_CASE = f'''Input value of [number={number}] must be an integer''' raise TypeE...
693
from __future__ import annotations _snake_case : str = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] _snake_case : Optional[int] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _A ( __snake_case :list[float] ) ...
693
1
def _A ( __snake_case :int , __snake_case :int ) -> int: """simple docstring""" return int(input_a == input_a == 0 ) def _A ( ) -> None: """simple docstring""" print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2...
693
from typing import Any class __SCREAMING_SNAKE_CASE : def __init__( self, _a ) -> Any: __SCREAMING_SNAKE_CASE = data __SCREAMING_SNAKE_CASE = None def __repr__( self ) -> str: return f'''Node({self.da...
693
1
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): ...
693
import argparse import json from tqdm import tqdm def _A ( ) -> Optional[int]: """simple docstring""" __SCREAMING_SNAKE_CASE = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=__snake_case , defau...
693
1
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def _A ( __snake_case :np.ndarray , __snake_case :np.ndarray , __snake_case :np.ndarray , __snake_case :int , __snake_case :int ) -> np.ndarray: """simple docstring""" ...
693
def _A ( __snake_case :int = 10**9 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 while peri...
693
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_...
693
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast...
693
1
# limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class lowerCamelCase_ ( lowerCamelCase ): def __init__( self , __lowerCAmelCase , __lowerCAmelCase ): ...
0
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CASE__ =(IPNDMScheduler,) SCREAMING_SNAKE_CASE__ =(("""num_inference_steps""", 50),...
693
0
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = '''▁''' __snake_c...
1
import random from .binary_exp_mod import bin_exp_mod def _A ( __snake_case :List[Any] , __snake_case :Union[str, Any]=1000 ) -> int: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __...
693
0
import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_schedul...
2
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def _A ( __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int ) -> np.ndarray: """simple doc...
693
0
'''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 lowerCAmelCase : str = logging.get_logger(__name__) lowerCAmelCase : Tuple ...
3
def _A ( __snake_case :int ) -> int: """simple docstring""" assert isinstance(__snake_case , __snake_case ), f'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __SCREAMING_SNAKE_CASE = f'''The inp...
693
0
"""simple docstring""" import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) __UpperCamelCase : int = pytest.mark.integration @pytest.mark.p...
4
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY i...
693
0
'''simple docstring''' def A (__lowerCamelCase :int ): if not isinstance(__lowerCamelCase , __lowerCamelCase ): _lowerCAmelCase = f'Input value of [number={number}] must be an integer' raise TypeError(__lowerCamelCase ) if number < 0: ...
5
from __future__ import annotations import math def _A ( __snake_case :int , __snake_case :int , __snake_case :bool , __snake_case :list[int] , __snake_case :float ) -> int: """simple docstring""" if depth < 0: raise ValueError("Depth cannot be les...
693
0
from ..utils import DummyObject, requires_backends class UpperCamelCase_ ( metaclass=UpperCamelCase__ ): lowerCamelCase_ = ["flax"] def __init__( self :Dict , *__A :List[str] , **__A :Dict ) -> Union[str, Any]: """simple do...
6
def _A ( __snake_case :bytes ) -> str: """simple docstring""" return "".join([hex(__snake_case )[2:].zfill(2 ).upper() for byte in list(__snake_case )] ) def _A ( __snake_case :str ) -> bytes: """simple docstring""" if (len(__sna...
693
0
"""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...
7
from functools import lru_cache def _A ( __snake_case :int ) -> set: """simple docstring""" __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: n //= i ...
693
0
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_ava...
8
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def _A ( __snake_c...
693
0
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex SCREAMING_SNAKE_CASE__ = logging.getLogger(__name__) class __lowerCAmelCase : """simple docstring""" def __init__( s...
9
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _snake_case : str = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __init__( self, *_a, **_a ) -> ...
693
0
def _snake_case ( __snake_case , __snake_case ): if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCamelCase = str(bin(__snake_case ) )[2:] # remove the leading "0b" _UpperCamelCase = str(bin(__snake...
10
from math import sqrt def _A ( __snake_case :int ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(__snake_case ) + 1 ) ): if n % i == 0 and i != sqrt(__snake_case ): total += i + n // i e...
693
0
'''simple docstring''' from __future__ import annotations def lowerCAmelCase (__A): """simple docstring""" return len(set(__A)) == len(__A) if __name__ == "__main__": import doctest doctest.testmod()
11
def _A ( __snake_case :int , __snake_case :float , __snake_case :float ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def _A ( __snake_case :float , __snake_case :float , __snake_case :float ) -> float...
693
0
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_arr...
12
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_mo...
693
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from ...
13
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _A ( __snake_case :BertModel , __snake_case :str , __snake_case :str ) -> List[str]: """simple docstring""" __SCREAMING_SNAKE_CASE ...
693
0
import argparse from collections import defaultdict def __UpperCAmelCase ( __a : Union[str, Any] ,__a : Tuple ,__a : Tuple ,__a : Dict ,__a : Tuple ) -> List[Any]: """simple docstring""" _a : List[str] = F"""{file}...
14
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging _snake_case : str = logging.get_logge...
693
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Optional[int] = { 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], 'tokenizatio...
15
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_...
693
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A : Any = logging.get_logger(__name__) __A : List[...
16
def _A ( __snake_case :int = 400_0000 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = [] __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__snake_case ) __SCRE...
693
0
import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict import IterableDatasetDict from da...
17
from __future__ import annotations _snake_case : str = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] _snake_case : Optional[int] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _A ( __snake_case :list[float] ) ...
693
0
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise Opt...
18
from typing import Any class __SCREAMING_SNAKE_CASE : def __init__( self, _a ) -> Any: __SCREAMING_SNAKE_CASE = data __SCREAMING_SNAKE_CASE = None def __repr__( self ) -> str: return f'''Node({self.da...
693
0
"""simple docstring""" # XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path _a = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path)) import dataclasses...
19
import argparse import json from tqdm import tqdm def _A ( ) -> Optional[int]: """simple docstring""" __SCREAMING_SNAKE_CASE = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=__snake_case , defau...
693
0
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _lowerCAmelCase: Any = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582' } ...
20
def _A ( __snake_case :int = 10**9 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 while peri...
693
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Tuple = logging.get_logger(__name__) UpperCAmelCase_ : Tuple = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.jso...
21
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast...
693
0
'''simple docstring''' import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_...
22
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CASE__ =(IPNDMScheduler,) SCREAMING_SNAKE_CASE__ =(("""num_inference_steps""", 50),...
693
0
import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_flax_avai...
23
import random from .binary_exp_mod import bin_exp_mod def _A ( __snake_case :List[Any] , __snake_case :Union[str, Any]=1000 ) -> int: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __...
693
0
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTe...
24
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def _A ( __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int ) -> np.ndarray: """simple doc...
693
0
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ...
25
def _A ( __snake_case :int ) -> int: """simple docstring""" assert isinstance(__snake_case , __snake_case ), f'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __SCREAMING_SNAKE_CASE = f'''The inp...
693
0
'''simple docstring''' import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils ...
26
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY i...
693
0
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = 'M-CLIP' def __init__( self , snake_case_=1024 , snake_case_=768...
27
from __future__ import annotations import math def _A ( __snake_case :int , __snake_case :int , __snake_case :bool , __snake_case :list[int] , __snake_case :float ) -> int: """simple docstring""" if depth < 0: raise ValueError("Depth cannot be les...
693
0
'''simple docstring''' import numpy as np UpperCamelCase_ = [ ["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 _a : '''simple docstr...
28
def _A ( __snake_case :bytes ) -> str: """simple docstring""" return "".join([hex(__snake_case )[2:].zfill(2 ).upper() for byte in list(__snake_case )] ) def _A ( __snake_case :str ) -> bytes: """simple docstring""" if (len(__sna...
693
0
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging A_ = {...
29
from functools import lru_cache def _A ( __snake_case :int ) -> set: """simple docstring""" __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: n //= i ...
693
0
from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...tokenization_uti...
30
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def _A ( __snake_c...
693
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCamelCase__ : List[str] = logging.get_logger(__name__) lowerCamelCase__ : List[str] = ...
31
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _snake_case : str = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __init__( self, *_a, **_a ) -> ...
693
0
from pathlib import Path import numpy as np from PIL import Image def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray ) -> np.ndarray: """simple docstring""" _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase = rgb[:, :, 0], rgb[:, :, 1],...
32
from math import sqrt def _A ( __snake_case :int ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(__snake_case ) + 1 ) ): if n % i == 0 and i != sqrt(__snake_case ): total += i + n // i e...
693
0
def SCREAMING_SNAKE_CASE ( __lowerCAmelCase , __lowerCAmelCase ) -> str: if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) snake_case__ = str(bin(__lowerCAmelCase ) )[2:] # remove the leading "0b" snake_case__ = str(bin(__l...
33
def _A ( __snake_case :int , __snake_case :float , __snake_case :float ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def _A ( __snake_case :float , __snake_case :float , __snake_case :float ) -> float...
693
0
"""simple docstring""" import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class snak...
34
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_mo...
693
0
from math import log from scipy.constants import Boltzmann, physical_constants a_ :Dict = 3_00 # TEMPERATURE (unit = K) def a ( A__ , A__ , A__ , ) -> float: '''simple docstring''' if donor_conc <= 0: raise ValueError('''Donor concentra...
35
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _A ( __snake_case :BertModel , __snake_case :str , __snake_case :str ) -> List[str]: """simple docstring""" __SCREAMING_SNAKE_CASE ...
693
0
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class _A ( snake_case ): '''...
36
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging _snake_case : str = logging.get_logge...
693
0
from math import sqrt def UpperCamelCase_ ( __a = 1_000_000 ) -> int: a__ : int = 0 a__ : int = 0 a__ : int while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2 , 2 * max_cuboid_size + 1 ): ...
37
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_...
693
0
'''simple docstring''' from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup A_ : Optional[int] = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def UpperCamelCase__ ( __magic_name__ : str = "mumbai"...
38
def _A ( __snake_case :int = 400_0000 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = [] __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__snake_case ) __SCRE...
693
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', ...
39
from __future__ import annotations _snake_case : str = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] _snake_case : Optional[int] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _A ( __snake_case :list[float] ) ...
693
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, ) __UpperCAmelCase = {'''configuration_mbart''': ['''MBART_PRETRAINED...
40
from typing import Any class __SCREAMING_SNAKE_CASE : def __init__( self, _a ) -> Any: __SCREAMING_SNAKE_CASE = data __SCREAMING_SNAKE_CASE = None def __repr__( self ) -> str: return f'''Node({self.da...
693
0
'''simple docstring''' from importlib import import_module from .logging import get_logger lowerCAmelCase__ = get_logger(__name__) class lowercase_ : """simple docstring""" def __init__( self : Union[str, Any] ,lowercase__ : Dict ,lowercase__ : Union[str, Any]=None...
41
import argparse import json from tqdm import tqdm def _A ( ) -> Optional[int]: """simple docstring""" __SCREAMING_SNAKE_CASE = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=__snake_case , defau...
693
0
'''simple docstring''' def _UpperCamelCase ( __UpperCamelCase ,__UpperCamelCase ) -> str: if not (isinstance(__UpperCamelCase ,__UpperCamelCase ) and isinstance(__UpperCamelCase ,__UpperCamelCase )): raise ValueError('longest_common_substring() takes two strings for inputs' ) ...
42
def _A ( __snake_case :int = 10**9 ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 while peri...
693
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): ...
43
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast...
693
0
'''simple docstring''' from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from transfo...
44
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CASE__ =(IPNDMScheduler,) SCREAMING_SNAKE_CASE__ =(("""num_inference_steps""", 50),...
693
0
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase_ ( lowercase ): """simple docstring""" _snake_case : int = (PNDMScheduler,) _snake_case : Any = (("""num_inf...
45
import random from .binary_exp_mod import bin_exp_mod def _A ( __snake_case :List[Any] , __snake_case :Union[str, Any]=1000 ) -> int: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __...
693
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available _lowerCAmelCase : Union[str, Any] = { '''configuration_audio_spectrogram_transformer''': [ '''AUDIO_SPECTROGRAM_TRANSF...
46
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def _A ( __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int , __snake_case :int ) -> np.ndarray: """simple doc...
693
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE__ = { '''configuration_nezha''': ['''NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NezhaConfig'''], } try: if ...
47
def _A ( __snake_case :int ) -> int: """simple docstring""" assert isinstance(__snake_case , __snake_case ), f'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __SCREAMING_SNAKE_CASE = f'''The inp...
693
0
'''simple docstring''' UpperCAmelCase__ : str = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} UpperCAmelCase__ : Any = ["a", "b", "c", "d", "e"] def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : str , UpperCamelCase_ : Any...
48
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY i...
693
0
"""simple docstring""" from typing import Any def lowercase__ ( snake_case_ :list , snake_case_ :list , snake_case_ :dict , snake_case_ :dict , snake_case_ :dict , ): _validation( snake_case_ , snake_case_ , snake_case_ , snake_case_ ,...
49
from __future__ import annotations import math def _A ( __snake_case :int , __snake_case :int , __snake_case :bool , __snake_case :list[int] , __snake_case :float ) -> int: """simple docstring""" if depth < 0: raise ValueError("Depth cannot be les...
693
0
'''simple docstring''' 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 ModelTe...
50
def _A ( __snake_case :bytes ) -> str: """simple docstring""" return "".join([hex(__snake_case )[2:].zfill(2 ).upper() for byte in list(__snake_case )] ) def _A ( __snake_case :str ) -> bytes: """simple docstring""" if (len(__sna...
693
0
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def __snake_case ( ) -> int: """simple docstring""" raise RuntimeError('''CUD...
51
from functools import lru_cache def _A ( __snake_case :int ) -> set: """simple docstring""" __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: n //= i ...
693
0
"""simple docstring""" import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def __A ( a_ :BertModel , a_ :str , a_ :str) -> str: __a : List[str] = ('''dense.weigh...
52
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def _A ( __snake_c...
693
0
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator,...
53
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _snake_case : str = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __init__( self, *_a, **_a ) -> ...
693
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase : Optional[int] =logging.get_logger(__name__) __lowercase : Optional[Any] ={ """microsoft/xprophetnet-large-wiki100-cased""": ( """h...
54
from math import sqrt def _A ( __snake_case :int ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(__snake_case ) + 1 ) ): if n % i == 0 and i != sqrt(__snake_case ): total += i + n // i e...
693
0
import copy import re class UpperCAmelCase : '''simple docstring''' snake_case_ = "hp" snake_case_ = {} snake_case_ = None @classmethod def UpperCamelCase_ ( cls : Optional[Any] ,A : List[str] ,A : List[str] ): __A ...
55
def _A ( __snake_case :int , __snake_case :float , __snake_case :float ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def _A ( __snake_case :float , __snake_case :float , __snake_case :float ) -> float...
693
0
'''simple docstring''' _a : Union[str, Any] = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git...
56
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_mo...
693
0
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ...
57
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _A ( __snake_case :BertModel , __snake_case :str , __snake_case :str ) -> List[str]: """simple docstring""" __SCREAMING_SNAKE_CASE ...
693
0
"""simple docstring""" from __future__ import annotations __lowerCAmelCase : List[Any] = 10 def __lowerCAmelCase ( __UpperCamelCase : list[int] ): '''simple docstring''' snake_case_ : Optional[Any] = 1...
58
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging _snake_case : str = logging.get_logge...
693
0
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_...
693
0