code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import TimmBac...
358
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
0
import unittest import numpy as np def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , __a = None , ): snake_case_ : List[str] = np.shape(__a ) snake_case_ : Optional[Any] = np.shape(__a ) snake_case_ : List[str] = np.shape(__...
359
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
0
from ....utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Optional[int] , _A : Union[str, Any]=None , _A : List[Any]=2048 ) ->...
360
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
0
"""simple docstring""" from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a ): if num <= 0: snake_case_ : Dict = f"""{num}: Invalid input, please enter a positive integer.""" raise ValueError(__a ) snake_case_ : ...
361
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
0
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = len(__a ) for i in range(length - 1 ): snake_case_ : Optional[int] = i for k in range(i + 1 , __a ): if collection[k] < collection[least]: snake_case_ : List[str] ...
362
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
0
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( __a ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection snake_case_ : Dict = len(__a ) snake_case_ : Optional[int] =...
363
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
0
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import ...
364
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
0
def SCREAMING_SNAKE_CASE__ ( __a = 10**9 ): snake_case_ : str = 1 snake_case_ : int = 2 snake_case_ : Optional[int] = 0 snake_case_ : List[str] = 0 snake_case_ : List[Any] = 0 while perimeter <= max_perimeter...
365
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
0
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(__a ) == 0: raise ValueError('Input list must be a non empty list' ) if len(__a ) == 1: return True snake_case...
366
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
0
import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuratio...
367
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_comm...
88
0
import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Tuple = 1.5 snake_case_ ...
368
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
369
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
0
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_co...
370
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
0
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from di...
371
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
0
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
350
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
0
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available ...
351
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
0
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_comm...
352
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
0
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> Any: ...
353
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
0
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _SCREAMING_SNAKE_CASE = 0B10_11_00_11_11_10_11_00_10_01_00_00_01_11_10_1...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
0
"""simple docstring""" _SCREAMING_SNAKE_CASE = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def SCREAMING_SNAKE_CASE__ ( __a ): # Make sure the supplied data is a bytes-like object if not isinstance(__a , __a ): snake_case_ : ...
355
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ 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. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
0
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem _SCREAMING_SNAKE_CASE = importlib.util.find_spec("""s3fs""") is not None if _has_safs: from .s...
356
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if not isinstance(__a , __a ): snake_case_ : str = f"""Expected string as input, found {type(__a )}""" raise ValueError(__a ) if not isinstance(__a , __a ): snake_case_ : int = f...
88
0
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ : Any ...
357
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
0
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
358
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : str = f"""{sampling_rate}""" snake_case_ : Any = '1' snake_case_ : O...
359
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
0
import comet # From: unbabel-comet import torch import datasets _SCREAMING_SNAKE_CASE = datasets.logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = """\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon}, ...
360
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
0
"""simple docstring""" from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance _SCREAMING_SNAKE_CASE = 6_37_81_37.0 _SCREAMING_SNAKE_CASE = 6_35_67_52.31_42_45 _SCREAMING_SNAKE_CASE = 6_37_81_37 def SCREAMING_SNAKE_CA...
361
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
0
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block @da...
362
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) ...
363
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
0
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( __a = None ): if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) snake_case_ : Tuple = nums[0] for i in range(1 , len(__a ) ): snake_...
364
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = ...
365
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer _SCREAMING_SNAKE_CASE = logging.get_logger(__name_...
366
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
0
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
367
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_comm...
88
0
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CASE__ ( ): s...
368
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
0
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchau...
369
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
0
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. _SCREAMING_SNAKE_CASE = 10 def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , __a ) -> Li...
370
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_pegasus_x""": ["""PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PegasusXConfig"""], } try: if not is_torch_available...
371
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
0
from ....configuration_utils import PretrainedConfig from ....utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """Visual-Attention-Network/van-base""": ( """https://huggingface.co/Visual-Attention-Network/van-base/blob/m...
350
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
0
def SCREAMING_SNAKE_CASE__ ( __a , __a ): 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__": import doctest doctest.test...
351
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
0
from __future__ import annotations from typing import TypedDict class SCREAMING_SNAKE_CASE_ ( snake_case_ ): __magic_name__: str __magic_name__: int def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('The paramete...
352
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
0
import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_property from...
353
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
0
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _SCREAMING_SNAKE_CASE = { """E""": 12.70, """T""": 9.0_6, """A""": 8.1_7, """O""": 7.5_1, """I""": 6.9_7, """N""": 6.7_5, """S""": 6.3_3, """H""": 6.0_9, """R""": 5.9_9...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
0
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( __a , __a ): if digit_amount > 0: return round(number - int(__a ) , __a ) return number - int(__a ) if __name__ == "__main__": print(decimal_isolate(1.5_3, 0)) print(decimal_isolate(35.3_45,...
355
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ 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. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
0
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=loggi...
356
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if not isinstance(__a , __a ): snake_case_ : str = f"""Expected string as input, found {type(__a )}""" raise ValueError(__a ) if not isinstance(__a , __a ): snake_case_ : int = f...
88
0
from maths.prime_check import is_prime def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): snake_case_ : Dict = f"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if is_prime(__a ) and is_prime(number + 2 ): re...
357
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
0
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params impo...
358
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
0
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalD...
359
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
0
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Tuple = len(__a ) # We need to create solution object to save path. snake_case_ : Dict = [[0 for _ in range(__a )] for _ in range(__a )] snake_case_ : ...
360
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
0
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import Pr...
361
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
0
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch ...
362
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
0
"""simple docstring""" import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from ....
363
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
0
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
364
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {"""configuration_opt""": ["""OPT_PRETRAINED_CONFIG_AR...
365
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
0
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch ...
366
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTok...
367
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_comm...
88
0
import math import os import sys def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[str] = '' try: with open(__a , 'rb' ) as binary_file: snake_case_ : int = binary_file.read() for dat in data: snake_case_ : int = f"""{dat:08b}""" ...
368
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
0
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before ...
369
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
0
def SCREAMING_SNAKE_CASE__ ( __a , __a ) -> List[Any]: return base * power(__a , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("""Raise base to the power of exponent using recursion...""") _SCREAMING_SNAKE_CASE = int(input("""Ent...
370
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
0
from __future__ import annotations from random import random from typing import Generic, TypeVar _SCREAMING_SNAKE_CASE = TypeVar("""KT""") _SCREAMING_SNAKE_CASE = TypeVar("""VT""") class SCREAMING_SNAKE_CASE_ ( Generic[KT, VT] ): def __init__( self : List[str] ...
371
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inp...
89
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __snake_case ( unittest.TestCase): """simple docstring""" def __lowercase ( self : Tuple ) -> Dict: ...
89
1
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="""session...
89
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def UpperCamelCase_ ( A__ : bytes , A__ : int ): '''simple docstring''' lowerCAmelCase_ : i...
89
1
'''simple docstring''' from datetime import datetime as dt import os from github import Github __A : int = [ "good first issue", "good second issue", "good difficult issue", "feature request", "new model", "wip", ] def UpperCame...
89
'''simple docstring''' from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Dict = logging.get_logger(__name__) __A : int = { "snap-research/efficientformer-l1-300": ( "https://huggingface....
89
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from d...
89
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers ...
89
1
'''simple docstring''' import math import sys def UpperCamelCase_ ( A__ : str ): '''simple docstring''' lowerCAmelCase_ : List[Any] = """""" try: with open(A__ , """rb""" ) as binary_file: lowerCAmelCase_ ...
89
'''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/licen...
89
1
'''simple docstring''' def UpperCamelCase_ ( A__ : int = 3 , A__ : int = 7 , A__ : int = 1_00_00_00 ): '''simple docstring''' lowerCAmelCase_ : Dict = 0 lowerCAmelCase_ : Optional[Any] = 1 for c...
89
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except Optiona...
89
1
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def UpperCamelCase_ ( A__ : bytes , A__ : int ): '''simple docstring''' lowerCAmelCase_ : i...
89
'''simple docstring''' from ..utils import DummyObject, requires_backends class __snake_case ( metaclass=_SCREAMING_SNAKE_CASE): """simple docstring""" lowercase = ['note_seq'] def __init__( self : Tuple , *lowerC...
89
1
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, Di...
89
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, ...
89
1
'''simple docstring''' import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, ...
89
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassificat...
89
1
'''simple docstring''' import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, ...
89
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def UpperCamelCase_ ( A__ : np.ndarray , A__ : np.ndarray , A__ : np.ndarray , A__ : int , A__ : ...
89
1
'''simple docstring''' import json import os import torch from diffusers import UNetaDModel os.makedirs("hub/hopper-medium-v2/unet/hor32", exist_ok=True) os.makedirs("hub/hopper-medium-v2/unet/hor128", exist_ok=True) os.makedirs("hub/hopper-medium-v2/value_function", exist_ok=True) ...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A : List[str] = ...
89
1
'''simple docstring''' def UpperCamelCase_ ( A__ : Tuple ): '''simple docstring''' lowerCAmelCase_, lowerCAmelCase_ : int = [], [] while len(A__ ) > 1: lowerCAmelCase_, lowerCAmelCase_ : List[str] = min(A__ ), ...
89
'''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 transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTM...
89
1
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.u...
89
'''simple docstring''' import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() __A : List[str] = logging.get_logg...
89
1
'''simple docstring''' import math def UpperCamelCase_ ( A__ : int ): '''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...
89
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, requi...
89
1
'''simple docstring''' import numpy # List of input, output pairs __A : str = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) __A : str = (((515, 22, 13), 555), ((61, 35, 49), 150)) __A : Tuple ...
89
'''simple docstring''' 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 _...
89
1
'''simple docstring''' def UpperCamelCase_ ( ): '''simple docstring''' for n in range(1 , 1_00_00_00 ): yield n * (n + 1) // 2 def UpperCamelCase_ ( A__ : Tuple ): '''simple docstring''' lowerCAmelCase_ : ...
89
'''simple docstring''' import requests def UpperCamelCase_ ( A__ : str , A__ : str ): '''simple docstring''' lowerCAmelCase_ : Optional[Any] = {"""Content-Type""": """application/json"""} lowerCAmelCase_ : Uni...
89
1
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_mo...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A : List[Any] = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], ...
89
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A : int = logging.get_logger(__name__) __A :...
89
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer __A : Any = {"vocab_file": "vocab.txt", "tokenizer_...
89
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig fro...
89
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_avail...
89
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __A : Any = "\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[str] = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPeg...
89
1
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Optional[int] = {"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNe...
89
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepE...
89
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Optional[Any] = { "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"], } try: if not is_torch_ava...
89
'''simple docstring''' from __future__ import annotations def UpperCamelCase_ ( A__ : int | float | str , A__ : int | float | str ): '''simple docstring''' if nth_term == "": return [""] lowerCAmelCase_ : str = i...
89
1
'''simple docstring''' from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import Tenso...
89
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __snake_case ( unittest.TestCase): """simple docstring""" def __lowercase ( self : Tuple ) -> Dict: ...
89
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Optional[int] = logging.get_logger(__name__) __A : Union[str, Any] = { "asapp/sew-tiny-100k": "https://huggingfa...
89
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def UpperCamelCase_ ( A__ : bytes , A__ : int ): '''simple docstring''' lowerCAmelCase_ : i...
89
1
'''simple docstring''' 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 _...
89
'''simple docstring''' from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Dict = logging.get_logger(__name__) __A : int = { "snap-research/efficientformer-l1-300": ( "https://huggingface....
89
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : Any = { "configuration_convbert": ["CONVBERT_PRETRAINE...
89
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers ...
89
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepE...
89
'''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/licen...
89
1
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class __snake_c...
89
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except Optiona...
89
1
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def UpperCamelCase_ ( ): '''simple docstring''' ...
89
'''simple docstring''' from ..utils import DummyObject, requires_backends class __snake_case ( metaclass=_SCREAMING_SNAKE_CASE): """simple docstring""" lowercase = ['note_seq'] def __init__( self : Tuple , *lowerC...
89
1
'''simple docstring''' __A : Optional[int] = "\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install gi...
89
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, ...
89
1
'''simple docstring''' import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.nump...
89
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassificat...
89
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/licen...
89
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def UpperCamelCase_ ( A__ : np.ndarray , A__ : np.ndarray , A__ : np.ndarray , A__ : int , A__ : ...
89
1
'''simple docstring''' import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigT...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A : List[str] = ...
89
1
'''simple docstring''' import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def UpperCamelCase_ ( A__ : List[str] , A__ : Tuple ...
89
'''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 transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTM...
89
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from .....
89
'''simple docstring''' import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() __A : List[str] = logging.get_logg...
89
1
'''simple docstring''' # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa:...
89
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, requi...
89
1
'''simple docstring''' from __future__ import annotations __A : Tuple = 8.988E9 # units = N * m^s * C^-2 def UpperCamelCase_ ( A__ : float , A__ : float , A__ : float , A__ : float ): '''simple docstring'''...
89
'''simple docstring''' 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 _...
89
1
'''simple docstring''' __A : Optional[Any] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] __A : List[str] = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] __A : List[Any] = { 0: "Sunday", 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", ...
89
'''simple docstring''' import requests def UpperCamelCase_ ( A__ : str , A__ : str ): '''simple docstring''' lowerCAmelCase_ : Optional[Any] = {"""Content-Type""": """application/json"""} lowerCAmelCase_ : Uni...
89
1
'''simple docstring''' import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() ...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A : List[Any] = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], ...
89
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[str] = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPeg...
89
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer __A : Any = {"vocab_file": "vocab.txt", "tokenizer_...
89
1
'''simple docstring''' import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging __A : Li...
89
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_avail...
89
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/...
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[str] = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPeg...
89
1