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 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...
33
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __magic_name__ : int = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if...
672
0
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _lowerCAmelCase ( lowercase , lowercase , **lowercase ) -> List[str]: __lowerCAmelCase = AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__ , ...
689
'''simple docstring''' import string def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' _snake_case = "" for i in sequence: _snake_case = ord(SCREAMING_SNAKE_CASE__ ) if 65 <= extract <= 90: output += chr(1_55 - extract )...
672
0
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeatureEx...
687
'''simple docstring''' import numpy as np def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return 1 / (1 + np.exp(-vector )) def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return vector * sigmoid(1.702 *...
672
0
"""simple docstring""" import math def lowercase__ ( lowercase_ ,lowercase_ ) -> Optional[Any]: """simple docstring""" return math.pow(SCREAMING_SNAKE_CASE__ ,2 ) - a def lowercase__ ( lowercase_ ) -> List[Any]: ...
624
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.hugg...
672
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_common import FlaxMode...
124
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __SCREAMING_SNAKE_CASE ( __UpperCamelCase ): ...
672
0
import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig snake_case_ : Any = logging.get_logger(__name__) snake_case_ : Optional[int] = """T5Config""" def ...
488
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __magic_name__ : Optional[int] = { """configuration_swiftformer""": [ """SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
672
0
from __future__ import annotations from collections import Counter from random import random class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self ) -> List[Any]: '''simple docstring''' __UpperCamelCase : Dict ...
327
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_ut...
672
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Dict = logging.get_logger(__name__) lowerCamelCase : Optional[int] = { """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-...
587
'''simple docstring''' import math def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' assert isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: ...
672
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_squeezebert import SqueezeBertTokenizer _snake_case = logging.get_logger(__name__) _snake_case ...
655
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __magic_name__ : Dict = { """configuration_pix2struct""": [ """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Pix2...
672
0
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tenso...
452
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_ch...
672
0
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint snake_case : ...
445
'''simple docstring''' import baseaa def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return baseaa....
672
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin ...
33
'''simple docstring''' from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationCon...
672
0
'''simple docstring''' def _lowerCAmelCase ( lowercase ) -> int: return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def _lowerCAmelCase ( lowercase ) -> Dict: __lowerCAmelCase = 0 __lowerCAmelCase = number while duplicate > 0...
689
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class __SCREAMING_SNAKE_CASE ( datasets.BeamBasedBuilder ): '''simple d...
672
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp...
687
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device __magic_name__ : Optional[int] = False class __SCREAMING_SNAKE_CA...
672
0
"""simple docstring""" import numpy as np def lowercase__ ( lowercase_ ) -> Optional[Any]: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
624
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def snake_case_ ( SCREAMING_SNAKE_CASE__ , S...
672
0
import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _snake_case ( unittest.TestCase ): ...
124
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __magic_name__ : Any = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_torch_availab...
672
0
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pip...
488
'''simple docstring''' import math def snake_case_ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return math.pow(SCREAMING_SNAKE_CASE__ , 2 ) - a def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''s...
672
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase : Dict = { """configuration_pix2struct""": [ """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Pix2StructConfig""", """Pi...
327
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : Optional[int] = logging.get_logger(__name__) __magic_name__ : Optional[int] = { """microsoft/git-base""": """http...
672
0
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch_device...
587
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __magic_name__ : Dict = logging.get_logger(__name__) def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' if isinsta...
672
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _snake_case = { """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""], } try: if not is_torch_available(): raise...
655
'''simple docstring''' __magic_name__ : int = """Alexander Joslin""" import operator as op from .stack import Stack def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' _snake_case = {"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub} _s...
672
0
"""simple docstring""" import random def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase = False ): '''simple docstring''' UpperCAmelCase = {i: [] for i in range(lowerCAmelCase )} # if probability is greater or...
673
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
1
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import Sche...
673
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' if num < 0: return False UpperCAmelCase = num UpperCAmelCase = 0 while num > 0: UpperCAmelCase = ...
673
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
1
"""simple docstring""" import argparse import importlib from pathlib import Path # Test all the extensions added in the setup lowerCAmelCase_ : Union[str, Any] = [ '''kernels/rwkv/wkv_cuda.cu''', '''kernels/rwkv/wkv_op.cpp''', '''kernels/deformable_detr/ms_deform_attn.h'''...
673
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
1
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union 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 ImageProcessin...
673
1
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
1
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' for param in module.parameters(): UpperCAmelCase = False def _lower...
673
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
1
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
1
"""simple docstring""" def _lowerCAmelCase ( ): '''simple docstring''' return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(lowerCAmelCase , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ...
673
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ : Optional[int] = logging.get_logger(__name__) lowerCAmelCase_ :...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
1
"""simple docstring""" from __future__ import annotations from cmath import sqrt def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ): '''simple docstring''' if a == 0: raise ValueError("""Coefficient 'a' must not be ...
673
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
1
"""simple docstring""" import torch from diffusers import StableDiffusionPipeline lowerCAmelCase_ : int = '''path-to-your-trained-model''' lowerCAmelCase_ : Tuple = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') lowerCA...
673
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
673
1
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase = False ): '''simple docstring''' if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickl...
673
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
1
"""simple docstring""" from typing import Dict, Optional import numpy as np import datasets lowerCAmelCase_ : Any = ''' IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground t...
673
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
1
"""simple docstring""" import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py l...
673
"""simple docstring""" import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import flo...
673
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
673
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
1
"""simple docstring""" import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): im...
673
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
1
"""simple docstring""" from collections import defaultdict def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = 1 UpperCAmelCase = True for v in tree[start]: if v not in visited: ...
673
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase = 1000000 ): '''simple docstring''' UpperCAmelCase = set(range(3 , lowerCAmelCase , 2 ) ) primes.add(2 ) for p in range(3 , lowerCAmelCase , 2 ): ...
673
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
1
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": lowerCAmelCase_ : List[str] = argparse.ArgumentParser() parser.add_argum...
673
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
1
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : List[str] = logging.get_logger(__name__) # TODO Update this lowerCAmelCase_ : List...
673
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
1
"""simple docstring""" import math class UpperCamelCase_ : def __init__( self , snake_case__=0 ) -> int: # a graph with Node 0,1,...,N-1 """simple docstring""" UpperCAmelCase = n UpperCAmelCase = [ ...
673
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
1
"""simple docstring""" import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase_ : Dict = [ # (stable-diffusion, HF Diffusers) ('''time_embed.0...
673
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
1
"""simple docstring""" # 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...
673
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase_ : str = { '''configuration_poolformer''': [ '''POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
673
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
1
"""simple docstring""" from cva import destroyAllWindows, imread, imshow, waitKey def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' # getting number of pixels in the image UpperCAmelCase , UpperCAmelCase = img.shape[0], im...
673
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union 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 ImageProcessin...
673
1
"""simple docstring""" from __future__ import annotations from collections import deque class UpperCamelCase_ : def __init__( self , snake_case__ ) -> Dict: """simple docstring""" UpperCAmelCase = [] self.adlist.append( ...
673
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
1
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable lowerCAmelCase_ : Dict = {'''configuration_dpt''': ['''DPT_PRETRAINED_CO...
673
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
1
"""simple docstring""" from manim import * class UpperCamelCase_ ( a_ ): def UpperCamelCase_ ( self ) -> List[str]: """simple docstring""" UpperCAmelCase = Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase ...
673
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
1
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class UpperCamelCase_ ( a_ ): def __init__( self , snake_case__="" , snake_case__="train" ) -> Optional[Any]: """simple docstring""" ...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_...
673
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
1
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput ...
673
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
673
1
"""simple docstring""" from ....utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) class UpperCamelCase_ ( a_ ): def __init__( self , snake_case__ , snake_case__=None , snake_case__=20_48 ) -> Any: """simpl...
673
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
1
"""simple docstring""" from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from ...
673
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
1
"""simple docstring""" from __future__ import annotations def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [] UpperCAmelCase , Upper...
673
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
1
"""simple docstring""" from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowerCAmelCase_ : Optional[int] = logging.get_logger(__name__) lowerCAmelCas...
673
"""simple docstring""" import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import flo...
673
1
"""simple docstring""" from __future__ import annotations import time lowerCAmelCase_ : Dict = list[tuple[int, int]] lowerCAmelCase_ : List[str] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, ...
673
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
1
"""simple docstring""" import unittest from transformers import LiltConfig, 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_c...
673
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = abs(lowerCAmelCase ) UpperCAmelCase = 0 while n > 0: res += n % 10 n //= 10 return res ...
673
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ....
673
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
1
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union 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 ImageProcessin...
673
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' if num <= 0: raise ValueError("""Input must be a positive integer""" ) UpperCAmelCase = [True] * (num + 1) UpperCAmelCase = 2...
673
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : Dict = logging.get_logger(__name__) lowerCAmelCase_ : Tuple = { '''facebook/s2t-small-librispeech-asr''': ( '''https://huggingface....
673
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
1
"""simple docstring""" import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) class UpperCamelCase_ (...
673
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
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 lowerCAmelCase_ : List[str] = '''▁''' lowerCAmelCase_ ...
673
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
1
"""simple docstring""" import numpy class UpperCamelCase_ : def __init__( self , snake_case__ , snake_case__ ) -> None: """simple docstring""" UpperCAmelCase = input_array # Random initial weights are assigned where firs...
673
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
1
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder lowerCAmelCase_ : str = '''__DUMMY_TRANSFORMERS_USER__''' lowerCAmelCase_ : Dict = '''...
673
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union 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 ImageProcessin...
673
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
1
"""simple docstring""" import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr imp...
673
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
1
"""simple docstring""" import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : Dict = logging.get_logger(__name__) lowerCAmelCase_ : Optional[int] = { '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https:/...
673
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
1
"""simple docstring""" import warnings from functools import wraps from typing import Callable def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' @wraps(lowerCAmelCase ) def _inner_fn(*lowerCAmelCase , **lowerCAmelCase ): wa...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
1
"""simple docstring""" import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever lowerCAmelCase_ : List[str] = logging.getLogger(__name__) class UpperCamelCase_ ...
673
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
1
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
673
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
673
1
"""simple docstring""" lowerCAmelCase_ : Optional[int] = '''Tobias Carryer''' from time import time class UpperCamelCase_ : def __init__( self , snake_case__ , snake_case__ , snake_case__ , snake_case__=int(time() ) ) -> List[Any]: # noqa: ...
673
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
673
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
1
"""simple docstring""" from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers i...
673
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
1
"""simple docstring""" from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddi...
673
"""simple docstring""" import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import flo...
673
1
"""simple docstring""" import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging ...
673
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test...
673
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
1
"""simple docstring""" import argparse import datetime def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = { """0""": """Sunday""", """1""": """Monday""", """2""": """Tuesday""", "...
673
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timest...
673
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = len(lowerCAmelCase ) UpperCAmelCase = sum(lowerCAmelCase ) UpperCAmelCase = [[False for x in range(s + 1 )]...
673
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
1
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcesso...
673
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
1
"""simple docstring""" from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) ...
673
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_utils impor...
673
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase_ : List[Any] = { '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakp...
673
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase_ :...
673
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
1
"""simple docstring""" import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase_ : int = version.parse(importlib_metadata.version('''nltk''')) if NLTK_VERSION >= version.Version('''3.6.4'''): fr...
673
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union 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 ImageProcessin...
673
1
"""simple docstring""" import re from filelock import FileLock try: import nltk lowerCAmelCase_ : str = True except (ImportError, ModuleNotFoundError): lowerCAmelCase_ : Union[str, Any] = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.dow...
673
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
1
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCamelCase_ ( yaml.SafeLoader ): def UpperCamelCase_ ( self , snake_case__ ) -> str: """simple docstring""" ...
673
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
1
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
1
"""simple docstring""" import math import unittest from transformers import BioGptConfig, 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 ...t...
673
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
1
"""simple docstring""" from functools import lru_cache @lru_cache def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' if num < 0: raise ValueError("""Number should not be negative.""" ) return 1 if num in (0, 1) else num * factorial(...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
1
"""simple docstring""" from __future__ import annotations from typing import Any def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' create_state_space_tree(lowerCAmelCase , [] , 0 ) def _lowerCAmelCase ( lowerCAmelCase ...
673
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
1
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
673
1
"""simple docstring""" import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class ...
673
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
1
"""simple docstring""" import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class UpperCamelCase_ ( unittest.TestCase ): def UpperCam...
673
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
1