code stringlengths 82 54.1k | code_codestyle int64 0 699 | style_context stringlengths 111 35.6k | style_context_codestyle int64 0 699 | label int64 0 1 |
|---|---|---|---|---|
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowercase_: str = {
'configuration_transfo_xl': ['TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TransfoXLConfig'],
'tokenization_transfo_xl': ['Tr... | 648 |
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True):
"""simple docstring"""
assert (
isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCA... | 648 | 1 |
# This is the module that test_patching.py uses to test patch_submodule()
import os # noqa: this is just for tests
import os as renamed_os # noqa: this is just for tests
from os import path # noqa: this is just for tests
from os import path as renamed_path # noqa: this is just for tests
from os.path ... | 648 |
from packaging import version
from .import_utils import is_accelerate_available
if is_accelerate_available():
import accelerate
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not is_accelerate_available():
return method
snake_case__ : Union[str, An... | 648 | 1 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if len(UpperCAmelCase_) <= 1:
return [tuple(UpperCAmelCase_)]
snake_case__ : Tuple = []
def generate(UpperCAmelCase_ , UpperCAmelCase_):
snake_case__ : List[str] = [0... | 648 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Any = int(UpperCAmelCase_)
if decimal in (0, 1): # Exit cases for the recursion
return str(UpperCAmelCase_)
snake_case__ , snake_case__ : Optional[Any] = div... | 648 | 1 |
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ = False):
"""simple docstring"""
if not isinstance(UpperCAmelCase_ , UpperCAmelCase_):
snake_case__ : str = F'Expected string as input, found {type(UpperCAmelCase_)}'
raise ValueError(UpperCAmelC... | 648 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
lowercase_: Tuple = {
'tiny.en': 'https://openaipublic.azureedge.net/main/wh... | 648 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
lowercase_: Dict = {
'configuration_blip': [
'BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
... | 648 |
from collections import namedtuple
lowercase_: Optional[int] = namedtuple('from_to', 'from_ to')
lowercase_: str = {
'cubicmeter': from_to(1, 1),
'litre': from_to(0.0_0_1, 10_00),
'kilolitre': from_to(1, 1),
'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2),
... | 648 | 1 |
from abc import ABC, abstractmethod
from argparse import ArgumentParser
class lowercase__ (__snake_case ):
"""simple docstring"""
@staticmethod
@abstractmethod
def lowercase ( __a : ArgumentParser ):
raise NotImplementedError()
@... | 648 |
def _lowercase ( UpperCAmelCase_=28_123):
"""simple docstring"""
snake_case__ : Dict = [1] * (limit + 1)
for i in range(2 , int(limit**0.5) + 1):
sum_divs[i * i] += i
for k in range(i + 1 , limit // i + 1):
sum_divs[k * i] += k + i
sn... | 648 | 1 |
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_utils_base import TextInput
from ...utils ... | 648 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
from packaging import version
if TYPE_CHECKING:
from ... import PreTrainedTokenizer, TensorType
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSp... | 648 | 1 |
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 22):
"""simple docstring"""
snake_case__ : List[Any] = range(1 , UpperCAmelCase_)
snake_case__ : List[Any] = range(1 , UpperCAmelCase_)
return sum(
1 for po... | 648 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase_: int = {
'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC... | 648 | 1 |
import math
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Dict = len(UpperCAmelCase_)
snake_case__ : List[Any] = int(math.floor(math.sqrt(UpperCAmelCase_)))
snake_case__ : List[st... | 648 |
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_modeling_common import ModelTesterMixin, ids... | 648 | 1 |
import collections
import inspect
import unittest
from transformers import SwinvaConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_configuration_common imp... | 648 |
from __future__ import annotations
import math
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if 1 < number < 4:
# 2 and 3 are primes
return True
elif number < 2 or number % 2 == 0 or number % 3 == 0:
# Negatives, 0, 1, all even numbers, all multiples of 3 are ... | 648 | 1 |
import os
from argparse import ArgumentParser
from typing import List
import torch.utils.data
from datasets import Dataset, IterableDataset
from datasets.distributed import split_dataset_by_node
lowercase_: Dict = 4
lowercase_: Union[str, Any] = 3
class ... | 648 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
lowercase_: Optional[Any] = {
'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'],
'tokenization_canine': [... | 648 | 1 |
import argparse
import os.path as osp
import re
import torch
from safetensors.torch import load_file, save_file
# =================#
# UNet Conversion #
# =================#
lowercase_: int = [
# (stable-diffusion, HF Diffusers)
('time_embed.0.weight', 'time_embedding.li... | 648 |
from __future__ import annotations
from math import pi
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
if (inductance, frequency, reactance).count(0) != 1:
raise ValueError("""One and only one argument must be 0""")
if... | 648 | 1 |
import torch
from diffusers import CMStochasticIterativeScheduler
from .test_schedulers import SchedulerCommonTest
class lowercase__ (__snake_case ):
"""simple docstring"""
__UpperCamelCase : Any = (CMStochasticIterativeScheduler,)
__UpperCa... | 648 |
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features
from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla... | 648 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
lowercase_: Any = {
'configuration_chinese_clip': [
'CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
'ChineseCLIPConfig',
... | 648 |
import torch
from diffusers import CMStochasticIterativeScheduler
from .test_schedulers import SchedulerCommonTest
class lowercase__ (__snake_case ):
"""simple docstring"""
__UpperCamelCase : Any = (CMStochasticIterativeScheduler,)
__UpperCa... | 648 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
lowercase_: int = {
'configuration_mobilenet_v2': [
'MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP',
'MobileNetV2Config',
... | 648 |
import unittest
from pathlib import Path
from shutil import copyfile
from transformers import SPIECE_UNDERLINE, is_sentencepiece_available
from transformers.models.speech_to_text import SpeechaTextTokenizer
from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save... | 648 | 1 |
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_: List[Any] = {
'dist... | 648 |
# 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/licenses/LICENSE-2.0
#
# Unless requi... | 648 | 1 |
from __future__ import annotations
import unittest
from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available
from transformers.testing_utils import require_tf, require_tokenizers, slow
from transformers.utils import cached_property
from ...test_configuration_common imp... | 648 |
import unittest
from accelerate import debug_launcher
from accelerate.test_utils import require_cpu, test_ops, test_script
@require_cpu
class lowercase__ (unittest.TestCase ):
"""simple docstring"""
def lowercase ( self : List[str] ):
debug_launch... | 648 | 1 |
import argparse
import os
from pathlib import Path
from typing import Dict
import tensorflow as tf
import torch
from tqdm import tqdm
from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer
from transformers.models.pegasus.configuration_pegasus import DEFAULTS, task... | 648 |
import math
from datetime import datetime, timedelta
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Union[str, Any] = year % 19
snake_case__ : Tuple = year % 4
snake_case__ : Any = year % 7
... | 648 | 1 |
from __future__ import annotations
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
if partitions <= 0:
raise ValueError("""partitions must be a positive number!""")
if partitions > number_of_bytes:
raise ValueError("""partitions can not > numb... | 648 |
import torch
from diffusers import DiffusionPipeline
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ):
super().__init__()
self.register_modules(unet=__a ... | 648 | 1 |
from packaging import version
from .import_utils import is_accelerate_available
if is_accelerate_available():
import accelerate
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not is_accelerate_available():
return method
snake_case__ : Union[str, An... | 648 |
import warnings
from ...utils import logging
from .image_processing_poolformer import PoolFormerImageProcessor
lowercase_: str = logging.get_logger(__name__)
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : in... | 648 | 1 |
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_configuration_common import C... | 648 |
import unittest
from transformers import BertGenerationConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import... | 648 | 1 |
import os
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 logging
lowercase_: List[str] = logging.get_logger(__name__)
lowercase_: T... | 648 |
from __future__ import annotations
import numpy as np
from numpy import floataa
from numpy.typing import NDArray
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ):
"""simple docstring"""
snake_case__ , sna... | 648 | 1 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
lowercase_: List[str] = {'tokenization_bertweet': ['BertweetTokenizer']}
if TYPE_CHECKING:
from .tokenization_bertweet import BertweetTokenizer
else:
import sys
lowercase_: str = _LazyModule(_... | 648 |
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True):
"""simple docstring"""
assert (
isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCA... | 648 | 1 |
import argparse
import os
from pathlib import Path
import torch
from bark.generation import _load_model as _bark_load_model
from huggingface_hub import hf_hub_download
from transformers import EncodecConfig, EncodecModel, set_seed
from transformers.models.bark.configuration_bark import (
BarkCoa... | 648 |
from packaging import version
from .import_utils import is_accelerate_available
if is_accelerate_available():
import accelerate
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not is_accelerate_available():
return method
snake_case__ : Union[str, An... | 648 | 1 |
import torch
from diffusers import DiffusionPipeline
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ):
super().__init__()
self.register_modules(unet=__a ... | 648 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Any = int(UpperCAmelCase_)
if decimal in (0, 1): # Exit cases for the recursion
return str(UpperCAmelCase_)
snake_case__ , snake_case__ : Optional[Any] = div... | 648 | 1 |
from argparse import ArgumentParser
from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline
from ..utils import logging
from . import BaseTransformersCLICommand
lowercase_: Union[str, Any] = logging.get_logger(__name__) # pylint: disable=invalid-name
def _... | 648 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
lowercase_: Tuple = {
'tiny.en': 'https://openaipublic.azureedge.net/main/wh... | 648 | 1 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
lowercase_: Optional[int] = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']}
if TYPE_CHECKING:
from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer
else:
import sys
lowercas... | 648 |
from collections import namedtuple
lowercase_: Optional[int] = namedtuple('from_to', 'from_ to')
lowercase_: str = {
'cubicmeter': from_to(1, 1),
'litre': from_to(0.0_0_1, 10_00),
'kilolitre': from_to(1, 1),
'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2),
... | 648 | 1 |
import argparse
import re
import requests
import torch
# git clone https://github.com/salesforce/BLIP.git
from models.blip import blip_decoder
from models.blip_itm import blip_itm
from models.blip_vqa import blip_vqa
from PIL import Image
from torchvision import transforms
from torchvision.transfo... | 648 |
def _lowercase ( UpperCAmelCase_=28_123):
"""simple docstring"""
snake_case__ : Dict = [1] * (limit + 1)
for i in range(2 , int(limit**0.5) + 1):
sum_divs[i * i] += i
for k in range(i + 1 , limit // i + 1):
sum_divs[k * i] += k + i
sn... | 648 | 1 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not all(char in """01""" for char in bin_string):
raise ValueError("""Non-binary value was passed to the function""")
if not bin_string:
raise ValueError("""Empty string was passed to the function""")
snake_case__ ... | 648 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
from packaging import version
if TYPE_CHECKING:
from ... import PreTrainedTokenizer, TensorType
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSp... | 648 | 1 |
from __future__ import annotations
import collections
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import is_tf_available, is_vision_available
from ...test_modeling_tf_common import floats_tensor... | 648 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase_: int = {
'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC... | 648 | 1 |
from __future__ import annotations
import typing
from collections.abc import Iterable
import numpy as np
lowercase_: str = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007
lowercase_: Union[str, Any] = typing.Union[np.floataa, int, float] # noqa: ... | 648 |
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_modeling_common import ModelTesterMixin, ids... | 648 | 1 |
from __future__ import annotations
from collections.abc import Callable
from typing import Any, Generic, TypeVar
lowercase_: str = TypeVar('T')
class lowercase__ (Generic[T] ):
"""simple docstring"""
def __init__( self : Dict , __a : lis... | 648 |
from __future__ import annotations
import math
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if 1 < number < 4:
# 2 and 3 are primes
return True
elif number < 2 or number % 2 == 0 or number % 3 == 0:
# Negatives, 0, 1, all even numbers, all multiples of 3 are ... | 648 | 1 |
import argparse
import torch
from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration
from transformers.utils import logging
logging.set_verbosity_info()
lowercase_: Tuple = logging.get_logger(__name__)
lowercase_: Union[str, Any] = [
['att... | 648 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
lowercase_: Optional[Any] = {
'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'],
'tokenization_canine': [... | 648 | 1 |
import torch
from transformers import AutoModel
class lowercase__ (torch.nn.Module ):
"""simple docstring"""
def __init__( self : List[str] , __a : int="sayef/fsner-bert-base-uncased" ):
super(__a , self ).__init__()
snake_case__ : ... | 648 |
from __future__ import annotations
from math import pi
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
if (inductance, frequency, reactance).count(0) != 1:
raise ValueError("""One and only one argument must be 0""")
if... | 648 | 1 |
import datasets
lowercase_: Any = '\\n@InProceedings{conneau2018xnli,\n author = "Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, Holger\n ... | 648 |
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features
from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla... | 648 | 1 |
import argparse
import torch
from transformers import (
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaForAudioFrameClassification,
WavaVecaForSequenceClassification,
WavaVecaForXVector,
logging,
)
logging.set_verbosity_info()
lowercase_: Optional[Any] = ... | 648 |
import torch
from diffusers import CMStochasticIterativeScheduler
from .test_schedulers import SchedulerCommonTest
class lowercase__ (__snake_case ):
"""simple docstring"""
__UpperCamelCase : Any = (CMStochasticIterativeScheduler,)
__UpperCa... | 648 | 1 |
import warnings
from typing import List, Optional, Union
from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
clas... | 648 |
import unittest
from pathlib import Path
from shutil import copyfile
from transformers import SPIECE_UNDERLINE, is_sentencepiece_available
from transformers.models.speech_to_text import SpeechaTextTokenizer
from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save... | 648 | 1 |
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 _lowercase ( UpperCAmelCase_):
"""simple docstring"""
... | 648 |
# 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/licenses/LICENSE-2.0
#
# Unless requi... | 648 | 1 |
from math import ceil
def _lowercase ( UpperCAmelCase_ = 1_001):
"""simple docstring"""
snake_case__ : Dict = 1
for i in range(1 , int(ceil(n / 2.0))):
snake_case__ : Optional[Any] = 2 * i + 1
snake_case__ : Optional[i... | 648 |
import unittest
from accelerate import debug_launcher
from accelerate.test_utils import require_cpu, test_ops, test_script
@require_cpu
class lowercase__ (unittest.TestCase ):
"""simple docstring"""
def lowercase ( self : List[str] ):
debug_launch... | 648 | 1 |
import inspect
import re
from transformers.utils import direct_transformers_import
# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_config_docstrings.py
lowercase_: List[Any] = 'src/transformers'
# This ... | 648 |
import math
from datetime import datetime, timedelta
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Union[str, Any] = year % 19
snake_case__ : Tuple = year % 4
snake_case__ : Any = year % 7
... | 648 | 1 |
from __future__ import annotations
from math import pi
def __lowercase ( snake_case, snake_case, snake_case ):
"""simple docstring"""
if (inductance, frequency, reactance).count(0 ) != 1:
raise ValueError('''One and only one argument must be 0''' )
if inductance... | 0 |
import torch
from diffusers import DiffusionPipeline
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ):
super().__init__()
self.register_modules(unet=__a ... | 648 | 0 |
from typing import List
import jiwer
import jiwer.transforms as tr
from packaging import version
import datasets
from datasets.config import PY_VERSION
if PY_VERSION < version.parse('''3.8'''):
import importlib_metadata
else:
import importlib.metadata as importlib_metadata
__snake_ca... | 1 |
import warnings
from ...utils import logging
from .image_processing_poolformer import PoolFormerImageProcessor
lowercase_: str = logging.get_logger(__name__)
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : in... | 648 | 0 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
UpperCAmelCase_ = logging.get_logger(__name__)
UpperCAmelCase_ = {
"""speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json""",
# See all M-CTC-T... | 2 |
import unittest
from transformers import BertGenerationConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import... | 648 | 0 |
'''simple docstring'''
from ....configuration_utils import PretrainedConfig
from ....utils import logging
lowerCAmelCase : Optional[Any] = logging.get_logger(__name__)
lowerCAmelCase : Dict = {
'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-la... | 3 |
from __future__ import annotations
import numpy as np
from numpy import floataa
from numpy.typing import NDArray
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ):
"""simple docstring"""
snake_case__ , sna... | 648 | 0 |
"""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/LICENSE-2.... | 4 |
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True):
"""simple docstring"""
assert (
isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCA... | 648 | 0 |
'''simple docstring'''
import heapq
import sys
import numpy as np
_lowercase = tuple[int, int]
class UpperCAmelCase_ :
'''simple docstring'''
def __init__( self ):
"""simple docstring"""
_lowerCAmelCase = []
_lowerCAm... | 5 |
from packaging import version
from .import_utils import is_accelerate_available
if is_accelerate_available():
import accelerate
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not is_accelerate_available():
return method
snake_case__ : Union[str, An... | 648 | 0 |
from copy import deepcopy
import torch
import torch.nn.functional as F
from torch.optim import AdamW
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import DataLoader
from accelerate.accelerator import Accelerator
from accelerate.state import GradientState
from accelerate.test_utils import R... | 6 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Any = int(UpperCAmelCase_)
if decimal in (0, 1): # Exit cases for the recursion
return str(UpperCAmelCase_)
snake_case__ , snake_case__ : Optional[Any] = div... | 648 | 0 |
"""simple docstring"""
import baseaa
def _snake_case ( _snake_case : str ) -> bytes:
'''simple docstring'''
return baseaa.aaaencode(string.encode('utf-8' ) )
def _snake_case ( _snake_case : bytes ) -> str:
'''simple docstrin... | 7 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
lowercase_: Tuple = {
'tiny.en': 'https://openaipublic.azureedge.net/main/wh... | 648 | 0 |
'''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
lowercase__ : List[Any] = False
class SCREAMING... | 8 |
from collections import namedtuple
lowercase_: Optional[int] = namedtuple('from_to', 'from_ to')
lowercase_: str = {
'cubicmeter': from_to(1, 1),
'litre': from_to(0.0_0_1, 10_00),
'kilolitre': from_to(1, 1),
'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2),
... | 648 | 0 |
import unittest
from datasets import load_dataset
from transformers import BloomTokenizerFast
from transformers.testing_utils import require_tokenizers
from ...test_tokenization_common import TokenizerTesterMixin
@require_tokenizers
class __lowerCAmelCase ( UpperCAmelCase_ , unittest.TestCase ):
... | 9 |
def _lowercase ( UpperCAmelCase_=28_123):
"""simple docstring"""
snake_case__ : Dict = [1] * (limit + 1)
for i in range(2 , int(limit**0.5) + 1):
sum_divs[i * i] += i
for k in range(i + 1 , limit // i + 1):
sum_divs[k * i] += k + i
sn... | 648 | 0 |
def _snake_case ( ):
return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )]
_lowerCAmelCase = generate_large_matrix()
_lowerCAmelCase = (
[[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]],
[[3, 2], [1, 0]],
[[7, 7, 6]],
... | 10 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
from packaging import version
if TYPE_CHECKING:
from ... import PreTrainedTokenizer, TensorType
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSp... | 648 | 0 |
'''simple docstring'''
import os
import numpy
import onnx
def lowerCAmelCase (__A , __A):
"""simple docstring"""
_a = a.name
_a = b.name
_a = ''''''
_a = ''''''
_a = a == b
_a ... | 11 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase_: int = {
'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC... | 648 | 0 |
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 Image
from ..i... | 12 |
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_modeling_common import ModelTesterMixin, ids... | 648 | 0 |
'''simple docstring'''
import fire
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import AutoTokenizer
from utils import SeqaSeqDataset, pickle_save
def UpperCAmelCase__ ( UpperCAmelCase_ : Union[str, Any] , UpperCAmelCase_ : str , ... | 13 |
from __future__ import annotations
import math
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if 1 < number < 4:
# 2 and 3 are primes
return True
elif number < 2 or number % 2 == 0 or number % 3 == 0:
# Negatives, 0, 1, all even numbers, all multiples of 3 are ... | 648 | 0 |
from __future__ import annotations
a__ = list[list[int]]
# assigning initial values to the grid
a__ = [
[3, 0, 6, 5, 0, 8, 4, 0, 0],
[5, 2, 0, 0, 0, 0, 0, 0, 0],
[0, 8, 7, 0, 0, 0, 0, 3, 1],
[0, 0, 3, 0, 1, 0, 0, 8, 0],
[9, 0, 0, 8, 6, 3, 0, 0, 5],
... | 14 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
lowercase_: Optional[Any] = {
'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'],
'tokenization_canine': [... | 648 | 0 |
class A :
'''simple docstring'''
def __init__(self : Union[str, Any] ) -> Dict:
"""simple docstring"""
lowercase__ = {}
def lowerCamelCase__ (self : Union[str, Any] ) -> None:
"""simple ... | 15 |
from __future__ import annotations
from math import pi
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
if (inductance, frequency, reactance).count(0) != 1:
raise ValueError("""One and only one argument must be 0""")
if... | 648 | 0 |
import os
from pickle import UnpicklingError
from typing import Dict, Tuple
import jax
import jax.numpy as jnp
import numpy as np
from flax.serialization import from_bytes
from flax.traverse_util import flatten_dict, unflatten_dict
import transformers
from .utils import logging
__A : List[... | 16 |
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features
from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla... | 648 | 0 |
import sys
def __SCREAMING_SNAKE_CASE ( a__ : List[Any] ) -> int:
__A : Union[str, Any] = len(a__ )
__A : Any = [[0 for x in range(a__ )] for x in range(a__ )]
__A : Optional[Any] = [[0 for x in range(a__ )] for x in range(a__ ... | 17 |
import torch
from diffusers import CMStochasticIterativeScheduler
from .test_schedulers import SchedulerCommonTest
class lowercase__ (__snake_case ):
"""simple docstring"""
__UpperCamelCase : Any = (CMStochasticIterativeScheduler,)
__UpperCa... | 648 | 0 |
'''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 import l... | 18 |
import unittest
from pathlib import Path
from shutil import copyfile
from transformers import SPIECE_UNDERLINE, is_sentencepiece_available
from transformers.models.speech_to_text import SpeechaTextTokenizer
from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save... | 648 | 0 |
"""simple docstring"""
import argparse
import json
import os
import numpy as np
import PIL
import requests
import tensorflow.keras.applications.efficientnet as efficientnet
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from tensorflow.keras.preprocessing import ... | 19 |
# 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/licenses/LICENSE-2.0
#
# Unless requi... | 648 | 0 |
from __future__ import annotations
from typing import Generic, TypeVar
_lowerCAmelCase: Optional[Any] = TypeVar('T')
class lowercase_ (Generic[T] ):
def __init__( self , lowercase_) -> None:
a__ =data
a__ =self
a__ ... | 20 |
import unittest
from accelerate import debug_launcher
from accelerate.test_utils import require_cpu, test_ops, test_script
@require_cpu
class lowercase__ (unittest.TestCase ):
"""simple docstring"""
def lowercase ( self : List[str] ):
debug_launch... | 648 | 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 (
center_crop,
get_resize_output_image_size,
normalize,
rescale,
resize,
to_channel_dimen... | 21 |
import math
from datetime import datetime, timedelta
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Union[str, Any] = year % 19
snake_case__ : Tuple = year % 4
snake_case__ : Any = year % 7
... | 648 | 0 |
'''simple docstring'''
from dataclasses import dataclass
from typing import Optional
import numpy as np
import torch
import torch.nn as nn
from ..utils import BaseOutput, is_torch_version, randn_tensor
from .attention_processor import SpatialNorm
from .unet_ad_blocks import UNetMidBlockaD, get... | 22 |
import torch
from diffusers import DiffusionPipeline
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ):
super().__init__()
self.register_modules(unet=__a ... | 648 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available
snake_case__ : Optional[Any] = {"""tokenization_herbert""": ["""HerbertTokenizer"""]}
try:
if not is_tokenizers_available():
raise OptionalDepende... | 23 |
import warnings
from ...utils import logging
from .image_processing_poolformer import PoolFormerImageProcessor
lowercase_: str = logging.get_logger(__name__)
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : in... | 648 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
UpperCAmelCase_ : List[Any] = {
'''configuration_squeezebert''': [
'''SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
... | 24 |
import unittest
from transformers import BertGenerationConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import... | 648 | 0 |
def lowerCamelCase__ ( _a):
SCREAMING_SNAKE_CASE : Optional[int] = [0] * len(_a)
for i in range(1 , len(_a)):
# use last results for better performance - dynamic programming
SCREAMING_SNAKE_CASE : Dict = prefix_result[i - 1]
while j > 0 and input_string[i] != in... | 25 |
from __future__ import annotations
import numpy as np
from numpy import floataa
from numpy.typing import NDArray
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ):
"""simple docstring"""
snake_case__ , sna... | 648 | 0 |
'''simple docstring'''
import unittest
import numpy as np
from transformers import RoFormerConfig, is_flax_available
from transformers.testing_utils import require_flax, slow
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask
if is_fl... | 26 |
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True):
"""simple docstring"""
assert (
isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCA... | 648 | 0 |
from __future__ import annotations
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , ) -> None:
"""simple docstring"""
... | 27 |
from packaging import version
from .import_utils import is_accelerate_available
if is_accelerate_available():
import accelerate
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not is_accelerate_available():
return method
snake_case__ : Union[str, An... | 648 | 0 |
'''simple docstring'''
import inspect
import unittest
from transformers import ConvNextVaConfig
from transformers.models.auto import get_values
from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES
from transformers.testing_utils import require_... | 28 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Any = int(UpperCAmelCase_)
if decimal in (0, 1): # Exit cases for the recursion
return str(UpperCAmelCase_)
snake_case__ , snake_case__ : Optional[Any] = div... | 648 | 0 |
"""simple docstring"""
from queue import PriorityQueue
from typing import Any
import numpy as np
def lowercase ( lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,):
for nxt, d in graph[v]:... | 29 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
lowercase_: Tuple = {
'tiny.en': 'https://openaipublic.azureedge.net/main/wh... | 648 | 0 |
import os
from datetime import datetime as dt
from github import Github
__a = [
'good first issue',
'feature request',
'wip',
]
def lowerCamelCase__ ( ):
'''simple docstring'''
UpperCAmelCase_ : str = Github(os.environ['''GITHUB_TOKEN'''] )
Up... | 30 |
from collections import namedtuple
lowercase_: Optional[int] = namedtuple('from_to', 'from_ to')
lowercase_: str = {
'cubicmeter': from_to(1, 1),
'litre': from_to(0.0_0_1, 10_00),
'kilolitre': from_to(1, 1),
'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2),
... | 648 | 0 |
def UpperCAmelCase_ ( __UpperCAmelCase : int = 10 , __UpperCAmelCase : int = 10_00 , __UpperCAmelCase : bool = True ) -> int:
assert (
isinstance(__UpperCAmelCase , __UpperCAmelCase )
and isinstance(__UpperCAmelCase , __U... | 31 |
def _lowercase ( UpperCAmelCase_=28_123):
"""simple docstring"""
snake_case__ : Dict = [1] * (limit + 1)
for i in range(2 , int(limit**0.5) + 1):
sum_divs[i * i] += i
for k in range(i + 1 , limit // i + 1):
sum_divs[k * i] += k + i
sn... | 648 | 0 |
from typing import Optional
import torch
import torch.utils.checkpoint
from torch import Tensor, nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forwar... | 32 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
from packaging import version
if TYPE_CHECKING:
from ... import PreTrainedTokenizer, TensorType
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSp... | 648 | 0 |
def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> bool:
if number < 0:
raise ValueError('''number must not be negative''' )
return number & (number - 1) == 0
if __name__ == "__main__":
import doctest
doctest.testmod()
| 33 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase_: int = {
'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC... | 648 | 0 |
"""simple docstring"""
from typing import List, Optional, Tuple, Union
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
from ... import AutoBackbone
from ...modeling_outputs import SemanticSegmenterOutput
from ...modeling_utils import PreTrainedModel
from ...utils import add_start_d... | 34 |
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_modeling_common import ModelTesterMixin, ids... | 648 | 0 |
import math
from typing import Dict, Iterable, List, Optional, Tuple, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format
from ...image_utils import (
IMAGENET_STAN... | 35 |
from __future__ import annotations
import math
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if 1 < number < 4:
# 2 and 3 are primes
return True
elif number < 2 or number % 2 == 0 or number % 3 == 0:
# Negatives, 0, 1, all even numbers, all multiples of 3 are ... | 648 | 0 |
import argparse
from pathlib import Path
import torch
from transformers import OPTConfig, OPTModel
from transformers.utils import logging
logging.set_verbosity_info()
__lowercase : Optional[int] = logging.get_logger(__name__)
def lowercase ( __A : Union[str, Any] ) -> Tup... | 36 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
lowercase_: Optional[Any] = {
'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'],
'tokenization_canine': [... | 648 | 0 |
def UpperCamelCase_ ( __a ) -> list:
a__ : Union[str, Any] = [0] * len(__a )
for i in range(1 , len(__a ) ):
# use last results for better performance - dynamic programming
a__ : Dict = prefix_result[i - 1]
while j > 0 an... | 37 |
from __future__ import annotations
from math import pi
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
if (inductance, frequency, reactance).count(0) != 1:
raise ValueError("""One and only one argument must be 0""")
if... | 648 | 0 |
'''simple docstring'''
import importlib
import sys
from argparse import REMAINDER, ArgumentParser
from pathlib import Path
import torch_xla.distributed.xla_multiprocessing as xmp
def UpperCamelCase__ ( ) -> Dict:
'''simple docstring'''
snake_case__ : Union[str, Any] ... | 38 |
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features
from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla... | 648 | 0 |
# flake8: noqa
# Lint as: python3
from typing import Dict, List, Optional, Type
from .. import config
from ..utils import logging
from .formatting import (
ArrowFormatter,
CustomFormatter,
Formatter,
PandasFormatter,
PythonFormatter,
TensorFormatter,
format_table,
qu... | 39 |
import torch
from diffusers import CMStochasticIterativeScheduler
from .test_schedulers import SchedulerCommonTest
class lowercase__ (__snake_case ):
"""simple docstring"""
__UpperCamelCase : Any = (CMStochasticIterativeScheduler,)
__UpperCa... | 648 | 0 |
def UpperCamelCase ( snake_case__ : List[str] , snake_case__ : Any ) -> Union[str, Any]:
UpperCamelCase : int = [1]
for i in range(2 , snake_case__ ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k... | 40 |
import unittest
from pathlib import Path
from shutil import copyfile
from transformers import SPIECE_UNDERLINE, is_sentencepiece_available
from transformers.models.speech_to_text import SpeechaTextTokenizer
from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save... | 648 | 0 |
'''simple docstring'''
from __future__ import annotations
import time
from math import sqrt
# 1 for manhattan, 0 for euclidean
lowerCAmelCase__ = 0
lowerCAmelCase__ = [
[0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles
[0, 0, 0, 0, 0, 0, ... | 41 |
# 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/licenses/LICENSE-2.0
#
# Unless requi... | 648 | 0 |
'''simple docstring'''
import inspect
import unittest
from transformers import SegformerConfig, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
... | 42 |
import unittest
from accelerate import debug_launcher
from accelerate.test_utils import require_cpu, test_ops, test_script
@require_cpu
class lowercase__ (unittest.TestCase ):
"""simple docstring"""
def lowercase ( self : List[str] ):
debug_launch... | 648 | 0 |
from __future__ import annotations
import math
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ):
"""simple docstring"""
if depth < 0:
raise ValueError('''Depth cannot be less ... | 43 |
import math
from datetime import datetime, timedelta
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Union[str, Any] = year % 19
snake_case__ : Tuple = year % 4
snake_case__ : Any = year % 7
... | 648 | 0 |
'''simple docstring'''
import argparse
import torch
from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta
from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging
logging.set_verbosity_info()
def A_ ( _lowerCAmelCase : List[Any] , _lowerCAmelCase : ... | 44 |
import torch
from diffusers import DiffusionPipeline
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ):
super().__init__()
self.register_modules(unet=__a ... | 648 | 0 |
from __future__ import annotations
def A ( lowercase__ : int | float | str , lowercase__ : int | float | str ) -> list[str]:
if nth_term == "":
return [""]
UpperCamelCase__ :Dict = int(lowercase__ )
UpperCamelCase__ :Union[str, Any] = int(lowercase__ )
UpperCamelCa... | 45 |
import warnings
from ...utils import logging
from .image_processing_poolformer import PoolFormerImageProcessor
lowercase_: str = logging.get_logger(__name__)
class lowercase__ (__snake_case ):
"""simple docstring"""
def __init__( self : in... | 648 | 0 |
"""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 cached... | 46 |
import unittest
from transformers import BertGenerationConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import... | 648 | 0 |
import os
import tempfile
import unittest
from transformers import is_torch_available
from transformers.testing_utils import require_torch
if is_torch_available():
import torch
from torch import nn
from transformers import (
Adafactor,
AdamW,
... | 47 |
from __future__ import annotations
import numpy as np
from numpy import floataa
from numpy.typing import NDArray
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ):
"""simple docstring"""
snake_case__ , sna... | 648 | 0 |
'''simple docstring'''
import random
import unittest
import torch
from diffusers import IFInpaintingPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params import (
... | 48 |
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True):
"""simple docstring"""
assert (
isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCAmelCase_ , UpperCAmelCase_)
and isinstance(UpperCA... | 648 | 0 |
"""simple docstring"""
import builtins
import sys
from ...utils.imports import _is_package_available
from . import cursor, input
from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor
from .keymap import KEYMAP
_lowercase : Dict = ... | 49 |
from packaging import version
from .import_utils import is_accelerate_available
if is_accelerate_available():
import accelerate
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if not is_accelerate_available():
return method
snake_case__ : Union[str, An... | 648 | 0 |
'''simple docstring'''
from __future__ import annotations
from collections.abc import Generator
def A__ ( ):
lowerCamelCase__ = {}
lowerCamelCase__ = 2
while True:
lowerCamelCase__ = factor_map.pop(__lowerCAmelCase , __lowerCAmelCase ... | 50 |
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
snake_case__ : Any = int(UpperCAmelCase_)
if decimal in (0, 1): # Exit cases for the recursion
return str(UpperCAmelCase_)
snake_case__ , snake_case__ : Optional[Any] = div... | 648 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
a__ : Dict = {
'configuration_convnext': ['CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_... | 51 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
lowercase_: Tuple = {
'tiny.en': 'https://openaipublic.azureedge.net/main/wh... | 648 | 0 |
"""simple docstring"""
import torch
from diffusers import DDPMScheduler
from .test_schedulers import SchedulerCommonTest
class __lowercase ( _UpperCamelCase ):
'''simple docstring'''
__lowerCAmelCase = (DDPMScheduler,)
... | 52 |
from collections import namedtuple
lowercase_: Optional[int] = namedtuple('from_to', 'from_ to')
lowercase_: str = {
'cubicmeter': from_to(1, 1),
'litre': from_to(0.0_0_1, 10_00),
'kilolitre': from_to(1, 1),
'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2),
... | 648 | 0 |
import inspect
import unittest
from huggingface_hub import hf_hub_download
from transformers import ConvNextConfig, UperNetConfig
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device
from transformers.utils import is_torch_available, is_vision_availab... | 53 |
def _lowercase ( UpperCAmelCase_=28_123):
"""simple docstring"""
snake_case__ : Dict = [1] * (limit + 1)
for i in range(2 , int(limit**0.5) + 1):
sum_divs[i * i] += i
for k in range(i + 1 , limit // i + 1):
sum_divs[k * i] += k + i
sn... | 648 | 0 |
import unittest
from transformers import (
MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
TextaTextGenerationPipeline,
pipeline,
)
from transformers.testing_utils import is_pipeline_test, require_tf, require_torch
from transformers.utils import i... | 54 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
from packaging import version
if TYPE_CHECKING:
from ... import PreTrainedTokenizer, TensorType
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSp... | 648 | 0 |
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,
BertTokenize... | 55 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase_: int = {
'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC... | 648 | 0 |
'''simple docstring'''
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
_a : str = logging.get_logger(__name__)
_a : List[Any] ... | 56 |
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_modeling_common import ModelTesterMixin, ids... | 648 | 0 |
import os
import tempfile
import unittest
from transformers import is_torch_available
from transformers.testing_utils import require_torch
if is_torch_available():
import torch
from torch import nn
from transformers import (
Adafactor,
AdamW,
get_constant_s... | 57 |
from __future__ import annotations
import math
def _lowercase ( UpperCAmelCase_):
"""simple docstring"""
if 1 < number < 4:
# 2 and 3 are primes
return True
elif number < 2 or number % 2 == 0 or number % 3 == 0:
# Negatives, 0, 1, all even numbers, all multiples of 3 are ... | 648 | 0 |
"""simple docstring"""
import argparse
import os
import re
import torch
from flax.traverse_util import flatten_dict
from tax import checkpoints
from transformers import (
AutoTokenizer,
PixaStructConfig,
PixaStructForConditionalGeneration,
PixaStructImageProcessor,
... | 58 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
lowercase_: Optional[Any] = {
'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'],
'tokenization_canine': [... | 648 | 0 |
import numpy as np
from numpy import ndarray
from scipy.optimize import Bounds, LinearConstraint, minimize
def lowerCAmelCase_ ( __a ) -> float:
"""simple docstring"""
return np.dot(__a , __a )
class _SCREAMING_SNAKE_CASE :
'''simple docstring'''... | 59 |
from __future__ import annotations
from math import pi
def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_):
"""simple docstring"""
if (inductance, frequency, reactance).count(0) != 1:
raise ValueError("""One and only one argument must be 0""")
if... | 648 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.