code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) class _snake_case ( __lowercase ): snake_case__ = "encoder-decoder" snake_case__ = True def...
350
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''', '''uclanlp/visualbert-vqa-pre''': '''...
64
0
"""simple docstring""" import numpy as np def lowercase_ ( _lowerCamelCase: Tuple , _lowerCamelCase: Optional[Any] , _lowerCamelCase: Optional[int] , _lowerCamelCase: int , _lowerCamelCase: Optional[int] ) -> int: '''simple docstring''' __lowerCamelCase : U...
351
"""simple docstring""" from ...configuration_utils import PretrainedConfig class _snake_case ( a__ ): snake_case__ = "bert-generation" def __init__( self : Optional[int] , UpperCAmelCase : Dict=50358 , UpperCAmelCase : int=1024 , U...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: list , _lowerCamelCase: int = 0 ): '''simple docstring''' __lowerCamelCase : Optional[int] = length or len(_snake_case ) __lowerCamelCase : List[str] = False for i in...
352
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): ...
64
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { """roberta-base""": """https://huggingface.co/roberta-...
353
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __A = R''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. ...
64
0
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMixin class _snake_case (...
354
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils im...
64
0
"""simple docstring""" import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.t...
355
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Input value must be an 'int' type" ) __lowerCamelCase : Dict = 0 ...
64
0
"""simple docstring""" 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_axi...
356
"""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...
64
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''hustvl/yolos-small''...
357
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( _lowerCamelCase: np.ndarray ) -> bool: '''simple docstring''' return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCa...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: str ) -> List[Any]: '''simple docstring''' __lowerCamelCase : Union[str, Any] = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cu...
358
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['...
64
0
"""simple docstring""" import math import os import sys def lowercase_ ( _lowerCamelCase: str ) -> str: '''simple docstring''' __lowerCamelCase : Union[str, Any] = "" try: with open(_UpperCamelCase , "rb" ) as binary_file: ...
359
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-430m-pile''': '''https:/...
64
0
"""simple docstring""" import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class _snake_case : @property def lowerCamelCase__ ...
360
"""simple docstring""" import requests __A = '''YOUR API KEY''' def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str = giphy_api_key ) -> list: '''simple docstring''' __lowerCamelCase : Dict = "+".join(query.split() ) __lowerCamelCase ...
64
0
"""simple docstring""" __A = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0', 'huggi...
361
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
0
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( '''The `image_to_image.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionImg2ImgPipeline` instead.''' )
362
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 4000000 ) -> int: '''simple docstring''' __lowerCamelCase : Tuple = [0, 1] __lowerCamelCase : Union[str, Any] = 0 while fib[i] <= n: fib.append(fib[i] ...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: Optional[Any] ) -> Union[str, Any]: '''simple docstring''' __lowerCamelCase : Any = 0 while b > 0: if b & 1: res += a a +=...
363
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = set() __lowerCamelCase : Union[str, Any] = 0 __lowerCamelCase : Optional[Any] ...
64
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule __A = {'''tokenization_bertweet''': ['''BertweetTokenizer''']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys __A = _LazyModule(__name__, globals()[...
364
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> str | Literal[False]: '''simple docstring''' __lowerCamelCase : Optional[int] ...
64
0
import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset from transformers import AutoToke...
365
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: Optional[int]=7 ) -> int: '''simple docstring''' __lowerCamelCase : List[st...
64
0
from __future__ import annotations from math import pi def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float , _lowerCamelCase: float ) -> dict[str, float]: '''simple docstring''' if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("O...
366
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise Optiona...
64
0
"""simple docstring""" import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_co...
367
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decor...
64
0
"""simple docstring""" from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_...
368
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case ( a__ ): def __init__( self : Option...
64
0
"""simple docstring""" from __future__ import annotations import math def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int , _lowerCamelCase: bool , _lowerCamelCase: list[int] , _lowerCamelCase: float ) -> int: '''simple docstring''' if depth < 0: ...
369
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''google/efficie...
64
0
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": __A = pd.read_csv('''sample_data.csv''', header=None) __A = ...
370
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_r...
64
0
"""simple docstring""" from __future__ import annotations class _snake_case : def __init__( self : List[Any] , UpperCAmelCase : int ): __lowerCamelCase : List[Any] = data __lowerCamelCase : Node | None = ...
371
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
64
0
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet...
350
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''', '''uclanlp/visualbert-vqa-pre''': '''...
64
0
"""simple docstring""" import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __A = """.""" if __name__ == "__main__": __A = os.path.join(REPO_PATH, '''utils/documentation_tests.txt''') __A ...
351
"""simple docstring""" from ...configuration_utils import PretrainedConfig class _snake_case ( a__ ): snake_case__ = "bert-generation" def __init__( self : Optional[int] , UpperCAmelCase : Dict=50358 , UpperCAmelCase : int=1024 , U...
64
0
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = """▁""" __A = {"""vocab_f...
352
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): ...
64
0
"""simple docstring""" import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging __A = '''\ ''' __A = ''' Perplexity (PPL) is one of the most common metrics for evaluating language...
353
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __A = R''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. ...
64
0
from __future__ import annotations def lowercase_ ( _lowerCamelCase: Union[str, Any] ) -> Dict: '''simple docstring''' __lowerCamelCase : str = str(_lowerCAmelCase ) return len(_lowerCAmelCase ) == 9 and set(_lowerCAmelCase ) == set("123456789" ) def low...
354
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils im...
64
0
"""simple docstring""" import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class ...
355
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Input value must be an 'int' type" ) __lowerCamelCase : Dict = 0 ...
64
0
"""simple docstring""" from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator...
356
"""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...
64
0
"""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 __A = { "facebook/maskformer-swin-base-ade": ( "ht...
357
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( _lowerCamelCase: np.ndarray ) -> bool: '''simple docstring''' return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCa...
64
0
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: List[Any] = 100 ) -> Optional[int]: '''simple docstring''' __lowerCamelCase : Tuple = sum(i * i for i in range(1 , n + 1 ) ) __lowerCamelCase : Tuple = int(math...
358
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['...
64
0
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parametr...
359
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-430m-pile''': '''https:/...
64
0
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, A...
360
"""simple docstring""" import requests __A = '''YOUR API KEY''' def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str = giphy_api_key ) -> list: '''simple docstring''' __lowerCamelCase : Dict = "+".join(query.split() ) __lowerCamelCase ...
64
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { '''configuration_distilbert''': [ '...
361
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
0
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis...
362
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 4000000 ) -> int: '''simple docstring''' __lowerCamelCase : Tuple = [0, 1] __lowerCamelCase : Union[str, Any] = 0 while fib[i] <= n: fib.append(fib[i] ...
64
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = {'vocab_file': 'sente...
363
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = set() __lowerCamelCase : Union[str, Any] = 0 __lowerCamelCase : Optional[Any] ...
64
0
"""simple docstring""" import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import ca...
364
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> str | Literal[False]: '''simple docstring''' __lowerCamelCase : Optional[int] ...
64
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _snake_case ( __snake_case ): snake_case__ = ["image_processor", "tokenizer"] snake_case__ = "AutoImageProcessor" snake_case__ = "AutoTokenizer...
365
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: Optional[int]=7 ) -> int: '''simple docstring''' __lowerCamelCase : List[st...
64
0
from random import randint from tempfile import TemporaryFile import numpy as np def lowercase_ ( _lowerCamelCase: Optional[int] , _lowerCamelCase: Union[str, Any] , _lowerCamelCase: Any ) -> Dict: '''simple docstring''' __lowerCamelCase : Optional[Any] = ...
366
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise Optiona...
64
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig __A = logging.get_logger(__name__) __A = { '''Intel/dpt-large''': '''https://huggingface.co/Intel/dpt-large/resolve/main/config.json''', # See all ...
367
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decor...
64
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandi...
368
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case ( a__ ): def __init__( self : Option...
64
0
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class _snake_case ( a__ ): snake_case__ = (DDPMScheduler,) def lowerCamelCase__ ( self : Tuple , **UpperCAmelCase : Dict...
369
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''google/efficie...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> Dict: '''simple docstring''' __lowerCamelCase : list[list[int]] = [[0 for _ in range(_lowerCamelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): __lowerCamelCase : ...
370
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_r...
64
0
"""simple docstring""" import pprint import requests __A = "https://zenquotes.io/api" def lowercase_ ( ) -> Any: '''simple docstring''' return requests.get(API_ENDPOINT_URL + "/today" ).json() def lowercase_ ( ) -> Optional[int]: '''simple docstring''' ...
371
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
64
0
"""simple docstring""" from collections.abc import Sequence def lowercase_ ( _lowerCamelCase: Sequence[float] , _lowerCamelCase: float ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_SCREAMING_SNAKE_CASE ) ) def lowercase_ ( _lowerCamelCas...
350
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''', '''uclanlp/visualbert-vqa-pre''': '''...
64
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, r...
351
"""simple docstring""" from ...configuration_utils import PretrainedConfig class _snake_case ( a__ ): snake_case__ = "bert-generation" def __init__( self : Optional[int] , UpperCAmelCase : Dict=50358 , UpperCAmelCase : int=1024 , U...
64
0
"""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_...
352
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): ...
64
0
"""simple docstring""" from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowercase_ ( ) -> tuple[list[int], int]: '''simple docstring''' __lowerCamelCase : Dict = [randint(-1000 , ...
353
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __A = R''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. ...
64
0
class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Optional[int] , UpperCAmelCase : Dict ): __lowerCamelCase : str = name __lowerCamelCase : Dict = val def __...
354
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils im...
64
0
"""simple docstring""" from abc import ABC, abstractmethod from typing import List, Optional class _snake_case ( _lowerCamelCase ): def __init__( self : Dict ): # test for the above condition self.test() def lowerCamelCase__ ( se...
355
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Input value must be an 'int' type" ) __lowerCamelCase : Dict = 0 ...
64
0
"""simple docstring""" import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_atte...
356
"""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...
64
0
"""simple docstring""" import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import vers...
357
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( _lowerCamelCase: np.ndarray ) -> bool: '''simple docstring''' return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCa...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: List[Any] , _lowerCamelCase: Any , _lowerCamelCase: str ) -> List[Any]: '''simple docstring''' if len(_lowercase ) != len(_lowercase ): raise ValueError("The length of profit and weight must be same." ) ...
358
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['...
64
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_ava...
359
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-430m-pile''': '''https:/...
64
0
"""simple docstring""" import math class _snake_case : def lowerCamelCase__ ( self : Optional[Any] , UpperCAmelCase : Union[str, Any] , UpperCAmelCase : Any ): __lowerCamelCase : str = 0.0 __lowerCamelCase...
360
"""simple docstring""" import requests __A = '''YOUR API KEY''' def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str = giphy_api_key ) -> list: '''simple docstring''' __lowerCamelCase : Dict = "+".join(query.split() ) __lowerCamelCase ...
64
0
"""simple docstring""" import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: Union[str, Any] , **_lowerCamelCase: Union[str, Any] ) -> Any: '''simple docstring''' __lo...
361
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
0
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets __A = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr...
362
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 4000000 ) -> int: '''simple docstring''' __lowerCamelCase : Tuple = [0, 1] __lowerCamelCase : Union[str, Any] = 0 while fib[i] <= n: fib.append(fib[i] ...
64
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def lowercase_ ( _lowerCamelCase: list[list[float]] ) -> list[list[float]]: '''simple docstring''' __lowerCamelCase : Dict = Decimal # Check i...
363
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = set() __lowerCamelCase : Union[str, Any] = 0 __lowerCamelCase : Optional[Any] ...
64
0
"""simple docstring""" import math import random def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: bool = False ) -> float: '''simple docstring''' if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value __A ...
364
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> str | Literal[False]: '''simple docstring''' __lowerCamelCase : Optional[int] ...
64
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToken...
365
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: Optional[int]=7 ) -> int: '''simple docstring''' __lowerCamelCase : List[st...
64
0
import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkouts and running tests. __A = abspath(join(dirname(dirname(dirname(__file__))), '''src''')) sys.path.inser...
366
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise Optiona...
64
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_albert": ["ALBER...
367
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decor...
64
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __A = {'''configuration_fnet''': ['''FNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FNetConf...
368
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case ( a__ ): def __init__( self : Option...
64
0
"""simple docstring""" from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, ...
369
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''google/efficie...
64
0
"""simple docstring""" import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm mus...
370
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_r...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: Tuple ) -> List[str]: '''simple docstring''' if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(__a , __a ): raise TypeError("Input value must be a \'int\'...
371
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
64
0
"""simple docstring""" import os import unittest from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixi...
350
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''', '''uclanlp/visualbert-vqa-pre''': '''...
64
0
"""simple docstring""" import sys from collections import defaultdict class _snake_case : def __init__( self : Optional[Any] ): __lowerCamelCase : str = [] def lowerCamelCase__ ( self : int , UpperCAmelCase : Li...
351
"""simple docstring""" from ...configuration_utils import PretrainedConfig class _snake_case ( a__ ): snake_case__ = "bert-generation" def __init__( self : Optional[int] , UpperCAmelCase : Dict=50358 , UpperCAmelCase : int=1024 , U...
64
0
"""simple docstring""" import requests __A = """https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=""" def lowercase_ ( _lowerCamelCase: str ): '''simple docstring''' __lowerCamelCase : Dict = requests.get(_NEWS_API + bbc_news_api_key ).jso...
352
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): ...
64
0
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowercase_ ( ) -> int: '''simple docstring''' __lowerCamelCase : int = Argum...
353
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __A = R''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. ...
64
0
def lowercase_ ( _lowerCamelCase: List[str] = 1000 ) -> Dict: '''simple docstring''' return sum(e for e in range(3 , _lowerCamelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"""{solution() = }""")
354
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils im...
64
0
"""simple docstring""" import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def lowercase_ ( _lower...
355
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Input value must be an 'int' type" ) __lowerCamelCase : Dict = 0 ...
64
0
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from...
356
"""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...
64
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandi...
357
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( _lowerCamelCase: np.ndarray ) -> bool: '''simple docstring''' return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCa...
64
0
"""simple docstring""" import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import Tokenizer...
358
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['...
64
0
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFI...
359
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-430m-pile''': '''https:/...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: list , _lowerCamelCase: list , _lowerCamelCase: int ) -> int: '''simple docstring''' if len(_lowerCamelCase ) != len(_lowerCamelCase ): raise ValueError("The length of profit and weight must be same." ) ...
360
"""simple docstring""" import requests __A = '''YOUR API KEY''' def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str = giphy_api_key ) -> list: '''simple docstring''' __lowerCamelCase : Dict = "+".join(query.split() ) __lowerCamelCase ...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: List[str] = 1000000 ) -> int: '''simple docstring''' __lowerCamelCase : Any = 1 __lowerCamelCase : Optional[Any] = 1 __lowerCamelCase : List[str] ...
361
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import O...
362
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 4000000 ) -> int: '''simple docstring''' __lowerCamelCase : Tuple = [0, 1] __lowerCamelCase : Union[str, Any] = 0 while fib[i] <= n: fib.append(fib[i] ...
64
0
"""simple docstring""" import itertools import math def lowercase_ ( _lowerCamelCase: int ) -> Tuple: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # N...
363
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = set() __lowerCamelCase : Union[str, Any] = 0 __lowerCamelCase : Optional[Any] ...
64
0
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # n...
364
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> str | Literal[False]: '''simple docstring''' __lowerCamelCase : Optional[int] ...
64
0
from __future__ import annotations from math import gcd def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int = 2 , _lowerCamelCase: int = 1 , _lowerCamelCase: int = 3 , ) -> int | None: '''simple docstring''' if num < 2: raise ValueError("The inpu...
365
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: Optional[int]=7 ) -> int: '''simple docstring''' __lowerCamelCase : List[st...
64
0
from __future__ import annotations def lowercase_ ( _lowerCamelCase: Optional[int] , _lowerCamelCase: Union[str, Any] , _lowerCamelCase: Any ) -> Optional[int]: '''simple docstring''' __lowerCamelCase : Tuple = list(range(len(_lowerCamelCase ) ) ) __...
366
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise Optiona...
64
0
"""simple docstring""" import sys import turtle def lowercase_ ( _lowerCamelCase: tuple[float, float] , _lowerCamelCase: tuple[float, float] ) -> tuple[float, float]: '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowercase_ ( _lowerCamelC...
367
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decor...
64
0
"""simple docstring""" import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = {'''vocab_f...
368
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case ( a__ ): def __init__( self : Option...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: Optional[Any] ) -> Union[str, Any]: '''simple docstring''' _enforce_args(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) if n == 0: return 0 __lowerCamelCase : ...
369
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''google/efficie...
64
0
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from .....
370
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_r...
64
0
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _snake...
371
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Input value must be an 'int' type" ) __lowerCamelCase : Dict = 0 while number...
350
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''', '''uclanlp/visualbert-vqa-pre''': '''...
64
0
"""simple docstring""" from string import ascii_lowercase, ascii_uppercase def lowercase_ ( _lowerCamelCase: str ) -> str: '''simple docstring''' if not sentence: return "" __lowerCamelCase : List[str] = dict(zip(_lowerCamelCase , _lower...
351
"""simple docstring""" from ...configuration_utils import PretrainedConfig class _snake_case ( a__ ): snake_case__ = "bert-generation" def __init__( self : Optional[int] , UpperCAmelCase : Dict=50358 , UpperCAmelCase : int=1024 , U...
64
0
"""simple docstring""" import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common im...
352
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): ...
64
0
"""simple docstring""" import argparse import os # New Code # 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 ...
353
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __A = R''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. ...
64
0
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str , **_lowerCamelCase: Dict ) -> str: '''simple docstring''' __lowerCamelCase : Optional[Any] = AutoConfig.from...
354
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils im...
64
0
"""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...
355
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Input value must be an 'int' type" ) __lowerCamelCase : Dict = 0 ...
64
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''distilbert-base-uncased''': '''https://huggingface....
356
"""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...
64
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configur...
357
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( _lowerCamelCase: np.ndarray ) -> bool: '''simple docstring''' return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCa...
64
0
"""simple docstring""" import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils impor...
358
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['...
64
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: list ) -> list: '''simple docstring''' if len(_lowerCamelCase ) <= 1: return [tuple(_lowerCamelCase )] __lowerCamelCase : Union[str, Any] = [] def generate(_lowerCamelCase: int...
359
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-430m-pile''': '''https:/...
64
0
"""simple docstring""" from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class _snake_case : def lowerCamelCase__ ( self : Optional[int] , UpperCAmelCase : List[str] ): ra...
360
"""simple docstring""" import requests __A = '''YOUR API KEY''' def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str = giphy_api_key ) -> list: '''simple docstring''' __lowerCamelCase : Dict = "+".join(query.split() ) __lowerCamelCase ...
64
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''facebook/xglm-564M''': '''https://huggingface.co/facebook/xglm-564M/resolve/main/config.json''', # See all XGLM models at https:...
361
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
0