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
import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, require_torch fro...
60
"""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
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _A ( ): """simple docstring""" lowerCAmelCase__ = ArgumentParser( description=( ...
61
"""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
0
import baseaa def lowerCamelCase__ ( lowercase ): """simple docstring""" return baseaa.aaaencode(string.encode("utf-8" ) ) def lowerCamelCase__ ( lowercase ): """simple docstring""" return baseaa.aaadecode(lowercase ).decode("utf-8" ) if __name__ ...
62
"""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
0
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class a ( yaml.SafeLoader ): """simple docstring""" def UpperCAmelCase ( self : Tuple , __lowercase : List[Any] ) -> Optional[...
63
"""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
0
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Distr...
64
"""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
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __lowercase : snake_case_ = 42 snake_case_ = ...
65
"""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
0
import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxruntime as ort UpperCame...
66
"""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
0
from typing import Dict, Iterable, 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_c...
67
"""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
0
from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("To use the rich extension, install rich with `pip install rich`")
68
"""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
0
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import _LazyModule a : Any = {'''tokenization_tapex''': ['''TapexTokenizer''']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : ...
69
"""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
0
from collections import defaultdict from math import ceil, sqrt def _SCREAMING_SNAKE_CASE ( lowercase : int = 1_00_00_00 , lowercase : int = 10 ): '''simple docstring''' lowerCamelCase_ = defaultdict(lowercase ) for outer_width...
70
"""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
0
'''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...
71
"""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
0
'''simple docstring''' from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): i...
72
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer, AutoToken...
73
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """google/mobilenet_v2_1.4_224""": "...
74
"""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
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor UpperCamelCase__ = logging.get_logger(__name__) class lowerCamelCase_ ( __a ): def __init__( self : Union[str, Any] ,...
75
"""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
0
"""simple docstring""" import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) a_ = { 'sample_size': 3_2, 'in_channels': 3, 'out_channels': 3, 'layers_per_block...
76
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
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_inputs if is_torc...
77
"""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
0
'''simple docstring''' import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE_: Optional...
78
"""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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE__ : Optional[Any] = { """configuration_mvp""": ["""MVP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MvpConfig""", """MvpOnn...
79
"""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
0
from __future__ import annotations class __UpperCamelCase : def __init__( self : Dict , _lowerCAmelCase : int ) -> None: """simple docstring""" __lowercase = data __lowercase = None __lowercase = None def snake_c...
80
"""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
0
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class a (_lowerCAmelCase ):...
81
"""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
0
"""simple docstring""" def a__ ( lowerCAmelCase__ , lowerCAmelCase__ ): UpperCAmelCase_ = "" for word_or_phrase in separated: if not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): raise Exception("join() accepts onl...
82
"""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
0
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStr...
83
"""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
0
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class A_ ( unittest.TestCase ): '''simple docstring''' def SCREAMING_SNAKE_CASE__ ( self ): lowercase = ...
84
"""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
0
from __future__ import annotations def _a ( lowercase__ : list[int] ): # This function is recursive '''simple docstring''' SCREAMING_SNAKE_CASE__ : str = len(lowercase__ ) # If the array contains only one element, we return it (it's the stop condition of...
85
"""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
0
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class _a ( unittest...
86
"""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
0
from __future__ import annotations from math import pow, sqrt def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ ) -> dict[str, float]: """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError...
87
"""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
0
"""simple docstring""" from collections import Counter from timeit import timeit def _snake_case ( __snake_case : str = "" , ): """simple docstring""" return sum(c % 2 for c in Counter(input_str.replace(""" """ , """""" ).lower() ).values() ...
88
"""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
0
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ = None , l...
89
"""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
0
'''simple docstring''' import unittest from transformers import DonutProcessor __UpperCAmelCase = '''naver-clova-ix/donut-base''' class a__ ( unittest.TestCase ): '''simple docstring''' def __SCREAMING_SNAKE_...
90
"""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
0
"""simple docstring""" from math import pow def _snake_case ( snake_case__ : int , snake_case__ : int , snake_case__ : int , snake_case__ : int , snake_case__ : int , ): if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we h...
91
"""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
0
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import requ...
92
"""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
0
"""simple docstring""" import random def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->Optional[int]: """simple docstring""" lowerCAmelCase__ :Optional[Any] = a[left_index] lowerCAmelCase__ :Tuple = left_index + 1 ...
93
"""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
0
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Imag...
94
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
"""simple docstring""" import re def snake_case ( A__ ): UpperCAmelCase_ : Optional[int] = re.compile(r"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$" ) if match := re.search(A__ ,A__ ): return match.string == phone return False if __name__ == "__main__": print(indian_phone_...
95
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
"""simple docstring""" def a ( __UpperCAmelCase : int ) -> bool: if p < 2: raise ValueError("""p should not be less than 2!""" ) elif p == 2: return True __magic_name__: str = 4 __magic_name__: Tup...
96
"""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
0
from timeit import timeit def a ( snake_case__: int ): '''simple docstring''' if number < 0: raise ValueError('''the value of input must not be negative''' ) lowercase_ = 0 while number: number &= number - 1 result += 1 return res...
97
"""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
0
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowercase__ : Union[str, Any] ...
98
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
0
from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys SCREAMING_S...
99
"""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
0
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResa...
100
"""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
0
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softm...
101
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __magic_name__ : int = { """configuration_data2vec_audio""": ["""DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP""", "...
102
"""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
0
"""simple docstring""" import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available ...
103
"""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
0
"""simple docstring""" from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def _lowerCamelCase ( UpperCAmelCase_ : int ) -> Optional[Any]: """simple docstring""" def is_in_ci...
104
"""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
0
from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...tokenization_uti...
105
"""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
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
106
"""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
0
'''simple docstring''' from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowercase_ : """simple docstring""" __lowerCAmelCase = 42 __lowerCAmelCase = 42 ...
107
"""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
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models....
108
"""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
0
'''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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, Imag...
109
"""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
0
'''simple docstring''' import math class _UpperCamelCase : '''simple docstring''' def __init__( self : int , lowerCAmelCase__ : Dict=0 ): # a graph with Node 0,1,...,N-1 """simple docstring""" __SCREAMING_SNAKE_CASE : Optional[int] = ...
578
"""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
0
"""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 : Dict , lowercase_ : ...
123
"""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
0
'''simple docstring''' import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline lowercase = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does n...
211
"""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
0
'''simple docstring''' import random def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ): lowercase__ : List[Any] = a[left_index] lowercase__ : Optional[int] = left_index + 1 for j in range(left_index + 1 , UpperCAmelCase ): ...
152
"""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
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowercase : Optional[int] = logging.get_logger(__name__) __lowercase : Any = { '...
476
"""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
0
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 snake_case ( a_ , ...
393
"""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
0
import argparse from collections import defaultdict import yaml __UpperCAmelCase = '''docs/source/en/_toctree.yml''' def lowercase__ ( __snake_case : List[str] ): '''simple docstring''' UpperCAmelCase_ : int = defaultdict(__snake_case ...
406
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging __UpperCAmelCase =logging.get_logger(__name__) __UpperCAmelCase ={ '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/van-base/blob/mai...
337
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
'''simple docstring''' import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def __lowerCAmelCase ( *UpperCamelCase__ ) -> Optional[Any]: if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): __low...
546
"""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
0
from ....utils import logging lowerCamelCase = logging.get_logger(__name__) class A ( a_ ): def __init__( self : Optional[Any] , lowercase_ : Optional[Any] , lowercase_ : Optional[Any]=None , lowercase_ : Optional[int]=2048 ) -> Any: """simple docs...
464
"""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
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE (__lowerCAmelCase , __lowerCAmelCase ) -> Optional[int]: '''simple docstring''' lowercase_ = len(__lowerCAmelCase ) lowercase_ = [] for i in range(len(__lowerCAmelCase ) - pat_len...
567
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
0
'''simple docstring''' import torch from ..models.auto import AutoModelForSequenceClassification, AutoTokenizer from .base import PipelineTool class _UpperCamelCase ( a_ ): '''simple docstring''' _A : Optional[int] = 'facebook/bart-large-mnli' _A : Unio...
578
"""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
0
"""simple docstring""" from __future__ import annotations from cmath import sqrt def __lowercase ( _a , _a , _a ): if a == 0: raise ValueError('''Coefficient \'a\' must not be zero.''' ) snake_case_ : Optional[int] = b * b - 4 * a * c s...
123
"""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
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { '''facebook/s2t-small-librispeech-asr''': ( '''https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/...
211
"""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
0
'''simple docstring''' def __UpperCamelCase ( UpperCAmelCase ): lowercase__ : List[str] = len(UpperCAmelCase ) lowercase__ : Tuple = sum(UpperCAmelCase ) lowercase__ : Optional[int] = [[False for x in range(s + 1 )] for y in range(n + 1 )...
152
"""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
0
'''simple docstring''' from __future__ import annotations from collections import deque class __UpperCamelCase : def __init__( self , __a ): '''simple docstring''' __a : Optional[Any] = [] self.adlist.append( {'value': '', 'next_s...
476
"""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
0
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, ) A_ = { '''configuration_albert''': ['''ALBERT_PRETRAINED_CONF...
393
"""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
0
import socket def lowercase__ ( ): '''simple docstring''' UpperCAmelCase_ : str = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase_ : int = socket.gethostname() UpperCAmelCase_ : List[str] = 12_312 sock....
406
"""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
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( CommonSchedulerState, FlaxKarrasDiffusionSchedulers, ...
337
"""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
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase ={ '''configuration_clap''': [ '''CLAP_PRETRAINED_MODEL_ARCHIVE_LIST''', '''ClapAudioConfig''', '''ClapConfig''', '...
546
"""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
0
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available()...
464
"""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
0
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCAmelCase : Dict = logging.get_logger("transformers.models.speecht5") def _SCREAMING_SNAKE_CASE ...
567
"""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
0
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class _UpperCamelCase ( a_ ): '''simple docstring''' @require_torch def UpperCamelCase__...
578
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase__ : str = {'''configuration_yolos''': ['''YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''YolosConfig''', '''YolosOnnxCon...
123
"""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
0
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available fro...
211
"""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
0
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeatur...
152
"""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
0
'''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 ( AutoProcessor, ...
476
"""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
0
def UpperCAmelCase ( UpperCAmelCase )-> List[Any]: '''simple docstring''' if num <= 0: raise ValueError('''Input must be a positive integer''' ) SCREAMING_SNAKE_CASE_ = [True] * (num + 1) SCREAMING_SNAKE_CASE_ = 2 while p * p <=...
393
"""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
0
def lowercase__ ( __snake_case : Dict , __snake_case : int = " " ): '''simple docstring''' UpperCAmelCase_ : str = [] UpperCAmelCase_ : Optional[Any] = 0 for index, char in enumerate(__snake_case ): if char == sepa...
406
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
"""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, Iterable, Li...
337
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
'''simple docstring''' import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, ...
546
"""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
0
from functools import reduce lowerCamelCase = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' '''66896648950...
464
"""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
0
"""simple docstring""" import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPi...
567
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
0
'''simple docstring''' import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def lowerCAmelCase_ ( _lowerCamelCase: Dict ): __SCREAMING_SNAKE_CASE : Dict = [ """encoder.version""", ...
578
"""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
0
"""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 ...test_model...
123
"""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
0
'''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 ......
211
"""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
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __a: Any = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: if not is_torc...
152
"""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
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils ...
476
"""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
0
import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from transformers import ( ...
393
"""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
0
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# __UpperCAmelCase = [ # (stable-diffusion, HF Diffusers) ('''time_embed.0.weight''', '''time_embe...
406
"""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
0
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import versio...
337
"""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
0
'''simple docstring''' import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert i...
546
"""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
0
from datetime import datetime import matplotlib.pyplot as plt import torch def a_ ( SCREAMING_SNAKE_CASE__ : Dict ): '''simple docstring''' for param in module.parameters(): _lowerCamelCase : str =False def a_ ( ): '''simple...
464
"""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
0
"""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 CombinedTimestepLabelEmb...
567
"""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
0
'''simple docstring''' from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils import deprecate deprecate( '''pipelines_utils''', '''0.22.0''', '''Importing `DiffusionPipeline` or `ImagePipelineOutput` from diffusers.pipeline_utils is deprecated. Please import from ...
578
"""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
0
"""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 import DPRCo...
123
"""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
0
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets lowercase = ''' 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 truth. For binary (two...
211
"""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
0
'''simple docstring''' from __future__ import annotations def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ): # noqa: E741 while r - l > 1: lowercase__ : Optional[int] = (l + r) // 2 if v[m] >= key: lowercase__ : ...
152
"""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
0
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. __lowercase : Optional[Any] = 2_00 # Number of elements selected in every generation of evolution. The selection takes # place from best to...
476
"""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
0
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging A_ = logging.get_lo...
393
"""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
0