code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import Conf...
20
"""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.t...
20
1
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A__ : str= { """linear""": PIL.Image.Resampling.BILINEAR, """...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) for i in range(SCREAMING_SNAKE_CASE ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): ...
20
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import float...
20
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A__ : str= { """linear""": PIL.Image.Resampling.BILINEAR, """...
20
1
"""simple docstring""" # Copyright 2023 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...
20
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_ut...
20
1
"""simple docstring""" import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...
20
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar A__ : Any= TypeVar("""T""") class __lowerCamelCase ( Generic[T] ): def __init__( self , snake_case_ ) -> None: UpperCamelCase__ = data ...
20
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str]= logging.get_logger(__name__) class __lowerCamelCase ( _a ): a : Optional[int] ="""timm_backbone""" def __init__( self , snak...
20
"""simple docstring""" A__ : Tuple= """Alexander Joslin""" import operator as op from .stack import Stack def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase__ = {'*': op.mul, '/': op.truediv, '+': o...
20
1
"""simple docstring""" from string import ascii_lowercase, ascii_uppercase def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" if not sentence: return "" UpperCamelCase__ = dict(zip(SCREAMING_SNAKE_CASE , SCREA...
20
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py A__ : Any= """src/diffusers""" # Matches is_xxx_available() A__ : Tuple= re.c...
20
1
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() ...
20
"""simple docstring""" # Copyright 2022 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...
20
1
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels A__ : Optional[int]= object() # For specifying empty leaf dict `{}` A__ : Opti...
20
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str]= logging.get_logger(__name__) class __lowerCamelCase ( _a ): a : Optional[int] ="""timm_backbone""" def __init__( self , snak...
20
1
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipelin...
20
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
20
1
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
20
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mo...
20
1
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_tor...
20
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 , SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" UpperCamelCase__ = defaultdict(SCREAMING_SN...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) for i in range(SCREAMING_SNAKE_CASE ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): ...
20
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_...
20
1
"""simple docstring""" from copy import deepcopy class __lowerCamelCase : def __init__( self , snake_case_ = None , snake_case_ = None ) -> None: if arr is None and size is not None: UpperCamelCase__ = size UpperCam...
20
"""simple docstring""" import sys from collections import defaultdict class __lowerCamelCase : def __init__( self ) -> Tuple: UpperCamelCase__ = [] def SCREAMING_SNAKE_CASE__ ( self , snake_case_ ) -> List[str]: ...
20
1
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatur...
20
"""simple docstring""" from copy import deepcopy class __lowerCamelCase : def __init__( self , snake_case_ = None , snake_case_ = None ) -> None: if arr is None and size is not None: UpperCamelCase__ = size UpperCam...
20
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A__ : List[str]= { """configuration_squeezebert""": [ """SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
20
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow A__ : Union[str, Any]= logging.getLogger() @unitte...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> Union[str, Any]: """simple docstring""" if not head: return True # split the list to two parts UpperCamelCase__ , UpperCamelCase__ = head.next, head while fa...
20
"""simple docstring""" import warnings 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 A__ : str= logging.get_logger(__...
20
1
"""simple docstring""" from PIL import Image def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> Image: """simple docstring""" UpperCamelCase__ = (2_59 * (level + 2_55)) / (2_55 * (2_59 - level)) def contrast(SCREAMING_SNA...
20
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> Dict: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_re...
20
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A__ : Optional[Any]= logging.get_logger(__name__) class __lowerCamelCase ...
20
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
20
1
"""simple docstring""" from __future__ import annotations import math def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: UpperCamelCase__ = F'{num}: Invalid input, please enter a positive inte...
20
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase_( SCRE...
20
1
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup A__ : str= { """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.35...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" UpperCamelCase__ = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00 ) -> int: ...
20
1
"""simple docstring""" import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTester...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00_00_00 ) -> int: """simple docstring""" UpperCamelCase__ = set() UpperCamelCase__ = int((limit - 24) ** (1 / 2) ) UpperCamelCase__ = set(range(3 , prime...
20
1
"""simple docstring""" 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_war...
20
"""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.t...
20
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, ...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) for i in range(SCREAMING_SNAKE_CASE ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): ...
20
1
"""simple docstring""" import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Tokeni...
20
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A__ : str= { """linear""": PIL.Image.Resampling.BILINEAR, """...
20
1
"""simple docstring""" import requests A__ : Optional[int]= """""" # <-- Put your OpenWeatherMap appid here! A__ : str= """https://api.openweathermap.org/data/2.5/""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE = "Chicago" , SCREAMING_SNAKE_CASE = APPID ) -> ...
20
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_ut...
20
1
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
20
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar A__ : Any= TypeVar("""T""") class __lowerCamelCase ( Generic[T] ): def __init__( self , snake_case_ ) -> None: UpperCamelCase__ = data ...
20
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar A__ : Optional[Any]= TypeVar("""T""") A__ : Optional[Any]= TypeVar("""U""") class __lowerCamelCase ( Generic[T, U] ): def __init__( ...
20
"""simple docstring""" A__ : Tuple= """Alexander Joslin""" import operator as op from .stack import Stack def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase__ = {'*': op.mul, '/': op.truediv, '+': o...
20
1
"""simple docstring""" import unittest import numpy as np import requests 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 ImageProcessingSavingTestM...
20
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py A__ : Any= """src/diffusers""" # Matches is_xxx_available() A__ : Tuple= re.c...
20
1
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_...
20
"""simple docstring""" # Copyright 2022 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...
20
1
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelM...
20
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str]= logging.get_logger(__name__) class __lowerCamelCase ( _a ): a : Optional[int] ="""timm_backbone""" def __init__( self , snak...
20
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.apach...
20
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
20
1
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class __lowerCamelCase ( _a ): a : str =(UnCLIPScheduler,) def SCREAMING_SNAKE_CASE__ ( self , **snake_case_ ) -> ...
20
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mo...
20
1
"""simple docstring""" from manim import * class __lowerCamelCase ( _a ): def SCREAMING_SNAKE_CASE__ ( self ) -> Dict: UpperCamelCase__ = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase__ = Rectangle(height=0.4...
20
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 , SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" UpperCamelCase__ = defaultdict(SCREAMING_SN...
20
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __lowerCame...
20
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_...
20
1
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" if len(SCREAMING_SNAKE_CASE ) < k or k < 0: raise ValueError('Invalid Input' ) U...
20
"""simple docstring""" import sys from collections import defaultdict class __lowerCamelCase : def __init__( self ) -> Tuple: UpperCamelCase__ = [] def SCREAMING_SNAKE_CASE__ ( self , snake_case_ ) -> List[str]: ...
20
1
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 , SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" UpperCamelCase__ = defaultdict(SCREAMING_SN...
20
"""simple docstring""" from copy import deepcopy class __lowerCamelCase : def __init__( self , snake_case_ = None , snake_case_ = None ) -> None: if arr is None and size is not None: UpperCamelCase__ = size UpperCam...
20
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor...
20
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow A__ : Union[str, Any]= logging.getLogger() @unitte...
20
1
"""simple docstring""" import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem A__ : List[Any]= importlib.util.find_spec("""s3fs""") is not None...
20
"""simple docstring""" import warnings 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 A__ : str= logging.get_logger(__...
20
1
"""simple docstring""" from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class __lowerCamelCase ( _a ): def __init__( ...
20
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> Dict: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_re...
20
1
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow A__ : Union[str, Any]= logging.getLogger() @unitte...
20
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
20
1
"""simple docstring""" from abc import ABC, abstractmethod from typing import List, Optional class __lowerCamelCase ( _a ): def __init__( self ) -> Tuple: # test for the above condition self.test() def SCREAMING_SNAKE_CASE__ ( self...
20
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase_( SCRE...
20
1
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class __lowerCamelCase ( _a ): a : Optional[Any] =(PNDMScheduler,) a : Optional[int] =(("""num_inference...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" UpperCamelCase__ = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00 ) -> int: ...
20
1
"""simple docstring""" from math import factorial def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 20 ) -> int: """simple docstring""" UpperCamelCase__ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... ...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00_00_00 ) -> int: """simple docstring""" UpperCamelCase__ = set() UpperCamelCase__ = int((limit - 24) ** (1 / 2) ) UpperCamelCase__ = set(range(3 , prime...
20
1
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> Any: """simple docstring""" if ...
20
"""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.t...
20
1
"""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.t...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) for i in range(SCREAMING_SNAKE_CASE ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): ...
20
1
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_...
20
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A__ : str= { """linear""": PIL.Image.Resampling.BILINEAR, """...
20
1
"""simple docstring""" import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available A__ : List[str]= lo...
20
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_ut...
20
1
"""simple docstring""" from __future__ import annotations from typing import Any class __lowerCamelCase : def __init__( self , snake_case_ ) -> None: UpperCamelCase__ = num_of_nodes UpperCamelCase__ = [] UpperCamel...
20
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar A__ : Any= TypeVar("""T""") class __lowerCamelCase ( Generic[T] ): def __init__( self , snake_case_ ) -> None: UpperCamelCase__ = data ...
20
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class __lowerCamelCase ( metaclass=_a ): a : Tuple =["""flax"""] def __init__( self , *snake_case_ , **snake_case_ ) -> Dict: requires_backends(self , ['fl...
20
"""simple docstring""" A__ : Tuple= """Alexander Joslin""" import operator as op from .stack import Stack def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase__ = {'*': op.mul, '/': op.truediv, '+': o...
20
1
"""simple docstring""" from importlib import import_module from .logging import get_logger A__ : List[Any]= get_logger(__name__) class __lowerCamelCase : def __init__( self , snake_case_ , snake_case_=None ) -> List[str]: UpperCamelCase__ ...
20
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py A__ : Any= """src/diffusers""" # Matches is_xxx_available() A__ : Tuple= re.c...
20
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ......
20
"""simple docstring""" # Copyright 2022 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...
20
1
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # ...
20
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str]= logging.get_logger(__name__) class __lowerCamelCase ( _a ): a : Optional[int] ="""timm_backbone""" def __init__( self , snak...
20
1
"""simple docstring""" from __future__ import annotations A__ : Tuple= { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""...
20
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
20
1
"""simple docstring""" import math def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list: """simple docstring""" UpperCamelCase__ = [True] * n UpperCamelCase__ = False UpperCamelCase__ = False UpperCamelCase__ ...
20
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mo...
20
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A__ : int= logging.get_logger(__name__) A__ : List[Any]= { """ut/deta""": """https://huggingface.co/ut/deta/resolve/mai...
20
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 , SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" UpperCamelCase__ = defaultdict(SCREAMING_SN...
20
1
"""simple docstring""" import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME d...
20
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_...
20
1
"""simple docstring""" import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml f...
20
"""simple docstring""" import sys from collections import defaultdict class __lowerCamelCase : def __init__( self ) -> Tuple: UpperCamelCase__ = [] def SCREAMING_SNAKE_CASE__ ( self , snake_case_ ) -> List[str]: ...
20
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ : Union[str, Any]= { """configuratio...
20
"""simple docstring""" from copy import deepcopy class __lowerCamelCase : def __init__( self , snake_case_ = None , snake_case_ = None ) -> None: if arr is None and size is not None: UpperCamelCase__ = size UpperCam...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) UpperCamelCase__ = sum(SCREAMING_SNAKE_CASE ) UpperCamelCase__ = [[False for...
20
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow A__ : Union[str, Any]= logging.getLogger() @unitte...
20
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ : Dict= logging.get_logger(__name__) A__ ...
20
"""simple docstring""" import warnings 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 A__ : str= logging.get_logger(__...
20
1
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImagePro...
20
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> Dict: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_re...
20
1
"""simple docstring""" class __lowerCamelCase : def __init__( self , snake_case_ , snake_case_=None , snake_case_=None ) -> Optional[Any]: UpperCamelCase__ = data UpperCamelCase__ = previous UpperCamelCase__ ...
20
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
20
1
"""simple docstring""" import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_( ...
20
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase_( SCRE...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): UpperCamelCase__ = F'Input value of [number={number}] must be an integer' ra...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" UpperCamelCase__ = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00 ) -> int: ...
20
1
"""simple docstring""" A__ : int= """ABCDEFGHIJKLMNOPQRSTUVWXYZ""" def lowerCAmelCase_( ) -> None: """simple docstring""" UpperCamelCase__ = input('Enter message: ' ) UpperCamelCase__ = input('Enter key [alphanumeric]: ' ) ...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00_00_00 ) -> int: """simple docstring""" UpperCamelCase__ = set() UpperCamelCase__ = int((limit - 24) ** (1 / 2) ) UpperCamelCase__ = set(range(3 , prime...
20
1
"""simple docstring""" A__ : Dict= [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A__ : Union[str, Any]= [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A__ : Optional[int]= { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5: ""...
20
"""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.t...
20
1
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase_( SCRE...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) for i in range(SCREAMING_SNAKE_CASE ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): ...
20
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...
20
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A__ : str= { """linear""": PIL.Image.Resampling.BILINEAR, """...
20
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[Any]= logging.get_logger(__name__) A__ : List[str]= { """google/pix2struct-textcaps-base""": ( ""...
20
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_ut...
20
1
"""simple docstring""" import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepar...
20
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar A__ : Any= TypeVar("""T""") class __lowerCamelCase ( Generic[T] ): def __init__( self , snake_case_ ) -> None: UpperCamelCase__ = data ...
20
1
"""simple docstring""" from itertools import product def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = sides_number UpperCamelCase__ = max_face_number * dice_...
20
"""simple docstring""" A__ : Tuple= """Alexander Joslin""" import operator as op from .stack import Stack def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase__ = {'*': op.mul, '/': op.truediv, '+': o...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modu...
20
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py A__ : Any= """src/diffusers""" # Matches is_xxx_available() A__ : Tuple= re.c...
20
1
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: A__ : List[str]= None try: import msvcrt except ImportError: A__ : Dict= None try: import fcntl except ImportError: A__ : Dict= No...
20
"""simple docstring""" # Copyright 2022 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...
20
1
"""simple docstring""" import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask...
20
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str]= logging.get_logger(__name__) class __lowerCamelCase ( _a ): a : Optional[int] ="""timm_backbone""" def __init__( self , snak...
20
1
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first colu...
20
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
20
1
"""simple docstring""" import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub...
20
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mo...
20
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ : Dict= logging.get_logger(__name__) A__ : List[str]= { """kssteve...
20
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 , SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" UpperCamelCase__ = defaultdict(SCREAMING_SN...
20
1
"""simple docstring""" import datasets A__ : Tuple= """\ @InProceedings{conneau2018xnli, author = \"Conneau, Alexis and Rinott, Ruty and Lample, Guillaume and Williams, Adina and Bowman, Samuel R. an...
20
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_...
20
1
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax impo...
20
"""simple docstring""" import sys from collections import defaultdict class __lowerCamelCase : def __init__( self ) -> Tuple: UpperCamelCase__ = [] def SCREAMING_SNAKE_CASE__ ( self , snake_case_ ) -> List[str]: ...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 ) -> int: """simple docstring""" UpperCamelCase__ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in...
20
"""simple docstring""" from copy import deepcopy class __lowerCamelCase : def __init__( self , snake_case_ = None , snake_case_ = None ) -> None: if arr is None and size is not None: UpperCamelCase__ = size UpperCam...
20
1
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, ...
20
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow A__ : Union[str, Any]= logging.getLogger() @unitte...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> Any: """simple docstring""" assert x is not None assert y is not None UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) UpperCamelCase__ = le...
20
"""simple docstring""" import warnings 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 A__ : str= logging.get_logger(__...
20
1
"""simple docstring""" import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def lowerCAmelCase_( SCREAMING_SNAKE_...
20
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> Dict: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_re...
20
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTeste...
20
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
20
1
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" UpperCamelCase__ = int(number**0.5 ) retur...
20
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase_( SCRE...
20
1
"""simple docstring""" A__ : Union[str, Any]= tuple[float, float, float] A__ : Dict= tuple[float, float, float] def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> Vectorad: """simple docstring""" UpperCamelCase__ = end_...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" UpperCamelCase__ = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00 ) -> int: ...
20
1
"""simple docstring""" import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, )...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 50_00_00_00 ) -> int: """simple docstring""" UpperCamelCase__ = set() UpperCamelCase__ = int((limit - 24) ** (1 / 2) ) UpperCamelCase__ = set(range(3 , prime...
20
1
"""simple docstring""" class __lowerCamelCase : def __init__( self , snake_case_ , snake_case_ ) -> Union[str, Any]: UpperCamelCase__ = name UpperCamelCase__ = val def __str__( self ) -> Any: r...
20
"""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.t...
20
1
"""simple docstring""" import math import unittest def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" assert isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int ...
20
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" UpperCamelCase__ = len(SCREAMING_SNAKE_CASE ) for i in range(SCREAMING_SNAKE_CASE ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): ...
20
1
"""simple docstring""" from __future__ import annotations import math def lowerCAmelCase_( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" UpperCamelCase__ = u for i in range(1 , SCREAMING_SNAKE_CASE ): ...
20
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A__ : str= { """linear""": PIL.Image.Resampling.BILINEAR, """...
20
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 ...
20
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_ut...
20
1
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) f...
20
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar A__ : Any= TypeVar("""T""") class __lowerCamelCase ( Generic[T] ): def __init__( self , snake_case_ ) -> None: UpperCamelCase__ = data ...
20
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDCondi...
20
"""simple docstring""" A__ : Tuple= """Alexander Joslin""" import operator as op from .stack import Stack def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase__ = {'*': op.mul, '/': op.truediv, '+': o...
20
1
"""simple docstring""" def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) UpperCamelCase__ = sum(SCREAMING_SNAKE_CASE ) / l...
20
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py A__ : Any= """src/diffusers""" # Matches is_xxx_available() A__ : Tuple= re.c...
20
1
"""simple docstring""" A__ : dict[str, float]= { "km/h": 1.0, "m/s": 3.6, "mph": 1.6_0_9_3_4_4, "knot": 1.8_5_2, } A__ : dict[str, float]= { "km/h": 1.0, "m/s": 0.2_7_7_7_7_7_7_7_8, "mph": 0.6_2_1_3_7_1_1_9_2, "knot": 0.5_3_9_9_5_6_8_0_3, } ...
20
"""simple docstring""" # Copyright 2022 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...
20
1
"""simple docstring""" import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.pat...
20
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str]= logging.get_logger(__name__) class __lowerCamelCase ( _a ): a : Optional[int] ="""timm_backbone""" def __init__( self , snak...
20
1
"""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 transform...
20
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
20
1
"""simple docstring""" import math def lowerCAmelCase_( SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" UpperCamelCase__ = 0 UpperCamelCase__ = 0 while num > 0: UpperCamelCase__ = num % 8 Upp...
20
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mo...
20
1
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImagePro...
20
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_( SCREAMING_SNAKE_CASE = 1_00_00_00 , SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" UpperCamelCase__ = defaultdict(SCREAMING_SN...
20
1