code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_confi...
612
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
1
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin UpperCamelCase = """ Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed ...
612
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
1
"""simple docstring""" UpperCamelCase = 256 # Modulus to hash a string UpperCamelCase = 1_000_003 def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: str ) -> bool: '''simple docstring''' _a = l...
612
"""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....
612
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """google/pix2struct-textcaps-base""": ( """h...
612
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sage...
612
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available UpperCamelCase = { """configuration_audio_spectrogram_transformer""": [ """AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_...
612
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
1
"""simple docstring""" import fire from utils import calculate_rouge, save_json def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str , UpperCamelCase_: Optional[Any]=None , **UpperCamelCase_: Optional[Any] ) -> Optio...
612
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
1
"""simple docstring""" import pprint import requests UpperCamelCase = """https://zenquotes.io/api""" def lowerCAmelCase ( ) -> list: '''simple docstring''' return requests.get(API_ENDPOINT_URL + "/today" ).json() def lowerCAme...
612
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
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 AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__...
612
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
1
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): imp...
612
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: str ) -> list: '''simple docstring''' _a = len(UpperCamelCase_ ) _a = [] for i in range(len(UpperCamelCase_ ) - pat_len + 1 ): _a ...
612
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, ...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
1
"""simple docstring""" from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_...
612
"""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_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
1
"""simple docstring""" from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: str ) -> list[int]: '''simple docstring''' return [ord(UpperCamelCase_ ) - 96 for elem in plain] def lowerCAmelCase ( UpperCamelCase_...
612
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase ( ) -> int: '''simple docstring''' _a = ArgumentParser( ...
612
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. 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/LICEN...
612
1
"""simple docstring""" import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.uti...
612
"""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_t...
612
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """dis...
612
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import Pat...
612
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
1
"""simple docstring""" from sklearn.metrics import mean_squared_error import datasets UpperCamelCase = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Gris...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
1
"""simple docstring""" from math import pi, sqrt, tan def lowerCAmelCase ( UpperCamelCase_: float ) -> float: '''simple docstring''' if side_length < 0: raise ValueError("surface_area_cube() only accepts non-negative values" ) return 6 * sid...
612
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
1
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokeniz...
612
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
1
"""simple docstring""" import datasets UpperCamelCase = """\ @InProceedings{conneau2018xnli, author = \"Conneau, Alexis and Rinott, Ruty and Lample, Guillaume and Williams, Adina and Bowman, Samuel R. and...
612
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. 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/LICEN...
612
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
1
"""simple docstring""" import os def lowerCAmelCase ( UpperCamelCase_: str = "matrix.txt" ) -> int: '''simple docstring''' with open(os.path.join(os.path.dirname(UpperCamelCase_ ) , UpperCamelCase_ ) ) as in_file: _a = in_fil...
612
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
1
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
"""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....
612
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase...
612
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
1
"""simple docstring""" from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: list[int] , UpperCamelCase_: int ) -> list[list[int]]: '''simple docstring''' _a = [] _a = [] _a = 0 _a = sum(Upper...
612
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sage...
612
1
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> bool: '''simple docstring''' _a = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(UpperCamelCase_ ) def ...
612
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: int ) -> bool: '''simple docstring''' if not isinstance(UpperCamelCase_ , UpperCamelCase_ ): raise ValueError("check_bouncy() accepts only integer arguments" ) _a = str(Upp...
612
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
1
"""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, get_resize_output_image_size, normalize, rescale, resize, to_...
612
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
1
"""simple docstring""" UpperCamelCase = 8.3_144_598 def lowerCAmelCase ( UpperCamelCase_: float , UpperCamelCase_: float ) -> float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less t...
612
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
1
"""simple docstring""" import os import pytest from attr import dataclass UpperCamelCase = """us-east-1""" # defaults region @dataclass class lowercase_ : A__ : str A__ : int = '''arn:aws:iam::558105141721:role/sagemaker_execution_role''' A__ : i...
612
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
1
"""simple docstring""" import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_...
612
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
1
"""simple docstring""" import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSa...
612
"""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_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
1
"""simple docstring""" import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available fr...
612
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig UpperCamelCase = { """google/tapas-base-finetuned-sqa""": ( """https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json""" ), """google/tapas-base-finetuned-wtq""": ( ...
612
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. 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/LICEN...
612
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """tanreinama/GPTSAN-2.8B-spout_is_uniform""": ( """https://huggingface.co/tanreinama/GPTSAN-...
612
"""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_t...
612
1
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, ...
612
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
1
"""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, rando...
612
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
1
"""simple docstring""" UpperCamelCase = { 0: """0""", 1: """1""", 2: """2""", 3: """3""", 4: """4""", 5: """5""", 6: """6""", 7: """7""", 8: """8""", 9: """9""", 10: """a""", 11: """b""", 12: """c""", 13: """d""", 14: """e""", 15...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
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_image_inputs if is_tor...
612
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
1
"""simple docstring""" import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class low...
612
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: int ) -> int: '''simple docstring''' _a = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCAmelCase ( UpperCamelCase_: int ) ...
612
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_conf...
612
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
1
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: str ) -> str | Literal[False]: '''simple docstring''' _a ...
612
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
1
"""simple docstring""" from __future__ import annotations UpperCamelCase = """#""" class lowercase_ : def __init__( self ) ->None: '''simple docstring''' _a = {} def lowerCamelCase__ ( self , a_ ) ->None: ...
612
"""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....
612
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
1
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sage...
612
1
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class lowercase_ : A__ : List[str] A__ : Optional[st...
612
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
1
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ...
612
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
1
"""simple docstring""" import re import string import numpy as np import datasets UpperCamelCase = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ UpperCamelCase =...
612
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: int ) -> str: '''simple docstring''' _a = [[] for _ in range(UpperCamelCase_ )] _a = key - 1 if key <= 0: raise ValueError("Height of grid...
612
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
1
"""simple docstring""" from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: str ) -> bool: '''simple docstring''' _a = get_failure_array(UpperCamelCase_ ) # 2) Step through text searchi...
612
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
1
"""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....
612
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
1
"""simple docstring""" import random from typing import Any def lowerCAmelCase ( UpperCamelCase_: list ) -> list[Any]: '''simple docstring''' for _ in range(len(UpperCamelCase_ ) ): _a = random.randint(0 , len(UpperCamelCase_ ...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
1
"""simple docstring""" from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder UpperCamelCase = datasets.utils.logging.get_logger(__name__) class lowercase_ (folder_based_builder.FolderBasedBu...
612
"""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_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
1
"""simple docstring""" def lowerCAmelCase ( ) -> Optional[Any]: '''simple docstring''' _a = 0 for i in range(1 , 1001 ): total += i**i return str(UpperCamelCase_ )[-10:] if __name__ == "__main__": print(solution())
612
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
1
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_ide...
612
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. 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/LICEN...
612
1
"""simple docstring""" import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset fr...
612
"""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_t...
612
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """kss...
612
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
1
"""simple docstring""" import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = {name: getattr(transfo...
612
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
1
"""simple docstring""" import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence f...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
1
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_commo...
612
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase = { """configuration_resnet""": ["""RESNET_PRETRAINED_CONFIG_ARCHIVE_...
612
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
1
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: list[int] , UpperCamelCase_: str ) -> list[int]: '''simple docstring''' _a = int(UpperCamelCase_ ) # Initialize Result _a = [] # Traverse through all denomination...
612
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = ['''image_processor''', '''tokenizer'''] A__ : Tuple = '...
612
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
1
"""simple docstring""" from math import isqrt def lowerCAmelCase ( UpperCamelCase_: int ) -> list[int]: '''simple docstring''' _a = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for ...
612
"""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....
612
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : List[str] = ['''torch'''] def __init__( self , *a_ , **a_ ) ->Tuple: '''simple docstring''' r...
612
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax im...
612
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sage...
612
1
"""simple docstring""" import argparse import json import subprocess def lowerCAmelCase ( UpperCamelCase_: Dict , UpperCamelCase_: Tuple ) -> str: '''simple docstring''' _a = [] _a = ( f'''curl -H "Accept: application/vn...
612
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
1
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: UpperCamelCase = None try: import msvcrt except ImportError: UpperCamelCase = None try: import fcntl except ImportError: Uppe...
612
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
1
"""simple docstring""" import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup UpperCamelCase = logging.get_logger(...
612
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
1
"""simple docstring""" import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_...
612
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
1
"""simple docstring""" class lowercase_ : def __init__( self , a_ ) ->None: '''simple docstring''' _a = len(a_ ) _a = [0] * len_array if len_array > 0: _a = array[0] for i in range(1 , a_ ): ...
612
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
1
"""simple docstring""" from collections.abc import Sequence def lowerCAmelCase ( UpperCamelCase_: Sequence[int] | None = None ) -> int: '''simple docstring''' if nums is None or not nums: raise ValueError("Input sequence should not be empty" )...
612
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase = { """configuration_vision_encoder_decoder""": ["""VisionEncoderDeco...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
612
"""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_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
1
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMul...
612
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
1
"""simple docstring""" import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serializatio...
612
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. 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/LICEN...
612
1
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: Any , UpperCamelCase_: Dict ) -> List[str]: '''simple docstring''' if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * ...
612
"""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_t...
612
1
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def lowerCAmelCase ( ) -> List[Any]: '''simple docstring''' import os as original_os from os import path as original_path from os imp...
612
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
1
"""simple docstring""" from PIL import Image def lowerCAmelCase ( UpperCamelCase_: Image , UpperCamelCase_: float ) -> Image: '''simple docstring''' def brightness(UpperCamelCase_: int ) -> float: return 128 + level + (c - 128)...
612
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
1
"""simple docstring""" print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """google/canine-s""": """https://huggingface.co/google/canine-s/resolve/main/config.json""", # S...
612
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
1
"""simple docstring""" import os from collections.abc import Iterator def lowerCAmelCase ( UpperCamelCase_: str = "." ) -> Iterator[str]: '''simple docstring''' for dir_path, dir_names, filenames in os.walk(UpperCamelCase_ ): _a = [d for...
612
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Optional[Any] = ['''onnx'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstring''' ...
612
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ra...
612
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
1
"""simple docstring""" from __future__ import annotations import time UpperCamelCase = list[tuple[int, int]] UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, ...
612
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
"""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....
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: list[str] ) -> str: '''simple docstring''' _a = "" for word_or_phrase in separated: if not isinstance(UpperCamelCase_ , UpperCamelCase_ ): ...
612
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
1
"""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 ( ...
612
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sage...
612
1
"""simple docstring""" import math import sys def lowerCAmelCase ( UpperCamelCase_: int ) -> int: '''simple docstring''' if number != int(UpperCamelCase_ ): raise ValueError("the value of input must be a natural number" ) if number < 0: ...
612
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
1
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging UpperCamelCa...
612
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
1
"""simple docstring""" from pathlib import Path import fire def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: str , UpperCamelCase_: int ) -> Optional[int]: '''simple docstring''' _a = Path(UpperCamelCase_ ) ...
612
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
1
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: str ) -> list[int]: '''simple docstring''' _a = [0 for i in range(len(UpperCamelCase_ ) )] # initialize interval's left pointer and right pointer _a , _a = 0, 0 for i...
612
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
1
"""simple docstring""" import numpy as np class lowercase_ : def __init__( self ) ->List[Any]: '''simple docstring''' _a = (0, 0) _a = None _a = 0 _a = 0 _a = 0 def __eq__( self ...
612
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
1
"""simple docstring""" import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files" , [ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "datase...
612
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
1
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
1