code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration _lowercase : Dict = HfArgumentParser(InitializationArguments) _lowercase : Optional[int] = parser.parse_arg...
239
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
1
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _lowercase : Tuple = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of ...
239
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
1
'''simple docstring''' import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if ve...
239
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
1
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
1
'''simple docstring''' import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_...
239
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils i...
239
'''simple docstring''' import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
1
'''simple docstring''' import os import sys import unittest _lowercase : List[str] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, c...
239
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
1
'''simple docstring''' from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __magic_name__ ( _UpperCAmelCase): def __init__( self : Optional[int] , lowercase_ ...
239
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
1
'''simple docstring''' import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _lowercase : List[Any] = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRo...
239
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, ra...
239
1
'''simple docstring''' from __future__ import annotations _lowercase : Dict = [] def lowerCamelCase ( UpperCAmelCase__ : list[list[int]] , UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: for i in range(len(Upp...
239
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
1
'''simple docstring''' import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoToke...
239
'''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 b...
239
1
'''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....
239
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
1
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
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, Tensor...
239
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
1
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() _lowercase : L...
239
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : List[str] = logging.get_logger(__name__) _lowercase : Optional[Any] = { "google/vivit-b-16x2-kinetics400": ( "https://huggingface.co/google/vivit-b-16x2-k...
239
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
1
'''simple docstring''' import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patc...
239
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
1
'''simple docstring''' import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def lowerCamelCase ( UpperCAmelCase__ : Optional[int] , UpperCAmelCase__ : str , UpperCAmelCase__ : Optiona...
239
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list[int] , UpperCAmelCase__ : list[int] ) -> tuple[float, float]: # Check if the input is valid if not len(UpperCAmelCase__ ) == len(UpperCAmelCase__ ) == 3: raise ValueError...
239
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
1
'''simple docstring''' import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase ( UpperCAmelCase__ : Opt...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
1
'''simple docstring''' _lowercase : Optional[Any] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def lowerCamelCase ( ) -> None: lowercase_ : Tuple = input("""Enter message: """ ) lowercase_ : Union[str, Any] = input("""Enter key [alphanu...
239
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
1
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : str = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig", ...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
1
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig _lowercase : List[Any] = logging.get_logger(__name__) _lowercase : List[str] ...
239
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
1
'''simple docstring''' import collections import importlib.util import os import re from pathlib import Path _lowercase : List[str] = "src/transformers" # Matches is_xxx_available() _lowercase : str = re.compile(r"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {x...
239
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase ...
239
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
1
'''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 __magic_name__ ( _UpperCAmelCase, un...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class __magic_name__ ( metaclass=_UpperCAmelCase): UpperCamelCase__ = ['''torch''', '''scipy'''] def __init__( self : Optional[Any] , *lowercase_ : Optional[int] , **lowercase_ : Li...
239
'''simple docstring''' import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
1
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __magic_name__ ( uni...
239
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
1
'''simple docstring''' from __future__ import annotations import queue class __magic_name__ : def __init__( self : List[str] , lowercase_ : int ): lowercase_ : str = data lowercase_ : Tuple = None lowerc...
239
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
1
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: lowercase_ : List[str] = os.path.join(args.tf_m...
239
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, ra...
239
1
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging _lowercase : Tuple ...
239
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
1
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTeste...
239
'''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 b...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule _lowercase : Dict = {"processing_wav2vec2_with_lm": ["Wav2Vec2ProcessorWithLM"]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys _lowerc...
239
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
1
'''simple docstring''' import math import random def lowerCamelCase ( UpperCAmelCase__ : float , UpperCAmelCase__ : bool = False ) -> float: if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value _low...
239
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int = 10 , UpperCAmelCase__ : int = 22 ) -> int: lowercase_ : Optional[Any] = range(1 , UpperCAmelCase__ ) lowercase_ : str = range(1 ...
239
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
1
'''simple docstring''' from torch import nn class __magic_name__ ( nn.Module): def __init__( self : Optional[Any] , lowercase_ : Tuple , lowercase_ : str ): super().__init__() lowercase_ : Any = class_size lowerca...
239
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : str ) -> list: return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(UpperCAmelCase__ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__("doct...
239
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
1
'''simple docstring''' from math import factorial def lowerCamelCase ( UpperCAmelCase__ : int = 100 ) -> int: return sum(int(UpperCAmelCase__ ) for x in str(factorial(UpperCAmelCase__ ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").stri...
239
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
1
'''simple docstring''' import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
239
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
1
'''simple docstring''' import warnings 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 comput...
239
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
1
'''simple docstring''' import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __magic_name__ ( unittest.TestCase): def SCREAMING_SNAKE_CASE_ ( self : Any )...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
1
'''simple docstring''' # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] , UpperCAmelCase__ : Dict , UpperCAmelCase__ : List[Any] ) -> Union[str, Any]: lowe...
239
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
1
'''simple docstring''' import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
239
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase : List[Any] = { "configuration_mobilebert": [ "MOBILEBERT_PRETRAINE...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
1
'''simple docstring''' from ....utils import logging _lowercase : Dict = logging.get_logger(__name__) class __magic_name__ ( _UpperCAmelCase): def __init__( self : List[Any] , lowercase_ : List[str] , lowercase_ : Any=None , lowercase_ : Lis...
239
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
1
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() _lowercase ...
239
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
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 ...
239
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
1
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int = 100 ) -> int: lowercase_ : Any = sum(i * i for i in range(1 , n + 1 ) ) lowercase_ : str = int(math.pow(sum(range(1 , n + 1 ) ...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
1
'''simple docstring''' from __future__ import annotations import math class __magic_name__ : def __init__( self : int , lowercase_ : int ): lowercase_ : Union[str, Any] = size # approximate the overall size of segment tree with given ...
239
'''simple docstring''' import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
1
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __magic_name__ ( unittest.TestCase): ...
239
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
1
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
1
'''simple docstring''' from __future__ import annotations import numpy as np def lowerCamelCase ( UpperCAmelCase__ : list[float] ) -> Union[str, Any]: return np.maximum(0 , UpperCAmelCase__ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # -...
239
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, ra...
239
1
'''simple docstring''' from scipy.stats import pearsonr import datasets _lowercase : str = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies o...
239
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase : List[Any] = { "configuration_convbert": ["CONVBERT_PRETRAINED_CONFIG_ARCH...
239
'''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 b...
239
1
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
1
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_p...
239
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
1
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
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 __magic_name__ ( _UpperCAmelCase): def __ini...
239
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
1
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets _lowercase : Optional[Any] = datasets.logging.get_logger(__name__) _lowercase : List[str] = "\\n@inproceedings{bleurt,\n title={BLEURT: Learning R...
239
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
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 ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def lowerCamelCase ( UpperCAmelCase__ ...
239
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
1
'''simple docstring''' import baseaa def lowerCamelCase ( UpperCAmelCase__ : str ) -> bytes: return baseaa.aaaencode(string.encode("""utf-8""" ) ) def lowerCamelCase ( UpperCAmelCase__ : bytes ) -> str: return baseaa.aaadecode(UpperCAme...
239
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
1
'''simple docstring''' import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging _lowercase : List[Any] = logging.get_logger(__name__) def lowerCamelCase ( UpperCAmelCase__ ...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
1
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings _lowercase : List[Any] ...
239
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
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 YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosi...
239
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int ) -> list[int]: if num <= 0: raise ValueError("""Input must be a positive integer""" ) lowercase_ : Tuple = [True] * (num + 1) lowercase_ : int = ...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : float , UpperCAmelCase__ : float , UpperCAmelCase__ : int ) -> float: if principal <= 0: raise Exception("""Principal borrowed must be > 0""" ) if rate_per_...
239
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_d...
239
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
1
'''simple docstring''' from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": _lowercase : int = input("Enter image url: ").strip() print(f"""Downloading image from {url} ...""") _lowercase : List[str] = BeautifulSoup(...
239
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
1
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_w...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
1
'''simple docstring''' import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from trans...
239
'''simple docstring''' import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
1
'''simple docstring''' from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge _lowercase : int = [ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw ...
239
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
1
'''simple docstring''' import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def lowerCamelCase ( UpperCAmelCase__ : List[Any] ) -> Dict: monkeypatch.setattr("""datasets.utils.deprecation_utils._emitted_deprecation_warnings""" , ...
239
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, ra...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> int: return int((input_a, input_a).count(0 ) == 0 ) def lowerCamelCase ( ) -> None: assert and_gate(0 , 0 ) == 0 ass...
239
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
1
'''simple docstring''' _lowercase : List[str] = { "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"...
239
'''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 b...
239
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedToke...
239
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
1
'''simple docstring''' import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowercase : Union[str, Any] = {"configuration_unispeech": ["UNISPEECH_PRETRAINED_CONFIG_ARCHIVE...
239
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : float , UpperCAmelCase__ : float ) -> float: return round(float(moles / volume ) * nfactor ) def lowerCamelCase ( UpperCAmelCase__ ...
239
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise ValueError("""multiplicative_persistence() only accepts integral values""" ) if num < 0: raise...
239
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
1
'''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_video_inputs if is_torch_avai...
239
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) _lowercase : List[Any] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Beit...
239
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
1
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
1
'''simple docstring''' import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def lowerCamelCase ( *UpperCAmelCase__ : Any , UpperCAmelCase__ : Optional[Union[Dict, Any]] = None , UpperCAmelCase__ : ...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
1
'''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 ...
239
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
1
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_prop...
239
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
1
'''simple docstring''' import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : Union[str, Any] = ...
239
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
1
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _lowercase : Optional[int] = logging.get_logger(__name__) _lowercase : Optional[int] = { "nielsr/canine-s": 2048, } # ...
239
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Tuple = { "configuration_bridgetower": [ "BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP", "BridgeTowerConfi...
239
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : List[Any] ) -> Union[str, Any]: return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], ...
239
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
1
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __magic_name__ (...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list[int] ) -> int: if not numbers: return 0 if not isinstance(UpperCAmelCase__ , (list, tuple) ) or not all( isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) for n...
239
'''simple docstring''' import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
1
'''simple docstring''' import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def lowerCamelCase ( UpperCAmelCase__ : Optional[in...
239
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
1
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : Optional[int] ) -> Optional[int]: lowercase_ : int = [0] * len(UpperCAmelCase__ ) lowercase_ : Optional[int] = [] lowercase_ : List[str] = [...
239
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
1
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( _UpperCAmelCase): UpperCamelCase__ = (DDPMScheduler,) def SCREAMING_SNAKE_CASE_ ( self : Dict , **lowercase_ : Un...
239
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, ra...
239
1
'''simple docstring''' import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_check...
239
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
1