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 os import sys lowerCamelCase : Dict = os.path.join(os.path.dirname(__file__), "src") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSeq...
405
def lowerCamelCase_ ( UpperCamelCase__ : int, UpperCamelCase__ : int ): '''simple docstring''' if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCamelCase__, int(b / 2 ) ) * actual_power(UpperCamelCase_...
240
0
'''simple docstring''' import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyV...
417
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __UpperCamelCase : Optional[Any] = { '''configuration_convnext''': ['''CONVNEXT...
417
1
'''simple docstring''' import numpy as np from PIL import Image def A__ ( A_ , A_ , A_ ) -> Optional[int]: _lowercase = np.array(lowerCamelCase_ ) if arr.shape[0] != arr.shape[1]: raise ValueError("The input array is not a square matrix" ) _lowerca...
497
'''simple docstring''' from __future__ import annotations import pandas as pd def UpperCAmelCase_ ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): """simple docstring""" lowerCAmelCase__ : Tuple = [0] * no_of_processes lowerCAmelCase__ : Any = [0]...
378
0
'''simple docstring''' import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datas...
204
'''simple docstring''' import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) lowerCAmelCase_ : Optional[int] = logging.get...
204
1
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin ...
52
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__)...
330
0
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...t...
649
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : int = { '''configuration_funnel''': ['''FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Funnel...
649
1
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ ) -> list: '''simple docstring''' snake_case : Tuple = [0] * len(lowerCamelCase__ ) for i in range(1 , len(lowerCamelCase__ ) ): # use last results for better performance ...
638
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> np.ndarray: __lowerCamelCas...
652
0
'''simple docstring''' def __A ( lowerCamelCase_ ): """simple docstring""" if not grid or not grid[0]: raise TypeError("""The grid does not contain the appropriate information""" ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] SCREAMING_SNAKE_...
704
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __UpperCAmelCase = logging.get_logger(__name__) class UpperCamelCase__ ( lowercase_ ): """simple docstring""" def __init__( self : Dict...
79
0
"""simple docstring""" from __future__ import annotations from collections import namedtuple def lowerCAmelCase_ ( lowercase_ : float , lowercase_ : float , lowercase_ : float ): '''simple docstring''' __SCREAMING_SNAKE_CASE : List[Any] = n...
674
"""simple docstring""" from collections.abc import Callable import numpy as np def lowerCAmelCase_ ( lowercase_ : Callable , lowercase_ : float , lowercase_ : float , lowercase_ : float , lowercase_ : float ): '''simple docstring''' __SCREA...
674
1
"""simple docstring""" def lowerCAmelCase__ ( lowerCamelCase__ ) -> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) A = [True] * (num + 1) A = 2 while p * p <= num: if primes[p]:...
714
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { 'edbeeching/decision-transformer-gym-hopper-medium': ( 'https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medium/resolve/main...
109
0
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ ): UpperCamelCase__ : int = int(number**0.5 ) return number == sq * sq def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ , U...
285
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProcessor, BlipImageProcessor...
285
1
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCamelCase_ (__A ): __magic_name__ = ['''image_processor''', '''tokenizer'''] __magic_name__ = '''AutoImageProcessor''' __magic_name__ = ...
463
"""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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ ...
463
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except ...
275
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { """microsoft/swinv2-tiny-patch4-window8-256""": ( """https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/m...
137
0
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : list ): """simple docstring""" _enforce_args(UpperCamelCase__ , UpperCamelCase__ ) if n == 0: return 0 __lowercase = float("""-inf""" ) for i in range(1 ,...
442
"""simple docstring""" import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _R...
442
1
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a__ : Optional[int] = { """facebook/mask2former-swin-small-coco-instance""": ( """https://huggingface.co/facebook...
165
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : List[str] = logging.get_logger(__name__) a__ : Tuple = { """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/c...
165
1
'''simple docstring''' import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class lowerCAmelCase__ (...
418
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCamelCase : Optional[int] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) im...
418
1
"""simple docstring""" # Imports import numpy as np class _UpperCAmelCase : def __init__( self : Tuple , _lowercase : int=None , _lowercase : List[str]=None , _lowercase : Optional[Any]=None , _lowercase : List[Any]=Non...
49
"""simple docstring""" def lowercase__ ( snake_case_ :float , snake_case_ :float ): if density <= 0: raise ValueError('''Impossible fluid density''' ) if bulk_modulus <= 0: raise ValueError('''Impossible bulk modulus''' ) return (bulk_modulus / density) ** 0...
49
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase__ : List[str] = logging.get_lo...
317
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : int ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertic...
317
1
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand UpperCAmelCase_ = logging.get_logger(__name__) # pylint: disable=invalid-name def __mag...
458
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.u...
638
0
"""simple docstring""" def A__ ( A__ ) -> bool: '''simple docstring''' _UpperCAmelCase = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def A__ ( A__ = 5000 ) -> int: '''simple docstring''' _UpperCAmelCase = [(i * (3 * i - 1...
579
"""simple docstring""" from timeit import timeit def A__ ( A__ ) -> int: '''simple docstring''' if number < 0: raise ValueError("the value of input must not be negative" ) _UpperCAmelCase = 0 while number: number &= number - 1 result += 1 ret...
579
1
import re from filelock import FileLock try: import nltk a__ = True except (ImportError, ModuleNotFoundError): a__ = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt""", quiet=True) def lowercase ( SCREAMING_SNAK...
477
"""simple docstring""" import argparse import importlib from pathlib import Path # Test all the extensions added in the setup SCREAMING_SNAKE_CASE_ = [ '''kernels/rwkv/wkv_cuda.cu''', '''kernels/rwkv/wkv_op.cpp''', '''kernels/deformable_detr/ms_deform_attn.h''', '''kernels/deform...
465
0
'''simple docstring''' class A : def __init__( self , SCREAMING_SNAKE_CASE = "" , SCREAMING_SNAKE_CASE = False ) -> None: """simple docstring""" A : dict[str, RadixNode] = {} # A node will be ...
343
'''simple docstring''' import numpy as np def lowerCAmelCase_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__ ): '''simple docstring''' A : Optional[Any] = int(np.ceil((x_end - xa) / h ) ) A...
343
1
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim im...
22
'''simple docstring''' import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class A ( _a ): lowercase_ = (DDPMParallelScheduler,) def __lowerCAmelCase ( self : ...
22
1
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def __UpperCamelCase ( a, a, a, a) ->int: lowerCamelCase__ = s.rsplit(a, a) return new.join(a) def __UpperCamelCase ( a) ->int: ...
360
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tok...
360
1
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipelin...
67
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_available() and...
205
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class A__ ( a__ ): '''simple docstring''' @staticmethod @abstractmethod def _SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE : int ): ...
710
from __future__ import annotations import math import random from typing import Any class A__ : '''simple docstring''' def __init__( self : str ): """simple docstring""" UpperCamelCase = [] ...
410
0
"""simple docstring""" import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex _A = logging.getLogger(__name__) class __UpperCAmelCase : """simple docstring""" def ...
505
"""simple docstring""" import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline UpperCamelCase : List[Any] = ...
690
0
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 A ( unittest.TestCase ): '''simp...
206
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def __lowerCAmelCase ( __magic_name__ ): def wrapper(*__magic_name__ , **__magic_name__ ): _lowercase: Union[str, Any] = timeit.defa...
206
1
from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, AttnProce...
57
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str , lowerCAmelCase_: str ): def get_matched_characters(lowerCAmelCase_: str , lowerCAmelCase_: str ) -> str: snake_case_ : Tuple = [] snake_case_ : Tuple = min(len(_stra ) ...
666
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ : int = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalD...
702
UpperCAmelCase_ : List[str] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] UpperCAmelCase_ : Any = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] UpperCAmelCase_ : Dict = { 0: "Sunday", 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", ...
232
0
"""simple docstring""" def lowercase__ ( snake_case_ :list[int] , snake_case_ :str ): __UpperCAmelCase = int(snake_case_ ) # Initialize Result __UpperCAmelCase = [] # Traverse through all denomination for denomination in reversed(snake_case_ ): ...
49
"""simple docstring""" from collections import deque class _UpperCAmelCase : def __init__( self : List[Any] , _lowercase : str , _lowercase : int , _lowercase : int ): __UpperCAmelCase = process_name # process name _...
49
1
import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkouts and running tests. _a: Optional[Any] = abspath(join(dirname(dirname(__file__)), """src""")) s...
719
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available from...
268
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/config.json", ...
59
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( __a , __a , __a = 10**-10 ) -> float: """simple docstring""" lowerCamelCase__: List[str] =a while Tru...
59
1
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_av...
433
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging __snake_case : Optional[Any] = '\\n\n' __snake_case : List[Any] = '\nPerplexity (PPL) is one of t...
433
1
"""simple docstring""" from math import sqrt def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__ ) -> int: a_ : Dict = 0 for i in range(1, int(sqrt(SCREAMING_SNAKE_CASE__ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE_CASE__ ): total += i + ...
237
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class snake_case_ ( a_ ): __lowerCA...
237
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a_ = { 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_avail...
707
"""simple docstring""" import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_C...
523
0
'''simple docstring''' from typing import Any def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , ) -> list: _validation( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , ...
75
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"""], ] ...
258
0
import os import sys import transformers lowerCAmelCase_: Tuple = "3" print("Python version:", sys.version) print("transformers version:", transformers.__version__) try: import torch print("Torch version:", torch.__version__) print("Cuda available:", torch.cuda.is_available()) print("Cuda version:...
700
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nes...
668
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Optional[Any] = logging.get_logger(__name__) UpperCAmelCase_ : Union[str, Any] = { 'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/re...
44
'''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_f...
442
0
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_star...
137
"""simple docstring""" from math import asin, atan, cos, radians, sin, sqrt, tan _SCREAMING_SNAKE_CASE : Dict = 637_8137.0 _SCREAMING_SNAKE_CASE : Any = 635_6752.31_4245 _SCREAMING_SNAKE_CASE : List[Any] = 637_8137 ...
137
1
'''simple docstring''' from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class __snake_case : '''simple docstring''' lowerCame...
38
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def UpperCamelCase__ ( __magic_name__ : str , __magic_name__ : List[Any]=None ) -> Union[str, Any]: ''...
38
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extra...
717
'''simple docstring''' A : List[str] = '\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' A : List[str] = [{'type': 'code', 'content': INS...
273
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE = {'processing_wav2vec2_with_lm': ['Wav2Vec2ProcessorWithLM']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys SC...
94
'''simple docstring''' import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class UpperCAmelCase_ ( __...
94
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipel...
703
"""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 UpperCAmelCase ( ): '''simple docstring''' raise RuntimeError('CUDA out of me...
133
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase = { 'configuration_roformer': ['ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', '...
201
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase ( __lowerCamelCase ): UpperCamelCase_ : int = (DDPMParallelScheduler,) def snake_case__ ( self :Any , **lowercase :str )...
201
1
from itertools import product def __lowerCamelCase ( _lowerCAmelCase , _lowerCAmelCase ) -> list[int]: _UpperCAmelCase = sides_number _UpperCAmelCase = max_face_number * dice_number _UpperCAmelCase = [0] * (max_total + 1) _UpperCAmelCase = 1 _UpperCAmelCase = rang...
719
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start...
129
0
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_param...
67
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ...
614
0
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeling_t...
713
def _lowercase ( lowercase__ , lowercase__ ): __lowerCAmelCase : Union[str, Any] = len(lowercase__ ) __lowerCAmelCase : Any = len(lowercase__ ) __lowerCAmelCase : str = [[False for _ in range(m + 1 )] for _ in range(n + 1 )] __low...
583
0
from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin @flax.struct.dataclass ...
590
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _lowerCamelCase ( UpperCamelCase ): """simple docstring""" ...
590
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "facebook/xmod-base": "...
706
from __future__ import annotations def _lowerCamelCase ( _a , _a , _a ): """simple docstring""" if (voltage, current, resistance).count(0 ) != 1: raise ValueError('''One and only one argument must be 0''' ) if resistance < 0: raise ValueError('''Resistance cannot be...
297
0
"""simple docstring""" from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class __magic_name__ ( SCREAMING_SNAKE_CASE__ ): UpperCamelCase_ = '''EncodecFeatureExtractor''' UpperCamelCase_ = ('''T5T...
353
"""simple docstring""" 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 A__ : List[Any] = logging.get_logger(__name...
353
1
'''simple docstring''' from __future__ import annotations from collections.abc import Callable def lowerCamelCase__ ( a , a , a , a = 100 , ): __snake_case = x_start __snake_case = fnc(a ) __snake_case = 0.0 for _ in range...
427
'''simple docstring''' # Copyright 2023 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 # ...
427
1
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowercase__ : Dict = 3 def a__ ( lowercase : Dict ) -> int: """simple docstring""" print('''Generating primitive root...
98
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __SCREAMING_SNAKE_CASE ( unittest.TestCase ): @require_torch ...
319
0
print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
25
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() __lowerCamelCase : int = logging.get_logger(__name__) __lowerCamelCase : int = { """post_extract_proj"...
25
1
'''simple docstring''' from __future__ import annotations import math def _UpperCamelCase (_lowerCamelCase : int )-> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number ...
24
import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax import jit from transformers imp...
524
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { 'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP/resolve/main/conf...
713
'''simple docstring''' from manim import * class __snake_case ( a__): def UpperCAmelCase_ ( self ): """simple docstring""" lowerCamelCase : Optional[int] = Rectangle(height=0.5, width=0.5 ) lowerCamelCase ...
449
0
import argparse import struct import unittest class _lowerCAmelCase : def __init__( self : Union[str, Any] , __snake_case : bytes ): lowerCamelCase :Any = data # Initialize hash values lowerCamelCase :List[Any] = [ ...
166
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def _lowerCamelCase ( a_ : Optional[int] , a_ : Optional[Any] , a_ : List[st...
166
1
from __future__ import annotations from collections.abc import Iterator class lowerCamelCase : """simple docstring""" def __init__( self , __UpperCamelCase ): A_ = value A_ = None A_ = None class lo...
608
def lowerCAmelCase ( snake_case__ : list )-> list: if len(snake_case__ ) <= 1: return lst A_ = 1 while i < len(snake_case__ ): if lst[i - 1] <= lst[i]: i += 1 else: A_ , A_ = lst[i], lst[i - 1] ...
608
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer lowercase : List[Any] = l...
649
from __future__ import annotations from math import ceil, floor, sqrt def _lowerCamelCase ( __A : int = 2_000_000 ) -> int: _UpperCAmelCase : list[int] = [0] _UpperCAmelCase : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ...
485
0
from collections import defaultdict def snake_case ( UpperCAmelCase : int ): A = 1 A = True for v in tree[start]: if v not in visited: ret += dfs(UpperCAmelCase ) if ret % 2 == 0: cuts.append(UpperCAmelCase ) return ret ...
720
from ...configuration_utils import PretrainedConfig class UpperCamelCase ( snake_case__ ): """simple docstring""" snake_case = "bert-generation" def __init__( self : Tuple ,_SCREAMING_SNAKE_CASE : Tuple=5_0_3_5_8 ,_SCREAMING_SNAKE_CASE : str=1_0_2_4 ...
110
0
"""simple docstring""" class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Optional[int] ) -> List[str]: A = 0 A = 0 A = {} def _SCREAMING_SNAKE_CASE ( self : int ,A_ : Optional[Any] ) -> int: if vertex...
91
import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ) if is_flax_available():...
576
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowercase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], """tokenization_transfo_xl""": ["""Transfo...
563
from __future__ import annotations import pandas as pd def _lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = [0] * no_of_processes A_ = [0] * no_of_processes ...
563
1
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : List[str] = (DDIMParallelScheduler,) __UpperCAmelCase : Tuple = (("...
81
"""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 = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
'''simple docstring''' from random import shuffle import tensorflow as tf from numpy import array def A_ ( snake_case , snake_case ): SCREAMING_SNAKE_CASE:Union[str, Any] = int(snake_case ) assert noofclusters < len(snake_case ) # Find out the dimensionalit...
465
'''simple docstring''' from ..utils import DummyObject, requires_backends class _snake_case ( metaclass=_a ): _A : Any = ['''torch''', '''torchsde'''] def __init__( self : Any ,*SCREAMING_SNAKE_CASE__ : int ,**SCREAMING_SNAKE_CASE__ ...
465
1
from __future__ import annotations def a__ ( lowercase__ ): '''simple docstring''' UpperCAmelCase_ =len(lowercase__ ) // 2 # choose the middle 3 elements UpperCAmelCase_ =lst[m - 1 : m + 2] # if middle element is peak ...
54
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common impo...
54
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 | Inp...
451
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, Dist...
451
1
def UpperCamelCase ( snake_case__ : str , snake_case__ : str ) -> bool: UpperCamelCase : List[str] = len(snake_case__ ) UpperCamelCase : Any = len(snake_case__ ) UpperCamelCase : int = [[False f...
40
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor __A = logging.get_logger(__name__) class UpperCAmelCase (_UpperCAmelCase ): """simple docstring""" def __init__( self , *_UpperCAmelCase ...
586
0
from __future__ import annotations lowerCamelCase__ = '''Muhammad Umer Farooq''' lowerCamelCase__ = '''MIT''' lowerCamelCase__ = '''1.0.0''' lowerCamelCase__ = '''Muhammad Umer Farooq''' lowerCamelCase__ = '''contact@muhammadumerfarooq.me''' lowerCamelCase__ = '''Alpha''' imp...
82
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 lowerCamelCase__ = { '''cola''': 2,...
82
1
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable _UpperCamelCase : Union[str, Any] = { '''configuration_gpt_neox_japanese''': ['''GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE...
599
'''simple docstring''' import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class SCREAMING_SNAKE_CASE__ ( _UpperCamelCase ): def A ( self : Optional[Any] , a_ : str ): ""...
69
0
import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, requ...
25
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() __lowerCamelCase : int = logging.get_logger(__name__) __lowerCamelCase : int = { """post_extract_proj"...
25
1
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
45
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ...
614
0
'''simple docstring''' from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def _SCREAMING_SNAKE_CASE ( ): _lowercase = [randint(-1000 , 1000 ) for i in range(10 )] _lowercase = ...
719
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase ...
572
0
import pytest import datasets # Import fixture modules as plugins __lowerCamelCase : List[Any] = ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def SCREAMING_SNAKE_CASE__ ( snake_case_, snake_case_ ) -> List[Any]: # Mark ...
416
from typing import Any class a : def __init__( self , __UpperCamelCase )-> List[str]: '''simple docstring''' A__ : Union[str, Any] =data A__ : Tuple =None def __repr__( self )-> str: '''simple docs...
416
1
import numpy as np def lowercase ( SCREAMING_SNAKE_CASE__ : np.ndarray ) -> np.ndarray: return 1 / (1 + np.exp(-vector )) def lowercase ( SCREAMING_SNAKE_CASE__ : np.ndarray ) -> np.ndarray: return vector * sigmoid(SCREAMING_SNAKE_CASE...
198
def lowercase ( SCREAMING_SNAKE_CASE__ : int = 1_000 ) -> int: _snake_case , _snake_case : str = 1, 1 _snake_case : List[Any] = 2 while True: _snake_case : Union[str, Any] = 0 _snake_case : int = fa + fa _snake_case , ...
198
1
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, RandomS...
216
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __A = { "configuration_pix2struct": [ "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Pix2StructConfig", "Pix2StructTextConfig", ...
59
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def A ( _lowerCamelCase , _lowerCamelCase=() , _lowerCamelCase=None , _lowerCamelCase="no...
704
import requests from bsa import BeautifulSoup def A ( _lowerCamelCase , _lowerCamelCase ): '''simple docstring''' _lowerCAmelCase : List[str] = BeautifulSoup(requests.get(_lowerCamelCase , params=_lowerCamelCase ).content ...
658
0
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CL...
598
from math import log from scipy.constants import Boltzmann, physical_constants _a : List[str] = 300 # TEMPERATURE (unit = K) def a_ ( __magic_name__ , __magic_name__ , __magic_name__ , ) -> float: """simple docstring""" ...
598
1
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class lowerCAmelCase__: '''simple docstring''' __snake_case = 42 # [batch_size x 3] __snake_case = 42 # [batch_size x 3] __snake_case = 42 # [batc...
381
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ =logging.get_logger(__name__) UpperCamelCase__ ={ 'kakaobrain/align-base': 'https://huggingface.co...
381
1
def _UpperCAmelCase (UpperCamelCase_ : list , UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): '''simple docstring''' if index == number_of_items: return 0 _lowerCAmelCase : Optional[A...
429
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _UpperCAmelCase (UpperCamelCase_ : int ): '''simple docstring''' _lowerCAmelCase : Optional[Any] = prime_factors(UpperCamelCase_ ) if is_square_free(UpperCame...
429
1
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer, AutoTokeni...
240
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase = {'configuration_wavlm': ['WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'WavLMConfig']} try: if not is_torch_available(): raise OptionalDependencyNotA...
240
1
class _A : # Public class to implement a graph '''simple docstring''' def __init__( self : Union[str, Any] , lowerCamelCase : int , lowerCamelCase : int , lowerCamelCase : list[list[bool]] ): '''simple docstring''' ...
402
from math import sqrt def snake_case_ ( _SCREAMING_SNAKE_CASE ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False # All primes number are in format o...
402
1
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaV...
715
import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict ) -> str: """simple docstring""" SCREAMING_SNAKE_CASE : List[str] = (0, 0) SCREAMING_SNAKE_CASE : Any = None SCREAMING_SN...
193
0
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel fr...
22
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class _A ( __magic_name__): def __init__( self , *_SCREAMING_SNAKE_CASE , **_SCREAMING_SNAKE_CASE ): ...
511
0
def lowerCamelCase_ ( UpperCamelCase_ ): _a : Any = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase_ ( UpperCamelCase_ ): _a : List[Any] = 0 while number > 0: _a : Optional...
706
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __UpperCAmelCase ...
249
0
'''simple docstring''' def lowercase__( _UpperCamelCase : int , _UpperCamelCase : list[int] , _UpperCamelCase : int )-> int: """simple docstring""" def count_of_possible_combinations(_UpperCamelCase : int ) -> int: if target < 0: return 0 ...
138
'''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 snake_case_ : Any = get_tests_dir('''fixtures/test...
138
1
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDic...
371
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 _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase =...
371
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { "go...
161
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _lowerCAmelCase ( lowercase : str , lowercase : str , **lowercase : Tuple ) ->Tuple: """simple docstring""" lowercase...
161
1
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers...
716
import numpy as np import qiskit def snake_case ( snake_case__ :int = 8 , snake_case__ :int | None = None) -> str: _A = np.random.default_rng(seed=snake_case__) # Roughly 25% of the qubits will contribute to the key. # So we take more than we ...
83
0
'''simple docstring''' def __A ( a_ : int ,a_ : float ,a_ : float ): return round(float(moles / volume ) * nfactor ) def __A ( a_ : float ,a_ : float ,a_ : float ): return round(float((moles * 0.0_8_2_1 * temperature) / (volume) ) ...
525
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCAmelCase = {"""tokenization_wav2vec2_phoneme""": ["""Wav2Vec2PhonemeCTCTokenizer"""]} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import ...
525
1
'''simple docstring''' from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging snake_c...
706
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case = logging.getLogger(__name__) snake_case = ...
568
0
'''simple docstring''' def lowercase_ ( _lowercase ) -> Dict: '''simple docstring''' lowerCamelCase_ : Union[str, Any] = 0 lowerCamelCase_ : str = len(_lowercase ) for i in range(n - 1 ): for j in range(i + 1 , _lowercase ): ...
422
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase : Optional[int] = logging.get_logger(__name__) __lowercase : Optional[int] = { '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/...
422
1
'''simple docstring''' from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_availa...
88
'''simple docstring''' import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class __SCREAMING_SNAKE_CASE ( lowercase_...
88
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase__ : Optional[int] ={ 'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'], 'tokenization_canine'...
101
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available...
392
0
'''simple docstring''' 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 ModelT...
425
'''simple docstring''' def _A ( A ) -> bool: return str(A ) == str(A )[::-1] def _A ( A ) -> int: return int(A ) + int(str(A )[::-1] ) def _A ( A = 1_0_0_0_0 ) -> int: lowercase : List[Any] ...
425
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 (snake_case__ , unittest.TestCase ): _UpperCamelCase = CTRLTokenizer _UpperCa...
492
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, requ...
550
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __SCREAMING_SNAKE_CASE = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: if not is_tokenizers_avai...
153
from typing import Dict, Iterable, 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_forma...
153
1
import warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...ut...
74
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import Tokeniz...
84
0
'''simple docstring''' import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def __UpperCamelCase ( __lowerCamelCase : Optional[int] ) -> Dict: ...
276
'''simple docstring''' lowercase__ = 65_521 def __UpperCamelCase ( __lowerCamelCase : str ) -> int: '''simple docstring''' _a = 1 _a = 0 for plain_chr in plain_text: _a = (a + ord(__lowerCamelCase )) % MOD_ADLER ...
276
1
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedK...
105
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 diffusers.utils...
544
0
import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ = 1 , lowerCamelCase_ = 1 , lowerCamelCase_ = 1.0E4 , lowerCamelCase_ = False , lowerCamelCase_ = 1.0 ...
423
import heapq import sys import numpy as np lowercase : Optional[int] = tuple[int, int] class __lowercase : """simple docstring""" def __init__( self ) -> List[str]: A : List[str] = [] A : s...
423
1