code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
1
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging a__ : List[str] = "\\n\n" a__ : Union[str, Any] = "\nPerplexity (PPL) is one of the most common metrics for ev...
642
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
1
a__ : Optional[Any] = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" a__ : Union[str, Any] = [{"type": "code", "content": INSTALL_CONTENT}] a__ ...
642
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
1
import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput a__ : Dict = "scheduler_config.json" class UpperCAmelCase__( lowerCam...
642
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
1
import math def _lowerCAmelCase ( ): lowercase__ = input('Enter message: ' ) lowercase__ = int(input(F'''Enter key [2-{len(A__ ) - 1}]: ''' ) ) lowercase__ = input('Encryption/Decryption [e/d]: ' ) if mode.lower().startswith('e' ): lowercase__ = enc...
642
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
1
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, ) from transformers.test...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
1
def _lowerCAmelCase ( A__ ): if not isinstance(A__ , A__ ) or number < 0: raise ValueError('Input must be a non-negative integer' ) lowercase__ = 0 while number: # This way we arrive at next set bit (next 1) instead of looping # through each...
642
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
1
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter a__ : Optional[int] = ...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
1
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a__ : Union[str, Any] = { "text_branch": "text_model", "audio_branch": "audio_model.audio_encoder", "attn": "attention.self", "self.proj": "outpu...
642
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
1
import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( A__ , A__ , A__ ): # Initialise PyTorch model lowercase__ = RemBertConfig...
642
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
1
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(">=", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.checkpoint.d...
642
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...util...
642
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
1
def _lowerCAmelCase ( A__ ): lowercase__ = set() # To detect a back edge, keep track of vertices currently in the recursion stack lowercase__ = set() return any( node not in visited and depth_first_search(A__ , A__ , A__ , A__ ) for no...
642
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
1
import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) a__ : Optional[Any] = models.Sequential() ...
642
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
1
import logging from transformers.configuration_utils import PretrainedConfig a__ : Any = logging.getLogger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : Tuple = "masked_bert" def __init__( self : Dict , low...
642
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, to...
642
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
1
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, D...
642
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checko...
642
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
1
a__ : str = [ "Audio", "Array2D", "Array3D", "Array4D", "Array5D", "ClassLabel", "Features", "Sequence", "Value", "Image", "Translation", "TranslationVariableLanguages", ] from .audio import Audio from .features import ArrayaD, ArrayaD, ArrayaD, ArrayaD, ...
642
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
1
import pytest import datasets # Import fixture modules as plugins a__ : Union[str, Any] = ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def _lowerCAmelCase ( A__ , A__ ): # Mark tests as "unit" by default if not marked as "integration" (or already mark...
642
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : Union[str, Any] = ["image_processor", "tokenizer"] A : Optional[int] =...
642
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
1
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class UpperCAmelCase__( unittest.TestCase ): '''simple docstring''' def UpperCAmelCase ( self :...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
1
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import StableD...
642
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
1
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def _lowerCAmelCase ( A__ = "laptop" ): lowercase__ = F'''https://www.amazon.in/laptop/s?k={product}''' lowercase__ = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_6...
642
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
1
from __future__ import annotations import math def _lowerCAmelCase ( A__ , A__ , A__ , A__ , A__ ): if depth < 0: raise ValueError('Depth cannot be less than 0' ) if not scores: raise ValueError('Scores cannot be empty' ) if depth == he...
642
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : Union[str, Any] = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } t...
642
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
1
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import ...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
1
from __future__ import annotations def _lowerCAmelCase ( A__ ): lowercase__ = [True] * limit lowercase__ = False lowercase__ = False lowercase__ = True for i in range(3 , int(limit**0.5 + 1 ) , 2 ): lowercase__ = i * 2 ...
642
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : Dict = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig", "CLIPSegVisionConfig", ...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
1
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
1
def _lowerCAmelCase ( A__ , A__ , A__ , A__ ): if height >= 1: move_tower(height - 1 , A__ , A__ , A__ ) move_disk(A__ , A__ ) move_tower(height - 1 , A__ , A__ , A__ ) def _lowerCAmelCase ( A__ ...
642
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
1
a__ : Any = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _lowerCAmelCase ( A__ , A__ , A__ , A__ ): # Return True if there is node that has not iterated. ...
642
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _lowerCAmelCase ( ): lowercase__ = ArgumentParser( description=( 'PyTorch TPU distributed training launch help...
642
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
1
def _lowerCAmelCase ( A__ ): lowercase__ = [0 for i in range(len(A__ ) )] # initialize interval's left pointer and right pointer lowercase__, lowercase__ = 0, 0 for i in range(1 , len(A__ ) ): # case when current index is inside the interval ...
642
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
1
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def _lowerCAmelCase ( A__ ): lowercase__ = [ 'decoder.version', 'decoder.output_projection.weight', '_float_tensor', 'd...
642
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
1
import math import sys import cva import numpy as np def _lowerCAmelCase ( A__ , A__ ): # For applying gaussian function for each element in matrix. lowercase__ = math.sqrt(A__ ) lowercase__ = 1 / (sigma * math.sqrt(2 * math.pi )) return cons * np.exp(-((img / sigm...
642
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
1
from __future__ import annotations from collections.abc import Generator def _lowerCAmelCase ( ): lowercase__ = {} lowercase__ = 2 while True: lowercase__ = factor_map.pop(A__ , A__ ) if factor: lowercase__ = factor + p...
642
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
1
import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _lowerCAmelCase ( A__ , A__ , A__ ): lowercase__ = 1.5 lowercase__ = int(factor * n...
642
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
1
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor a__ : Union[str, Any] = logging.get_logger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Tuple , *lowerCAmel...
642
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase ) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = ...
642
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : int = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP", "LlamaConfig"], } try:...
642
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
1
from __future__ import annotations from collections.abc import Iterator class UpperCAmelCase__: '''simple docstring''' def __init__( self : Tuple , lowerCAmelCase : int) -> None: """simple docstring""" lowercase__ = value lowercase__ =...
642
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
1
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase__( tf.keras.optimizers.schedules.LearningRateSchedule ):...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
1
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger a__ : Dict = "<<<<<<< This should probably be modified because it mentions: " a__ : Optional[Any] = "=====...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
1
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Tuple = "▁" a__ : Union[str, Any] = {"vocab_file": "spiece.model"} a__ :...
642
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
1
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def _lowerCAmelCase ( A__ ): lowercase__, lowercase__ = analyze_text(A__ ) lowercase__ = list(' ' + ascii_lowercase ) # what is our total sum of probabilities. ...
642
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
1
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResamplin...
642
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
1
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transfo...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a__ : Dict = logging.get_logger(__name__) a__ : Union[str, Any] = { "SenseTime/deformable-detr": "https://huggingface.co/sensetime/deformable-detr/resolve/...
642
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
1
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ , A__ , A__ , A__ , ): lowercase__ = len(A__ ) # If row is equal to the size of the board it means there are a queen in each row in # the current board (possible_board) if row == ...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
1
def _lowerCAmelCase ( A__ ): if isinstance(A__ , A__ ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(A__ , A__ ): raise TypeError('\'str\' object cannot be interpreted as an integer' ) if num == 0: ...
642
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
1
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
1
from __future__ import annotations a__ : str = tuple[int, int, int] a__ : int = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase a__ : int = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # -------------------------- default selection -----------...
642
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
1
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def _lowerCAmelCase ( ): lowercase__ = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], 'path': ['test_1.py', 'test_2.py', 'un...
642
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
1
def _lowerCAmelCase ( ): for n in range(1 , 1_000_000 ): yield n * (n + 1) // 2 def _lowerCAmelCase ( A__ ): lowercase__ = 1 lowercase__ = 2 while i * i <= n: lowercase__ = 0 while n % i == 0: n //=...
642
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils impo...
642
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
1
from copy import deepcopy class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : list[int] | None = None , lowerCAmelCase : int | None = None) -> None: """simple docstring""" if arr is None and size is not None...
642
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
642
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
1
class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' pass class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' pass class UpperCAmelCase__: '''simple docstring''' def __init__( self : str) -> Union[str, Any]: ...
642
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
1
import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from transformers import (...
642
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
1
from math import pow, sqrt def _lowerCAmelCase ( *A__ ): lowercase__ = len(A__ ) > 0 and all(value > 0.0 for value in values ) return result def _lowerCAmelCase ( A__ , A__ ): return ( round(sqrt(molar_mass_a / molar_mass_a ) , 6 ) if valida...
642
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
1
from typing import TYPE_CHECKING from ..utils import _LazyModule a__ : str = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ], "convert": ["export", "validate_model_...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
1
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets....
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
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, FEATURE_...
642
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
1
import random from .binary_exp_mod import bin_exp_mod def _lowerCAmelCase ( A__ , A__=1_000 ): if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd lowercase__ = n - 1 lowercase__ = 0 while d % 2 == 0: ...
642
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
1
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__v...
642
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
1
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def _lowerCAmelCase ( A__ ): lowercase__ = [ ...
642
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
1
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
1
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers.models.wavaveca...
642
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
1
import fire from utils import calculate_rouge, save_json def _lowerCAmelCase ( A__ , A__ , A__=None , **A__ ): lowercase__ = [x.strip() for x in open(A__ ).readlines()] lowercase__ = [x.strip() for x in open(A__ ).readlines()][: len(A__ )] lowercase__ = ...
642
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
1
import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple docstring''' A : L...
642
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
1
from __future__ import annotations import math def _lowerCAmelCase ( A__ , A__ , A__ , A__ , A__ ): if depth < 0: raise ValueError('Depth cannot be less than 0' ) if len(A__ ) == 0: raise ValueError('Scores cannot be empty' ) if depth =...
642
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : List[Any] = logging.get_logger(__name__) a__ : Dict = { "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/co...
642
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembe...
642
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
1
from math import sqrt def _lowerCAmelCase ( A__ ): lowercase__ = 0 for i in range(1 , int(sqrt(A__ ) + 1 ) ): if n % i == 0 and i != sqrt(A__ ): total += i + n // i elif i == sqrt(A__ ): total += i return total - n d...
642
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
1
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import...
642
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
1
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _lowerCAmelCase ( A__ ): if not is_accelerate_available(): return method lowercase__ = version.parse(accelerate.__version__ ).base_vers...
642
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
1
import argparse import math import traceback import dateutil.parser as date_parser import requests def _lowerCAmelCase ( A__ ): lowercase__ = {} lowercase__ = job['started_at'] lowercase__ = job['completed_at'] lowercase__ = date_parser.parse(A__ ) lowe...
642
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
1
import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def _lowerCAmelCase ( A__ , A__=1 ): if n_shave_prefix_segments >= 0: return ".".join(path.split('.' )[n_shave_prefix_segments:] ) else: return ".".jo...
642
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
1
import argparse from collections import defaultdict import yaml a__ : Optional[Any] = "docs/source/en/_toctree.yml" def _lowerCAmelCase ( A__ ): lowercase__ = defaultdict(A__ ) for doc in model_doc: counts[doc["local"]] += 1 lowercase__ = [key for ke...
642
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
1
import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation ...
642
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
1
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : Tuple = ["image_processor", "tokenizer"] A : List[Any] = "ChineseCL...
642
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
1
import argparse from collections import defaultdict def _lowerCAmelCase ( A__ , A__ , A__ , A__ , A__ ): lowercase__ = F'''{file}_{class_name}_{test_name}''' done_test[_id] += 1 with open(A__ , 'r' ) as f: lowercase__ = f.readlines() ...
642
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
1
import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor a__ : List[Any] = logging.get_logger(__name__) class UpperCAmelCase__( _lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[int] , *lowerCAmel...
700
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
0
import os from datetime import datetime as dt from github import Github a__ : int = [ "good first issue", "feature request", "wip", ] def _lowerCAmelCase ( ): lowercase__ = Github(os.environ['GITHUB_TOKEN'] ) lowercase__ = g.get_repo('huggingface/accelerat...
701
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
0
'''simple docstring''' import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline a__ : Union[str, Any] = { 'n_samples': 64, 'horizon': 32, 'num_inference_steps': 20, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use va...
702
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
0
a__ : List[str] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } def _lowerCAmelCase ( A__ , A__ , A__ ): lowercase__ = set() # keep track of all the pat...
703
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
0
from typing import Any class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : Any) -> Union[str, Any]: """simple docstring""" lowercase__ = data lowercase__ = None def __repr__( self : ...
704
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a__ : List[Any] = { "configuration_clip": [ "CLIP_PRETR...
705
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokenizers @require_to...
706
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
0
a__ : Dict = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_00_00)] def _lowerCAmelCase ( A__ ): lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squared += DIGITS_SQUARED[number ...
707
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
0
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_available from ...test_backbone_common import Bac...
708
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
0
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a__ : List[Any] = get_tests_dir("fixtures/...
709
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
0
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : Dict = (PNDMScheduler,) A : List[Any] = (("num_inference_steps", 50...
710
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
0
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCAmelCase__( lowerCam...
711
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
0