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
"""simple docstring""" import argparse import os from accelerate.utils import ComputeEnvironment from .cluster import get_cluster_input from .config_args import cache_dir, default_config_file, default_yaml_config_file, load_config_from_file # noqa: F401 from .config_utils import _ask_field, _ask_options, _conve...
703
"""simple docstring""" import os def snake_case ( ) -> Optional[Any]: with open(os.path.dirname(UpperCamelCase__ ) + """/grid.txt""" ) as f: lowerCamelCase : int = [] # noqa: E741 for _ in range(20 ): l.append([int(UpperCame...
42
0
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_tor...
704
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import ...
42
0
"""simple docstring""" import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case ( UpperCamelCase__ : bytes , UpperCamelCase__ : int ) -> np.array: lowerCamelCase : List[str] =...
705
"""simple docstring""" import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atten...
42
0
"""simple docstring""" import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __lowerCamelCase :str = get_tests_dir...
706
"""simple docstring""" import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __lowerCamelCase :str = get_tests_dir...
42
0
import math import tensorflow as tf from packaging import version def snake_case ( UpperCamelCase__ : List[Any] ) -> Tuple: lowerCamelCase : Optional[Any] = tf.convert_to_tensor(UpperCamelCase__ ) lowerCamelCase : List[str] = 0.5 * (1.0 + ...
707
"""simple docstring""" __lowerCamelCase :List[Any] = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} __lowerCamelCase :Union[str, Any] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def snake_case ( UpperCamelCase__ : dict[int, list[int]] , UpperCamelCase__ ...
42
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device...
708
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase :str = logging.get_logger(__name__) __lowerCamelCase :Any = { 'huggingface/time-series-transformer-tourism-monthly': ( ...
42
0
"""simple docstring""" def snake_case ( UpperCamelCase__ : int = 4000000 ) -> int: lowerCamelCase : List[Any] = [0, 1] lowerCamelCase : Optional[Any] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib...
709
"""simple docstring""" from __future__ import annotations __lowerCamelCase :int = 10 def snake_case ( UpperCamelCase__ : list[int] ) -> list[int]: lowerCamelCase : int = 1 lowerCamelCase : Union[str, Any] = max(UpperCamelCase__ ...
42
0
"""simple docstring""" import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def snake_case ( UpperCamelCase__ : ...
710
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def snake_case ( UpperCamelCase__ : Optional[Any] ...
42
0
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
711
"""simple docstring""" import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.te...
42
0
"""simple docstring""" from __future__ import annotations import math def snake_case ( UpperCamelCase__ : float , UpperCamelCase__ : int ) -> float: lowerCamelCase : Dict = u for i in range(1 , UpperCamelCase__ ): lower...
712
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCamelCase :Optional[Any] = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', 'EncodecConfig', ...
42
0
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class A__ ( datasets.BuilderConfig): """simple docstring""" snake_case__ : Opti...
713
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
42
0
"""simple docstring""" import json import sys def snake_case ( UpperCamelCase__ : Any , UpperCamelCase__ : Tuple ) -> Tuple: with open(UpperCamelCase__ , encoding="""utf-8""" ) as f: lowerCamelCase : str = json.load(UpperCa...
714
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase :Optional[int] = logging.get_logger(__name__) __lowerCamelCase :List[str] = { 'google/realm-cc-news-pretrained-embedder': ( 'https://huggingface.co/google/real...
42
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass class A__ ...
715
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase :Tuple = logging.get_logger(__name__) __lowerCamelCase :Any = { 'vinvino02/glpn-kitti': 'https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json', # S...
42
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase :str = { 'configuration_resnet': ['RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ResN...
716
"""simple docstring""" from __future__ import annotations import math def snake_case ( UpperCamelCase__ : float , UpperCamelCase__ : int ) -> float: lowerCamelCase : Dict = u for i in range(1 , UpperCamelCase__ ): lower...
42
0
"""simple docstring""" import math class A__ : """simple docstring""" def a__ ( self: str , __a: list[list[float]] , __a: list[int] )-> int: lowerCamelCase : Dict = 0.0 lowerCamelCase : Tuple = 0.0 for...
717
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __lowerCamelCase :str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvai...
42
0
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class A__ ( __lowercase): """simple docstring""" snake_case__ : Tuple =(KDPMaDiscreteScheduler,) sn...
718
"""simple docstring""" import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from...
42
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...featu...
719
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class A__ ( __lowercase): """simple docstring""" snake_case__ : Tuple =(KDPMaDiscreteScheduler,) sn...
42
0
"""simple docstring""" def snake_case ( UpperCamelCase__ : int ) -> bool: if num < 0: return False lowerCamelCase : int = num lowerCamelCase : int = 0 while num > 0: lowerCamelCase : Optional[Any] ...
720
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImga...
42
0
"""simple docstring""" import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated __lowerCamelCase :str = collections.namedtuple('_...
721
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identifie...
42
0
'''simple docstring''' 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 ( _UpperCamelC...
43
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : str , _UpperCamelCase : list[str] ): '''simple docstring''' UpperCAmelCase_ = '''''' for word_or_phrase in separated: if not isinstance(_UpperCamelCase , _UpperCamelCase ...
43
1
'''simple docstring''' lowercase__ : Dict = [0, 2, 4, 6, 8] lowercase__ : str = [1, 3, 5, 7, 9] def __lowerCamelCase ( _UpperCamelCase : int , _UpperCamelCase : int , _UpperCamelCase : list[int] , _UpperCamelCase : int ): ''...
43
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import...
43
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase__ : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDep...
43
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : int = logging.get_logger(__name__) lowercase__ : List[str] = { "huggingface/time-series-transformer-tourism-monthly": (...
43
1
'''simple docstring''' from collections.abc import Callable def __lowerCamelCase ( _UpperCamelCase : Callable[[float], float] , _UpperCamelCase : float , _UpperCamelCase : float ): '''simple docstring''' UpperCAmelCase_ = a UpperCAmelCase_ ...
43
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : List[Any] = "T5Config" class ...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : list , _UpperCamelCase : int = 0 ): '''simple docstring''' UpperCAmelCase_ = length or len(_UpperCamelCase ) UpperCAmelCase_ = False for i in range(length - 1 ): ...
43
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets lowercase__ : str = datasets.logging.get_logger(__name__) lowercase__ : Dict = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and ...
43
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_...
43
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMix...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : int = 100 ): '''simple docstring''' UpperCAmelCase_ = n * (n + 1) * (2 * n + 1) / 6 UpperCAmelCase_ = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__...
43
'''simple docstring''' 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 f...
43
1
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : List[str] = { "vocab_file": "voca...
43
'''simple docstring''' from collections.abc import Callable def __lowerCamelCase ( _UpperCamelCase : Callable[[float], float] , _UpperCamelCase : float , _UpperCamelCase : float ): '''simple docstring''' UpperCAmelCase_ = a UpperCAmelCase_ ...
43
1
'''simple docstring''' import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class lowerCamelCase ( lowerCamelCase ): '''simple docstri...
43
'''simple docstring''' import re def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' return [char.split() for char in re.split(R'''[^ a-z A-Z 0-9 \s]''' , str_ )] def __lowerCamelCase ( _UpperCamelCase : str ): '''simple d...
43
1
'''simple docstring''' lowercase__ : List[Any] = { "a": "AAAAA", "b": "AAAAB", "c": "AAABA", "d": "AAABB", "e": "AABAA", "f": "AABAB", "g": "AABBA", "h": "AABBB", "i": "ABAAA", "j": "BBBAA", "k": "ABAAB", "l": "ABABA", "m": "ABABB", "n": "ABBAA", ...
43
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_...
43
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( A...
43
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowercase__ : Tuple = pytest.mark.integration @pytest.mark.parametrize('...
43
1
'''simple docstring''' import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowercase__ : List[str] = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path", default=Non...
43
'''simple docstring''' import collections import os import re from pathlib import Path lowercase__ : List[Any] = "src/transformers" # Matches is_xxx_available() lowercase__ : Optional[Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} lowerc...
43
1
'''simple docstring''' import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput lowercase__ : Dict = logging.getLogger(__name__) if is_torch_tp...
43
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( _UpperCamelCase : tuple[int, int] , _UpperCamelCase : int ): '''simple docstring''' UpperCAmelCase_ , UpperCAmelCase_ = position UpperCAmelCase_ = [ ...
43
1
'''simple docstring''' import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowercase__ : int = version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def __lowerCamelC...
43
'''simple docstring''' from __future__ import annotations from typing import TypedDict class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = 42 lowerCAmelCase__ = 42 def __lowerCamelCase ( _UpperCamelCase : str ): ...
43
1
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, Reg...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase__ : Union[str, Any] = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_A...
43
1
'''simple docstring''' import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRIN...
43
'''simple docstring''' lowercase__ : Union[str, Any] = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" lowercase__ : str = [{"type": "code", "con...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : Optional[int] ): '''simple docstring''' UpperCAmelCase_ = len(_UpperCamelCase ) for i in range(length - 1 ): UpperCAmelCase_ = i for k in range(i + 1 , ...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ : Optional[Any] = { "configuration_encodec": [ "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP", "EncodecConfig", ]...
43
1
'''simple docstring''' # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's easier to...
43
'''simple docstring''' from heapq import heappop, heappush import numpy as np def __lowerCamelCase ( _UpperCamelCase : np.ndarray , _UpperCamelCase : tuple[int, int] , _UpperCamelCase : tuple[int, int] , _UpperCamelCase : bool , ): '''simple docstring'...
43
1
'''simple docstring''' from __future__ import annotations from typing import TypedDict class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = 42 lowerCAmelCase__ = 42 def __lowerCamelCase ( _UpperCamelCase : str ): ...
43
'''simple docstring''' import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase ( lowerCamelCase , unittest....
43
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : Optional[int] = logging.get_logger(__name__) lowercase__ : Any = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", ...
43
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def __lowerCamelCase ( _UpperCamelCase : Union[str, Any] ): '''simple docstring''' for param in module.parameters(): UpperCAmelCase_ = False def __lowerCame...
43
1
'''simple docstring''' from collections.abc import Sequence def __lowerCamelCase ( _UpperCamelCase : Sequence[int] | None = None ): '''simple docstring''' if nums is None or not nums: raise ValueError('''Input sequence should not be empty''' ) UpperCAmelCase_ ...
43
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @require...
43
1
'''simple docstring''' import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def _...
43
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cach...
43
1
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def __lowerCamelCase ( _UpperCamelCase : Union[str, Any] ): '''simple docstring''' for param in module.parameters(): UpperCAmelCase_ = False def __lowerCame...
43
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : str , _UpperCamelCase : list[str] ): '''simple docstring''' UpperCAmelCase_ = '''''' for word_or_phrase in separated: if not isinstance(_UpperCamelCase , _UpperCamelCase ...
43
1
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_availabl...
43
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import...
43
1
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from...
43
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : int = logging.get_logger(__name__) lowercase__ : List[str] = { "huggingface/time-series-transformer-tourism-monthly": (...
43
1
'''simple docstring''' from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import st...
43
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : List[Any] = "T5Config" class ...
43
1
'''simple docstring''' import os def __lowerCamelCase ( ): '''simple docstring''' with open(os.path.dirname(_UpperCamelCase ) + '''/grid.txt''' ) as f: UpperCAmelCase_ = [] # noqa: E741 for _ in range(20 ): l.append([int(_...
43
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets lowercase__ : str = datasets.logging.get_logger(__name__) lowercase__ : Dict = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and ...
43
1
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase__ : List[str] = { "facebook/maskformer-swi...
43
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMix...
43
1
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' UpperCAmelCase...
43
'''simple docstring''' 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 f...
43
1
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator class lowerCamelCase : '''simple docstring''' def __init__( self : Optional[Any] , UpperCAmelCase__ : int ) ->None: UpperCAmelCase_ = value ...
43
'''simple docstring''' from collections.abc import Callable def __lowerCamelCase ( _UpperCamelCase : Callable[[float], float] , _UpperCamelCase : float , _UpperCamelCase : float ): '''simple docstring''' UpperCAmelCase_ = a UpperCAmelCase_ ...
43
1
'''simple docstring''' import math def __lowerCamelCase ( _UpperCamelCase : float , _UpperCamelCase : float ): '''simple docstring''' if initial_intensity < 0: raise ValueError('''The value of intensity cannot be negative''' ) # handling of neg...
43
'''simple docstring''' import re def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' return [char.split() for char in re.split(R'''[^ a-z A-Z 0-9 \s]''' , str_ )] def __lowerCamelCase ( _UpperCamelCase : str ): '''simple d...
43
1
'''simple docstring''' from manim import * class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Any ) ->Dict: UpperCAmelCase_ = Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase_ = Rect...
43
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_...
43
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : Tuple = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.js...
43
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowercase__ : Tuple = pytest.mark.integration @pytest.mark.parametrize('...
43
1
'''simple docstring''' # using dfs for finding eulerian path traversal def __lowerCamelCase ( _UpperCamelCase : Tuple , _UpperCamelCase : Dict , _UpperCamelCase : Optional[Any] , _UpperCamelCase : List[str]=None ): '''simple docstring''' UpperCAmelCa...
43
'''simple docstring''' import collections import os import re from pathlib import Path lowercase__ : List[Any] = "src/transformers" # Matches is_xxx_available() lowercase__ : Optional[Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} lowerc...
43
1
'''simple docstring''' from math import ceil def __lowerCamelCase ( _UpperCamelCase : int = 1001 ): '''simple docstring''' UpperCAmelCase_ = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): UpperCAmelCase_ = 2 * i + 1 ...
43
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( _UpperCamelCase : tuple[int, int] , _UpperCamelCase : int ): '''simple docstring''' UpperCAmelCase_ , UpperCAmelCase_ = position UpperCAmelCase_ = [ ...
43
1
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase__ : Optional[int] = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-traine...
43
'''simple docstring''' from __future__ import annotations from typing import TypedDict class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = 42 lowerCAmelCase__ = 42 def __lowerCamelCase ( _UpperCamelCase : str ): ...
43
1
'''simple docstring''' import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def __lowerCamelCase ( _UpperCamelCase : List[str] ): '''simple docstring''' UpperCAmelCase_ = args.pruning_met...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase__ : Union[str, Any] = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_A...
43
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging ...
43
'''simple docstring''' lowercase__ : Union[str, Any] = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" lowercase__ : str = [{"type": "code", "con...
43
1
'''simple docstring''' 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_MA...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ : Optional[Any] = { "configuration_encodec": [ "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP", "EncodecConfig", ]...
43
1
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowercase__ : Tuple = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}...
43
'''simple docstring''' from heapq import heappop, heappush import numpy as np def __lowerCamelCase ( _UpperCamelCase : np.ndarray , _UpperCamelCase : tuple[int, int] , _UpperCamelCase : tuple[int, int] , _UpperCamelCase : bool , ): '''simple docstring'...
43
1
'''simple docstring''' import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowercase__ : List[Any] = object() # For specifying empty leaf dict `{}` lowercase__ : str =...
43
'''simple docstring''' import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase ( lowerCamelCase , unittest....
43
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitC...
43
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def __lowerCamelCase ( _UpperCamelCase : Union[str, Any] ): '''simple docstring''' for param in module.parameters(): UpperCAmelCase_ = False def __lowerCame...
43
1
'''simple docstring''' import os import jsonlines import numpy as np from tqdm import tqdm lowercase__ : Dict = 2048 lowercase__ : Dict = 4096 lowercase__ : List[Any] = 42 lowercase__ : List[str] = os.environ.pop("PROCESS_TRAIN", "false") lowercase_...
43
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @require...
43
1
'''simple docstring''' import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_devic...
43
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cach...
43
1
'''simple docstring''' import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model...
43
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : str , _UpperCamelCase : list[str] ): '''simple docstring''' UpperCAmelCase_ = '''''' for word_or_phrase in separated: if not isinstance(_UpperCamelCase , _UpperCamelCase ...
43
1
'''simple docstring''' import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_u...
43
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import...
43
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : Tuple = logging.get_logger(__name__) class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = '''timm_backbone''' ...
43
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : int = logging.get_logger(__name__) lowercase__ : List[str] = { "huggingface/time-series-transformer-tourism-monthly": (...
43
1
'''simple docstring''' import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( '''split_dict''' , [ SplitDict(), SplitDict({'''train''': SplitInfo(name='''train''' , num_bytes=1337 , num_exampl...
43
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : List[Any] = "T5Config" class ...
43
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : str = logging.get_logger(__name__) lowercase__ : Optional[Any] = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class lowerCamel...
43
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets lowercase__ : str = datasets.logging.get_logger(__name__) lowercase__ : Dict = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and ...
43
1
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time lowercase__ : str = Lock() def __lowerCamelCase ( _UpperCamelCase : Dict , _UpperCamelCase : int , _UpperCamelCase ...
43
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMix...
43
1
'''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 _REALM_BLOCK_RECORDS_...
43
'''simple docstring''' 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 f...
43
1
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor i...
43
'''simple docstring''' from collections.abc import Callable def __lowerCamelCase ( _UpperCamelCase : Callable[[float], float] , _UpperCamelCase : float , _UpperCamelCase : float ): '''simple docstring''' UpperCAmelCase_ = a UpperCAmelCase_ ...
43
1
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM...
43
'''simple docstring''' import re def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' return [char.split() for char in re.split(R'''[^ a-z A-Z 0-9 \s]''' , str_ )] def __lowerCamelCase ( _UpperCamelCase : str ): '''simple d...
43
1
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNot...
43
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_...
43
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ : Any = { "configuration_convbert": ["CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP...
43
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowercase__ : Tuple = pytest.mark.integration @pytest.mark.parametrize('...
43
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowercase__ : Tuple = logging.get_logger(__name__) class lowerCamelCase ( lowerCamelCase ): '''simple docstr...
43
'''simple docstring''' import collections import os import re from pathlib import Path lowercase__ : List[Any] = "src/transformers" # Matches is_xxx_available() lowercase__ : Optional[Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} lowerc...
43
1
'''simple docstring''' import numpy as np def __lowerCamelCase ( _UpperCamelCase : np.array ): '''simple docstring''' return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
43
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( _UpperCamelCase : tuple[int, int] , _UpperCamelCase : int ): '''simple docstring''' UpperCAmelCase_ , UpperCAmelCase_ = position UpperCAmelCase_ = [ ...
43
1
'''simple docstring''' import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class lowerCamelCase ( lowerCamelCase , unittest.TestCase ): '''simple docstring''' lowe...
43
'''simple docstring''' from __future__ import annotations from typing import TypedDict class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = 42 lowerCAmelCase__ = 42 def __lowerCamelCase ( _UpperCamelCase : str ): ...
43
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase__ : Union[str, Any] = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_A...
43
1
'''simple docstring''' import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding ...
43
'''simple docstring''' lowercase__ : Union[str, Any] = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" lowercase__ : str = [{"type": "code", "con...
43
1
'''simple docstring''' import math def __lowerCamelCase ( _UpperCamelCase : int ): '''simple docstring''' return math.sqrt(_UpperCamelCase ) * math.sqrt(_UpperCamelCase ) == num def __lowerCamelCase ( _UpperCamelCase : int ): '''simple docstring'...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ : Optional[Any] = { "configuration_encodec": [ "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP", "EncodecConfig", ]...
43
1
'''simple docstring''' import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin lowercase__ : str = "\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbo...
43
'''simple docstring''' from heapq import heappop, heappush import numpy as np def __lowerCamelCase ( _UpperCamelCase : np.ndarray , _UpperCamelCase : tuple[int, int] , _UpperCamelCase : tuple[int, int] , _UpperCamelCase : bool , ): '''simple docstring'...
43
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase__ : Union[str, Any] = logging.get_logger(__name__) lowercase__ : Union[str, Any] ...
43
'''simple docstring''' import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase ( lowerCamelCase , unittest....
43
1
'''simple docstring''' import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): impo...
43
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def __lowerCamelCase ( _UpperCamelCase : Union[str, Any] ): '''simple docstring''' for param in module.parameters(): UpperCAmelCase_ = False def __lowerCame...
43
1
'''simple docstring''' import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def __lowerCamelCase ( _UpperCam...
43
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @require...
43
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ : Optional[Any] = { "configuration_encodec": [ "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP", "EncodecConfig", ]...
43
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cach...
43
1
'''simple docstring''' from unittest.mock import Mock, patch from file_transfer.send_file import send_file @patch('''socket.socket''' ) @patch('''builtins.open''' ) def __lowerCamelCase ( _UpperCamelCase : str , _UpperCamelCase : Any ): '''simple docstring''' Upp...
43
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : str , _UpperCamelCase : list[str] ): '''simple docstring''' UpperCAmelCase_ = '''''' for word_or_phrase in separated: if not isinstance(_UpperCamelCase , _UpperCamelCase ...
43
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enab...
43
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import...
43
1
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='''session''' ) def __lowerCamelCase ( ...
43
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : int = logging.get_logger(__name__) lowercase__ : List[str] = { "huggingface/time-series-transformer-tourism-monthly": (...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : int = 6008_5147_5143 ): '''simple docstring''' try: UpperCAmelCase_ = int(_UpperCamelCase ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castab...
43
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : List[Any] = "T5Config" class ...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : list ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): raise ValueError('''Input series is not valid, valid series - [2, 4, 6]''' ) if len(_UpperCamelCase ...
43
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets lowercase__ : str = datasets.logging.get_logger(__name__) lowercase__ : Dict = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and ...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : int , _UpperCamelCase : int ): '''simple docstring''' return 1 if input_a == input_a else 0 def __lowerCamelCase ( ): '''simple docstring''' assert xnor_gate(0 , 0 ) =...
43
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMix...
43
1
'''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 ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils import lo...
43
'''simple docstring''' 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 f...
43
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase__ : int = { "configuration_graphormer": ["GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "GraphormerConfig"], } try: ...
43
'''simple docstring''' from collections.abc import Callable def __lowerCamelCase ( _UpperCamelCase : Callable[[float], float] , _UpperCamelCase : float , _UpperCamelCase : float ): '''simple docstring''' UpperCAmelCase_ = a UpperCAmelCase_ ...
43
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : int = { "bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/c...
43
'''simple docstring''' import re def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' return [char.split() for char in re.split(R'''[^ a-z A-Z 0-9 \s]''' , str_ )] def __lowerCamelCase ( _UpperCamelCase : str ): '''simple d...
43
1
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : Dict...
43
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : int ): '''simple docstring''' UpperCAmelCase_ = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
43
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowercase__ : Tuple = pytest.mark.integration @pytest.mark.parametrize('...
43
1
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = (CMStochasticIterativeScheduler,) lowerCAmelCase__ ...
43
'''simple docstring''' import collections import os import re from pathlib import Path lowercase__ : List[Any] = "src/transformers" # Matches is_xxx_available() lowercase__ : Optional[Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} lowerc...
43
1
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : int ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): UpperCAmelCase_ = F"""Input value of [number={number}] must be an integer""" raise TypeE...
43
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( _UpperCamelCase : tuple[int, int] , _UpperCamelCase : int ): '''simple docstring''' UpperCAmelCase_ , UpperCAmelCase_ = position UpperCAmelCase_ = [ ...
43
1
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowercase__ : Tuple = pytest.mark.integration @pytest.mark.parametrize('...
43
'''simple docstring''' from __future__ import annotations from typing import TypedDict class lowerCamelCase ( lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = 42 lowerCAmelCase__ = 42 def __lowerCamelCase ( _UpperCamelCase : str ): ...
43
1
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDisc...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase__ : Union[str, Any] = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_A...
43
1