code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPR_CONTEXT_ENCODER...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> float: """simple docstring""" if density <= 0: raise ValueError("""Impossible fluid density""" ) if bulk_modulus <= 0: raise ValueError("""Impossible bulk modulus""" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main_...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
from math import pow def __A(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , ) -> tuple[int, int]: """simple docstring""" if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a solution. solutions...
612
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, SkipBatchSampler, SkipDataLoader, sk...
612
1
def __A(lowerCAmelCase ) -> list: """simple docstring""" _UpperCamelCase = int(lowerCAmelCase ) if n_element < 1: _UpperCamelCase = ValueError("""a should be a positive number""" ) raise my_error _UpperCamelCase = [1] _UpperCamelCase ,...
612
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
1
from __future__ import annotations import math class lowerCAmelCase__ : def __init__( self , a ) -> None: '''simple docstring''' _UpperCamelCase = size # approximate the overall size of segment tree with given value _Uppe...
612
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_modules import _PACKAGED_DATASETS_M...
612
1
import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowerCamelCase__ = "src/transformers" # This is to make sure the transformers module imported is the one in...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
import operator def __A(lowerCAmelCase , lowerCAmelCase = False , lowerCAmelCase = None ) -> list: """simple docstring""" _UpperCamelCase = operator.lt if reverse else operator.gt _UpperCamelCase = solution or [] if not arr: return solution _UpperCame...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, UNeta...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase__ ...
612
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_channel_dimension_format, ) from ...
612
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : List[str] = "upern...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
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_configuration_common import ConfigTest...
612
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 ( IMAGENET_STANDARD_MEAN, IMA...
612
1
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin lowerCamelCase__ = "\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2] ...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
lowerCamelCase__ = 256 # Modulus to hash a string lowerCamelCase__ = 100_0003 def __A(lowerCAmelCase , lowerCAmelCase ) -> bool: """simple docstring""" _UpperCamelCase = len(lowerCAmelCase ) _UpperCamelCase = len(lowerCAmelCase ) if p_len > t...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> Union[str, Any]: """simple docstring""" _UpperCamelCase = (boundary[1] - boundary[0]) / steps _UpperCamelCase = boundary[0] _UpperCamelCase = boundary[1] _UpperCamelCase = make_points(lowerCA...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available lowerCamelCase__ = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ASTConfig", ...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
import fire from utils import calculate_rouge, save_json def __A(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase=None , **lowerCAmelCase ) -> Any: """simple docstring""" _UpperCamelCase = [x.strip() for x in open(lowerCAmelCase ).readlines()] _UpperCamelCase ...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
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 lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = "▁"...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
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(): import torch if is_tf_available(): i...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> list: """simple docstring""" _UpperCamelCase = len(lowerCAmelCase ) _UpperCamelCase = [] for i in range(len(lowerCAmelCase ) - pat_len + 1 ): _UpperCamelCase = True for j in range(lowerCAmelCa...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
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, is_onnx_available, is_torc...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
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_to_tf import PTtoTFCommand from ....
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
from __future__ import annotations def __A(lowerCAmelCase ) -> list[int]: """simple docstring""" return [ord(lowerCAmelCase ) - 9_6 for elem in plain] def __A(lowerCAmelCase ) -> str: """simple docstring""" return "".join(chr(elem + 9_6 ) for elem in encoded ) de...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __A() -> Optional[int]: """simple docstring""" _UpperCamelCase = ArgumentParser( description=( """PyTorch T...
612
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, SkipBatchSampler, SkipDataLoader, sk...
612
1
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.utils.data import DataLoader, Random...
612
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "distilbert-base-uncased": "https://huggingface.co/...
612
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_modules import _PACKAGED_DATASETS_M...
612
1
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 PatchingSpec from ...tokenization_uti...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
from sklearn.metrics import mean_squared_error import datasets lowerCamelCase__ = "\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhof...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
from math import pi, sqrt, tan def __A(lowerCAmelCase ) -> float: """simple docstring""" if side_length < 0: raise ValueError("""surface_area_cube() only accepts non-negative values""" ) return 6 * side_length**2 def __A(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ) ...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
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_tokenization_common import TokenizerTest...
612
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_channel_dimension_format, ) from ...
612
1
import datasets lowerCamelCase__ = "\\n@InProceedings{conneau2018xnli,\n author = \"Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, Holger\n ...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
# 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/LICENSE-2.0 # # Unless required by app...
612
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 ( IMAGENET_STANDARD_MEAN, IMA...
612
1
import os def __A(lowerCAmelCase = "matrix.txt" ) -> int: """simple docstring""" with open(os.path.join(os.path.dirname(lowerCAmelCase ) , lowerCAmelCase ) ) as in_file: _UpperCamelCase = in_file.read() _UpperCamelCase = [[int(lowerCAmelCase ) for cel...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
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 pathlib import Path from urllib.pa...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
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 lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/mobilenet_v2...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
import math def __A(lowerCAmelCase ) -> bool: """simple docstring""" _UpperCamelCase = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(lowerCAmelCase ) def __A(lowerCAmelCase = 1 / 1_2_3_4_5 ) -> int: """simple docstring"...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
lowerCamelCase__ = 8.3_14_45_98 def __A(lowerCAmelCase , lowerCAmelCase ) -> float: """simple docstring""" if temperature < 0: raise Exception("""Temperature cannot be less than 0 K""" ) if molar_mass <= 0: raise Exception("""Molar mass cannot be less than or equal to 0 k...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
import os import pytest from attr import dataclass lowerCamelCase__ = "us-east-1" # defaults region @dataclass class lowerCAmelCase__ : UpperCamelCase_ : str UpperCamelCase_ : Union[str, Any] = "arn:aws:iam::558105141721:role/sagemaker_execution_role" Upper...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
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_common import ImageProcessingSavi...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
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 ( BitConfig, ViTHybridCo...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
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, SkipBatchSampler, SkipDataLoader, sk...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import con...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
from ...configuration_utils import PretrainedConfig lowerCamelCase__ = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas-base-finetun...
612
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, SkipBatchSampler, SkipDataLoader, sk...
612
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "tanreinama/GPTSAN-2.8B-spout_is_uniform": ( "https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.json" ...
612
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
1
import math def __A(lowerCAmelCase ) -> 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, all even numbers, all multiples of 3 are not primes return False # All primes n...
612
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_modules import _PACKAGED_DATASETS_M...
612
1
import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_torch_av...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
lowerCamelCase__ = { 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: "f", } def __A(lowerCAmelCase ) -> str: """simple docstring""" assert typ...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
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 lowerCAmelCase__ ( nn.Modul...
612
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_channel_dimension_format, ) from ...
612
1
def __A(lowerCAmelCase ) -> int: """simple docstring""" _UpperCamelCase = 1 for i in range(1 , num + 1 ): fact *= i return fact def __A(lowerCAmelCase ) -> int: """simple docstring""" _UpperCamelCase = 0 while number > 0: _Upper...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
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_configuration_common import ConfigTes...
612
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 ( IMAGENET_STANDARD_MEAN, IMA...
612
1
from __future__ import annotations from collections.abc import Sequence from typing import Literal def __A(lowerCAmelCase , lowerCAmelCase ) -> str | Literal[False]: """simple docstring""" _UpperCamelCase = list(lowerCAmelCase ) _UpperCamelCase = list(lowerCAme...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) from transformers.models.w...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
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_MAPPING from ...tokenization_utils ...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
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 lowerCAmelCase__ : UpperCamelCase_ : List[str] UpperCamelCase_ : Opt...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
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, ftp_get, ftp_head, get...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
import re import string import numpy as np import datasets lowerCamelCase__ = "\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n" lowerCamelCase__ = "\nArgs:\n predictions: List of predicte...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> str: """simple docstring""" _UpperCamelCase = [[] for _ in range(lowerCAmelCase )] _UpperCamelCase = key - 1 if key <= 0: raise ValueError("""Height of grid can't be 0 or negative""" ) if key == 1 or len(lowe...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> bool: """simple docstring""" _UpperCamelCase = get_failure_array(lowerCAmelCase ) # 2) Step through text searching for pattern _UpperCamelCase , _UpperCamelCase = 0, 0 #...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
# 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 # # Unless required by applicab...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
import random from typing import Any def __A(lowerCAmelCase ) -> list[Any]: """simple docstring""" for _ in range(len(lowerCAmelCase ) ): _UpperCamelCase = random.randint(0 , len(lowerCAmelCase ) - 1 ) _UpperCamelCase = random.randint(0 , len(lowe...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowerCamelCase__ = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase__ ( folder_based_builder.FolderBasedBuilderConfig ): ...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
def __A() -> Tuple: """simple docstring""" _UpperCamelCase = 0 for i in range(1 , 1_0_0_1 ): total += i**i return str(lowerCAmelCase )[-1_0:] if __name__ == "__main__": print(solution())
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
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_identified_filename, infer_shape...
612
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, SkipBatchSampler, SkipDataLoader, sk...
612
1
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 from transformers import DPRContext...
612
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "kssteven/ibert-roberta-base": "https://huggingface...
612
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_modules import _PACKAGED_DATASETS_M...
612
1
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = {name: getattr(transformers, name + "Fast") for name in SLOW_TO_FAS...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
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 from datasets.features import Arra...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
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_common import ModelTesterMixin, ids_te...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase__ = { "configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "ResNetConfig", "ResNetOnnxConfig"] } ...
612
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_channel_dimension_format, ) from ...
612
1
import math def __A(lowerCAmelCase ) -> list: """simple docstring""" _UpperCamelCase = [True] * n _UpperCamelCase = False _UpperCamelCase = False _UpperCamelCase = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): _UpperCa...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> list[int]: """simple docstring""" _UpperCamelCase = int(lowerCAmelCase ) # Initialize Result _UpperCamelCase = [] # Traverse through all denomination for denomination in reversed(lowerCAmelCase ): # Find d...
612
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 ( IMAGENET_STANDARD_MEAN, IMA...
612
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : List[str] = ["image_processor", "tokenizer"] UpperCamelCase_ : Union[str, Any] = "Chinese...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
from math import isqrt def __A(lowerCAmelCase ) -> list[int]: """simple docstring""" _UpperCamelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , lowerCAmelCase , lowerCAmelCase ): _U...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
from ..utils import DummyObject, requires_backends class lowerCAmelCase__ ( metaclass=__lowercase ): UpperCamelCase_ : List[str] = ["torch"] def __init__( self , *a , **a ) -> Any: '''simple docstring''' requires_backend...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
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 import FlaxTimestepEmbedding, FlaxT...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
import argparse import json import subprocess def __A(lowerCAmelCase , lowerCAmelCase ) -> Optional[int]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = ( F'curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer {token}"' ...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
import logging import os import threading import time try: import warnings except ImportError: lowerCamelCase__ = None try: import msvcrt except ImportError: lowerCamelCase__ = None try: import fcntl except ImportError: lowerCamelCase__ = None # Backward compatibility # ------...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
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 lowerCamelCase__ = logging.get_logger(__name__) class lowerCAmelCase_...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
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_configuration_common import Confi...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
class lowerCAmelCase__ : def __init__( self , a ) -> None: '''simple docstring''' _UpperCamelCase = len(a ) _UpperCamelCase = [0] * len_array if len_array > 0: _UpperCamelCase = array[0] ...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase__ = { "configuration_vision_encoder_decoder": ["VisionEncoderDecoderConfig", "VisionEncoderDecoderOnnxConfig"]...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
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 if is_torch_available(): impor...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
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, DPMSolverMultistepInverseScheduler, DPMSo...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
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.serialization import from_bytes, to_bytes fro...
612
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, SkipBatchSampler, SkipDataLoader, sk...
612
1
import math def __A(lowerCAmelCase , lowerCAmelCase ) -> Union[str, Any]: """simple docstring""" if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(lowerCAmelCase ) else: if x == 0: # 0 raised to any number is 0 retu...
612
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
1
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def __A() -> Optional[Any]: """simple docstring""" import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dirname as origi...
612
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_modules import _PACKAGED_DATASETS_M...
612
1
from PIL import Image def __A(lowerCAmelCase , lowerCAmelCase ) -> Image: """simple docstring""" def brightness(lowerCAmelCase ) -> float: return 1_2_8 + level + (c - 1_2_8) if not -255.0 <= level <= 255.0: raise ValueError("""level must be between -255.0 (black) and 255.0 (whit...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/canine-s": "https://huggingface.co/google/canine-s/resolve/main/config.json", # See all CANINE models at https://huggingface.co/models...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
import os from collections.abc import Iterator def __A(lowerCAmelCase = "." ) -> Iterator[str]: """simple docstring""" for dir_path, dir_names, filenames in os.walk(lowerCAmelCase ): _UpperCamelCase = [d for d in dir_names if d != """scripts""" and d[0] not in """._"""] f...
612
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_channel_dimension_format, ) from ...
612
1
from ..utils import DummyObject, requires_backends class lowerCAmelCase__ ( metaclass=__lowercase ): UpperCamelCase_ : int = ["onnx"] def __init__( self , *a , **a ) -> List[str]: '''simple docstring''' requires_backends...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...test_...
612
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 ( IMAGENET_STANDARD_MEAN, IMA...
612
1