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
# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__UpperCAmelCase = {
'''configuration_autoformer''': [
'''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
'''AutoformerConfig''',
]... | 40 |
"""simple docstring"""
import json
import os
import shutil
import tempfile
import unittest
from multiprocessing import get_context
from pathlib import Path
import datasets
import numpy as np
from datasets import load_dataset
from parameterized import parameterized
from transforme... | 96 | 0 |
'''simple docstring'''
from __future__ import annotations
def _A ( A__ ):
"""simple docstring"""
__lowercase = 2
__lowercase = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(A__ )
if n > 1:
factors.append(A__ )
return factors
... | 41 |
"""simple docstring"""
def a ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int:
while b:
__magic_name__, __magic_name__: Optional[int] = b, a % b
return a
def a ( __UpperCAmelCase : ... | 96 | 0 |
'''simple docstring'''
A_ = {
"Pillow": "Pillow<10.0.0",
"accelerate": "accelerate>=0.20.3",
"av": "av==9.2.0",
"beautifulsoup4": "beautifulsoup4",
"black": "black~=23.1",
"codecarbon": "codecarbon==1.2.0",
"cookiecutter": "cookiecutter==1.7.3",
"dataclasses": "dataclasses",
"... | 42 |
"""simple docstring"""
import argparse
import gc
import json
import os
import shutil
import warnings
import torch
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
try:
from transformers import LlamaTokenizerFast
except ImportError as e:
war... | 96 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowerCAmelCase = {
'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig',... | 43 |
"""simple docstring"""
from typing import List
from .keymap import KEYMAP, get_character
def a ( __UpperCAmelCase : str ) -> Optional[int]:
def decorator(__UpperCAmelCase : List[str] ):
__magic_name__: Union[str, Any] = ... | 96 | 0 |
'''simple docstring'''
from __future__ import annotations
UpperCAmelCase_ : str = 'Muhammad Umer Farooq'
UpperCAmelCase_ : Dict = 'MIT'
UpperCAmelCase_ : Optional[int] = '1.0.0'
UpperCAmelCase_ : List[str] = 'Muhammad Umer Farooq'
UpperCAmelCase_ : Optional[... | 44 |
"""simple docstring"""
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin... | 96 | 0 |
import argparse
import fairseq
import torch
from torch import nn
from transformers import (
MBartaaTokenizer,
MBartConfig,
MBartForCausalLM,
SpeechEncoderDecoderConfig,
SpeechEncoderDecoderModel,
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaModel,
logging,
)
logging.s... | 45 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
__lowerCamelCase ... | 96 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_speech_available,
is_torch_available,
)
_lowerCAmelCase : Tuple = {
'''configuration_trocr''': ['''TROCR_PRETRAIN... | 46 |
"""simple docstring"""
def a ( __UpperCAmelCase : list[int] ) -> float:
if not nums: # Makes sure that the list is not empty
raise ValueError("""List is empty""" )
__magic_name__: Dict = sum(__UpperCAmelCase ) / len(__UpperC... | 96 | 0 |
import logging
from pathlib import Path
import numpy as np
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
from pytorch_lightning.utilities import rank_zero_only
from utils_rag import save_json
def UpperCAmelCase__ ( ... | 47 |
"""simple docstring"""
from random import randint
from tempfile import TemporaryFile
import numpy as np
def a ( __UpperCAmelCase : Optional[Any] , __UpperCAmelCase : Optional[int] , __UpperCAmelCase : Optional[int] ) -> int:
... | 96 | 0 |
'''simple docstring'''
def A ( UpperCamelCase_ : str ) -> int:
'''simple docstring'''
lowerCAmelCase__ = 1
lowerCAmelCase__ = 2
while i * i <= n:
lowerCAmelCase__ = 0
while n % i == 0:
n //= i
multiplicity... | 48 |
"""simple docstring"""
def a ( __UpperCAmelCase : int = 1_0_0 ) -> int:
__magic_name__: str = 0
__magic_name__: Any = 0
for i in range(1 , n + 1 ):
sum_of_squares += i**2
sum_of_ints += i
... | 96 | 0 |
"""simple docstring"""
from __future__ import annotations
class _UpperCAmelCase :
def __init__( self : List[str] , _lowercase : Optional[Any]=None ):
__UpperCAmelCase = data
__UpperCAmelCase = None
def __repr__( self : Op... | 49 |
"""simple docstring"""
from __future__ import annotations
def a ( __UpperCAmelCase : list ) -> list:
if len(__UpperCAmelCase ) == 0:
return []
__magic_name__, __magic_name__: List[str] = min(__UpperCAmelCase ), max(__U... | 96 | 0 |
'''simple docstring'''
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer
UpperCamelCase : Union[str, Any] = {'vocab_file': 'vocab.txt', '... | 50 |
"""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... | 96 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import _LazyModule
a__ : Tuple = {'processing_wav2vec2_with_lm': ['Wav2Vec2ProcessorWithLM']}
if TYPE_CHECKING:
from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
import sys
a__ :... | 51 |
"""simple docstring"""
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
EulerAncestralDiscreteSchedu... | 96 | 0 |
"""simple docstring"""
from typing import Dict, List
from nltk.translate import gleu_score
import datasets
from datasets import MetricInfo
A = '''\
@misc{wu2016googles,
title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Trans... | 52 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_squeezebert import SqueezeBertTokenizer
__lowerCamelCase ... | 96 | 0 |
import argparse
import torch
from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert
from transformers.utils import logging
logging.set_verbosity_info()
def a_ ( lowerCAmelCase_ : int, lowerCAmelCase_ : Optional[int], lowerCAmelCase_ : Tuple ... | 53 |
"""simple docstring"""
import json
import os
import unittest
from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokeni... | 96 | 0 |
import warnings
from contextlib import contextmanager
from ...processing_utils import ProcessorMixin
from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
from .tokenization_wavaveca import WavaVecaCTCTokenizer
class A ( __lowercase ):
_snake_case ='''Wav2Vec... | 54 |
"""simple docstring"""
from collections import OrderedDict
from typing import List, Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
__lowerCamelCase = logging.get_logger(__... | 96 | 0 |
from __future__ import annotations
from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass
@dataclass
class UpperCAmelCase :
'''simple docstring'''
snake_case_ = 42
snake_case_ = 42
class UpperCAmelCase :
'''simple docst... | 55 |
"""simple docstring"""
import argparse
import json
import os
import re
import torch
from transformers import BloomConfig, BloomModel
from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME
from transformers.utils import logging
logging.set_verbosity_info()
__lowerCamelC... | 96 | 0 |
'''simple docstring'''
from __future__ import annotations
from collections import deque
class _lowercase :
def __init__( self : Optional[Any] , SCREAMING_SNAKE_CASE_ : list[str] ) -> Optional[int]:
__snake_case = []
self.adli... | 56 |
"""simple docstring"""
import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def a ( __UpperCAmelCase : bytes , __UpperCAmelCase : int ) -> np.array:
__magic_name__: Optional[i... | 96 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
A_ : Optional[int] = {
'configuration_xlm_roberta_xl': [
'XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP',
'XLMRobertaXLConfig',
... | 57 |
"""simple docstring"""
from typing import List, Union
import numpy as np
from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, logging
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline
__lowerCamelCase = logging.get_lo... | 96 | 0 |
"""simple docstring"""
from math import cos, sin, sqrt, tau
from audio_filters.iir_filter import IIRFilter
def __lowerCAmelCase ( __UpperCamelCase : int , __UpperCamelCase : int , __UpperCamelCase : float = 1 / sqrt(2 ) ):
'''simpl... | 58 |
"""simple docstring"""
from typing import Optional, Tuple, Union
import tensorflow as tf
from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
TFBas... | 96 | 0 |
def lowerCAmelCase_ ( __a = 100 ) -> int:
"""simple docstring"""
lowerCamelCase__: List[Any] =(n * (n + 1) // 2) ** 2
lowerCamelCase__: Dict =n * (n + 1) * (2 * n + 1) // 6
return sum_cubes - sum_squares
if __name__ == "__main__":
print(f'{solution() = }... | 59 |
"""simple docstring"""
from typing import Union
import fire
import torch
from tqdm import tqdm
def a ( __UpperCAmelCase : str , __UpperCAmelCase : str = "cpu" , __UpperCAmelCase : Union[str, None] = None ) -> None:
__ma... | 96 | 0 |
import os
import tempfile
import unittest
from transformers import DistilBertConfig, is_torch_available
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tens... | 60 |
"""simple docstring"""
def a ( __UpperCAmelCase : List[Any] ) -> str:
__magic_name__: Optional[int] = [0] * len(__UpperCAmelCase )
__magic_name__: str = []
__magic_name__: Any = []
__magic_name__: Union[... | 96 | 0 |
from __future__ import annotations
def _A ( lowerCAmelCase_ : int ):
"""simple docstring"""
lowerCAmelCase__ = 2
lowerCAmelCase__ = []
while i * i <= n:
if n % i:
i += 1
else:
n //=... | 61 |
"""simple docstring"""
from argparse import ArgumentParser
from .env import EnvironmentCommand
def a ( ) -> Tuple:
__magic_name__: Optional[int] = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" )
... | 96 | 0 |
def lowerCamelCase__ ( lowercase = 600851475143 ):
"""simple docstring"""
try:
SCREAMING_SNAKE_CASE : Tuple = int(lowercase )
except (TypeError, ValueError):
raise TypeError("Parameter n must be int or castable to int." )
if n <= 0:
raise ValueEr... | 62 |
"""simple docstring"""
import json
import os
import shutil
import tempfile
import unittest
from multiprocessing import get_context
from pathlib import Path
import datasets
import numpy as np
from datasets import load_dataset
from parameterized import parameterized
from transforme... | 96 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
a : Dict = {
"configuration_blenderbot": [
"BLENDERBO... | 63 |
"""simple docstring"""
def a ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int:
while b:
__magic_name__, __magic_name__: Optional[int] = b, a % b
return a
def a ( __UpperCAmelCase : ... | 96 | 0 |
from itertools import permutations
def A__ ( snake_case_ : tuple ):
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
return False
SCREAMING_SNAKE_CASE__: Dict= [7, 11, 13, 17]
for i, test in enumerate(snake_case_ ):
if... | 64 |
"""simple docstring"""
import argparse
import gc
import json
import os
import shutil
import warnings
import torch
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
try:
from transformers import LlamaTokenizerFast
except ImportError as e:
war... | 96 | 0 |
"""simple docstring"""
import re
def lowerCAmelCase ( __UpperCamelCase ):
'''simple docstring'''
UpperCAmelCase__ : str = re.compile(
r"""^(?:0|94|\+94|0{2}94)""" r"""7(0|1|2|4|5|6|7|8)""" r"""(-| |)""" r"""\d{7}$""" )
return bool(re.search(__UpperC... | 65 |
"""simple docstring"""
from typing import List
from .keymap import KEYMAP, get_character
def a ( __UpperCAmelCase : str ) -> Optional[int]:
def decorator(__UpperCAmelCase : List[str] ):
__magic_name__: Union[str, Any] = ... | 96 | 0 |
from typing import Callable, List, Optional, Union
import PIL
import torch
from transformers import (
CLIPImageProcessor,
CLIPSegForImageSegmentation,
CLIPSegProcessor,
CLIPTextModel,
CLIPTokenizer,
)
from diffusers import DiffusionPipeline
from diffusers.configuration_utils import FrozenDi... | 66 |
"""simple docstring"""
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin... | 96 | 0 |
from __future__ import annotations
def SCREAMING_SNAKE_CASE__ ( snake_case__ :list[int] , snake_case__ :list[int] , snake_case__ :int ) -> tuple[float, list[float]]:
_lowercase = list(range(len(snake_case__ ) ) )
_lowercase = [v / w for v, w ... | 67 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
__lowerCamelCase ... | 96 | 0 |
import math
import sys
def lowercase__ ( A_: str ) -> str:
"""simple docstring"""
__UpperCAmelCase =""""""
try:
with open(A_ , """rb""" ) as binary_file:
__UpperCAmelCase =binary_file.read()
... | 68 |
"""simple docstring"""
def a ( __UpperCAmelCase : list[int] ) -> float:
if not nums: # Makes sure that the list is not empty
raise ValueError("""List is empty""" )
__magic_name__: Dict = sum(__UpperCAmelCase ) / len(__UpperC... | 96 | 0 |
'''simple docstring'''
from string import ascii_uppercase
a : str = {str(ord(c) - 55): c for c in ascii_uppercase}
def __UpperCAmelCase ( _UpperCAmelCase : int , _UpperCAmelCase : int ) -> str:
if isinstance(_UpperCAmelCase , _UpperCAmelCase ... | 69 |
"""simple docstring"""
from random import randint
from tempfile import TemporaryFile
import numpy as np
def a ( __UpperCAmelCase : Optional[Any] , __UpperCAmelCase : Optional[int] , __UpperCAmelCase : Optional[int] ) -> int:
... | 96 | 0 |
import json
import os
from typing import Dict, List, Optional, Tuple
import regex as re
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
lowerCamelCase : str = logging.get_logger(__name__)
lowerCamelCase : List[str] ... | 70 |
"""simple docstring"""
def a ( __UpperCAmelCase : int = 1_0_0 ) -> int:
__magic_name__: str = 0
__magic_name__: Any = 0
for i in range(1 , n + 1 ):
sum_of_squares += i**2
sum_of_ints += i
... | 96 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tokenizers_available,
is_torch_available,
)
_lowerCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CON... | 71 |
"""simple docstring"""
from __future__ import annotations
def a ( __UpperCAmelCase : list ) -> list:
if len(__UpperCAmelCase ) == 0:
return []
__magic_name__, __magic_name__: List[str] = min(__UpperCAmelCase ), max(__U... | 96 | 0 |
'''simple docstring'''
from __future__ import annotations
def UpperCamelCase ( lowercase_ : list[int | str] ) -> None:
'''simple docstring'''
create_state_space_tree(lowercase_ , [] , 0 , [0 for i in range(len(lowercase_ ) )] )
def UpperCamelCase ( ... | 72 |
"""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... | 96 | 0 |
from cva import destroyAllWindows, imread, imshow, waitKey
def lowerCamelCase__ (_UpperCAmelCase):
# getting number of pixels in the image
SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = img.shape[0], img.shape[1]
# converting each pixel's color to its negative
for i in r... | 73 |
"""simple docstring"""
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
EulerAncestralDiscreteSchedu... | 96 | 0 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequenceClassi... | 74 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_squeezebert import SqueezeBertTokenizer
__lowerCamelCase ... | 96 | 0 |
'''simple docstring'''
import json
from typing import Dict, List, Optional, Tuple, Union
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import Pa... | 75 |
"""simple docstring"""
import json
import os
import unittest
from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokeni... | 96 | 0 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_convbert import ConvBertTokenizer
a_ = logging.get_l... | 76 |
"""simple docstring"""
from collections import OrderedDict
from typing import List, Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
__lowerCamelCase = logging.get_logger(__... | 96 | 0 |
"""simple docstring"""
import os
from collections.abc import Iterator
def _UpperCamelCase ( UpperCamelCase = "." ) -> Iterator[str]:
"""simple docstring"""
for dir_path, dir_names, filenames in os.walk(UpperCamelCase ):
__UpperCAmelCase : Any = ... | 77 |
"""simple docstring"""
import argparse
import json
import os
import re
import torch
from transformers import BloomConfig, BloomModel
from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME
from transformers.utils import logging
logging.set_verbosity_info()
__lowerCamelC... | 96 | 0 |
'''simple docstring'''
import collections
import json
import os
import re
from typing import TYPE_CHECKING, List, Optional, Tuple
import numpy as np
from ...tokenization_utils_fast import PreTrainedTokenizer
from ...utils import logging
if TYPE_CHECKING:
from transformers.pipelines.conversational import Co... | 78 |
"""simple docstring"""
import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def a ( __UpperCAmelCase : bytes , __UpperCAmelCase : int ) -> np.array:
__magic_name__: Optional[i... | 96 | 0 |
import warnings
from ...utils import logging
from .image_processing_flava import FlavaImageProcessor
SCREAMING_SNAKE_CASE__ : Optional[Any] = logging.get_logger(__name__)
class UpperCAmelCase_ ( __lowerCamelCase ):
def __init__( self , *_l... | 79 |
"""simple docstring"""
from typing import List, Union
import numpy as np
from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, logging
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline
__lowerCamelCase = logging.get_lo... | 96 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__UpperCamelCase : Tuple = logging.get_logger(__name__)
__UpperCamelCase : int = {
"""unc-nlp/lxmert-base-uncased""": """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json""",
... | 80 |
"""simple docstring"""
from typing import Optional, Tuple, Union
import tensorflow as tf
from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
TFBas... | 96 | 0 |
import os
import tempfile
import unittest
from transformers import FlaubertConfig, is_torch_available
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, r... | 81 |
"""simple docstring"""
from typing import Union
import fire
import torch
from tqdm import tqdm
def a ( __UpperCAmelCase : str , __UpperCAmelCase : str = "cpu" , __UpperCAmelCase : Union[str, None] = None ) -> None:
__ma... | 96 | 0 |
"""simple docstring"""
import tempfile
import unittest
from make_student import create_student_by_copying_alternating_layers
from transformers import AutoConfig
from transformers.file_utils import cached_property
from transformers.testing_utils import require_torch
lowerCamelCase = ... | 82 |
"""simple docstring"""
def a ( __UpperCAmelCase : List[Any] ) -> str:
__magic_name__: Optional[int] = [0] * len(__UpperCAmelCase )
__magic_name__: str = []
__magic_name__: Any = []
__magic_name__: Union[... | 96 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tokenizers_available,
is_torch_available,
)
lowerCAmelCase__ = {
'''configuration_llama''': ['''LLAMA_PRETRAI... | 83 |
"""simple docstring"""
from argparse import ArgumentParser
from .env import EnvironmentCommand
def a ( ) -> Tuple:
__magic_name__: Optional[int] = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" )
... | 96 | 0 |
def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ):
if not isinstance(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ):
lowercase = F'''Input value of [number={number}] must be an integer'''
raise TypeError(__SCREAMING_SNAKE_CASE )
if number < 1:
lowercase = F'''I... | 84 |
"""simple docstring"""
import json
import os
import shutil
import tempfile
import unittest
from multiprocessing import get_context
from pathlib import Path
import datasets
import numpy as np
from datasets import load_dataset
from parameterized import parameterized
from transforme... | 96 | 0 |
import numpy as np
from cva import COLOR_BGR2GRAY, cvtColor, imread
from numpy import array, uinta
from PIL import Image
from digital_image_processing import change_contrast as cc
from digital_image_processing import convert_to_negative as cn
from digital_image_processing import sepia as sp
from digital_image_processi... | 85 |
"""simple docstring"""
def a ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int:
while b:
__magic_name__, __magic_name__: Optional[int] = b, a % b
return a
def a ( __UpperCAmelCase : ... | 96 | 0 |
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.mod... | 86 |
"""simple docstring"""
import argparse
import gc
import json
import os
import shutil
import warnings
import torch
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
try:
from transformers import LlamaTokenizerFast
except ImportError as e:
war... | 96 | 0 |
import warnings
from typing import Dict
import numpy as np
from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline
if is_tf_available():
from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIFICAT... | 87 |
"""simple docstring"""
from typing import List
from .keymap import KEYMAP, get_character
def a ( __UpperCAmelCase : str ) -> Optional[int]:
def decorator(__UpperCAmelCase : List[str] ):
__magic_name__: Union[str, Any] = ... | 96 | 0 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase = logging.get_logger(__name__)
UpperCAmelCase = {
"""google/realm-cc-news-pretrained-embedder""": (
"""https://huggingface.co/google/realm-cc-news-pretrain... | 88 |
"""simple docstring"""
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin... | 96 | 0 |
from typing import List, Optional, Union
import numpy as np
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__... | 89 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
__lowerCamelCase ... | 96 | 0 |
'''simple docstring'''
# XXX: we want transformers master here - in the absense of conftest manipulating sys.path:
# hack it in for now:
import sys
from pathlib import Path
__UpperCAmelCase = Path(__file__).resolve().parents[3] / '''src'''
sys.path.insert(1, str(git_repo_path... | 90 |
"""simple docstring"""
def a ( __UpperCAmelCase : list[int] ) -> float:
if not nums: # Makes sure that the list is not empty
raise ValueError("""List is empty""" )
__magic_name__: Dict = sum(__UpperCAmelCase ) / len(__UpperC... | 96 | 0 |
"""simple docstring"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier
def _snake_case ( snake_case__ : dict ):
ret... | 91 |
"""simple docstring"""
from random import randint
from tempfile import TemporaryFile
import numpy as np
def a ( __UpperCAmelCase : Optional[Any] , __UpperCAmelCase : Optional[int] , __UpperCAmelCase : Optional[int] ) -> int:
... | 96 | 0 |
'''simple docstring'''
def _lowerCAmelCase ( ) -> Optional[Any]:
for n in range(1 , 1000000 ):
yield n * (n + 1) // 2
def _lowerCAmelCase ( __magic_name__ : Optional[int] ) -> str:
lowercase : List[Any] =1
lowercase : ... | 92 |
"""simple docstring"""
def a ( __UpperCAmelCase : int = 1_0_0 ) -> int:
__magic_name__: str = 0
__magic_name__: Any = 0
for i in range(1 , n + 1 ):
sum_of_squares += i**2
sum_of_ints += i
... | 96 | 0 |
"""simple docstring"""
import collections
import gzip
import os
import urllib
import numpy
from tensorflow.python.framework import dtypes, random_seed
from tensorflow.python.platform import gfile
from tensorflow.python.util.deprecation import deprecated
__A = collections.namedtuple("""_Datas... | 93 |
"""simple docstring"""
from __future__ import annotations
def a ( __UpperCAmelCase : list ) -> list:
if len(__UpperCAmelCase ) == 0:
return []
__magic_name__, __magic_name__: List[str] = min(__UpperCAmelCase ), max(__U... | 96 | 0 |
'''simple docstring'''
import argparse
import os
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_task_guides.py
SCREAMING_SNAKE_CASE = 'src/transformers'
SCREA... | 94 |
"""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... | 96 | 0 |
"""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_modeling_common import Model... | 95 |
"""simple docstring"""
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
EulerAncestralDiscreteSchedu... | 96 | 0 |
import numpy as np
class lowercase__:
"""simple docstring"""
def __init__( self : List[str] ) -> str:
lowercase_ = (0, 0)
lowercase_ = None
lowercase_ = 0
lowercase_ = 0
lowercase_ = 0
def __eq__( self : Dict ... | 97 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_squeezebert import SqueezeBertTokenizer
__lowerCamelCase ... | 96 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
lowercase__ : Tuple = {'configuration_mmbt': ['MMBTConfig']}
try:
if not is_torch_available():
raise OptionalDependencyNotAvailable()
except Opti... | 98 |
"""simple docstring"""
import json
import os
import unittest
from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokeni... | 96 | 0 |
from typing import Dict
from .base import GenericTensor, Pipeline
class __UpperCAmelCase ( __A ):
"""simple docstring"""
def snake_case_ ( self , __A=None , __A=None , __A=None , **__A ):
if tokenize_kwargs is None:
... | 99 |
"""simple docstring"""
from collections import OrderedDict
from typing import List, Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
__lowerCamelCase = logging.get_logger(__... | 96 | 0 |
import os
from tempfile import TemporaryDirectory
from unittest import TestCase
import pytest
from absl.testing import parameterized
from datasets import config
from datasets.arrow_reader import HF_GCP_BASE_URL
from datasets.builder import DatasetBuilder
from datasets.dataset_dict import IterableDatasetDict
fro... | 100 |
"""simple docstring"""
import argparse
import json
import os
import re
import torch
from transformers import BloomConfig, BloomModel
from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME
from transformers.utils import logging
logging.set_verbosity_info()
__lowerCamelC... | 96 | 0 |
def a__ ( A__ ):
if length <= 0 or not isinstance(A__, A__ ):
raise ValueError('Length must be a positive integer.' )
return [n * (2 * n - 1) for n in range(A__ )]
if __name__ == "__main__":
print(hexagonal_numbers(length=5))
print(hexagonal_numbers(leng... | 101 |
"""simple docstring"""
import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def a ( __UpperCAmelCase : bytes , __UpperCAmelCase : int ) -> np.array:
__magic_name__: Optional[i... | 96 | 0 |
"""simple docstring"""
import numpy
class lowercase__ :
"""simple docstring"""
def __init__( self , _A , _A ):
'''simple docstring'''
UpperCamelCase : Dict = input_array
... | 102 |
"""simple docstring"""
from typing import List, Union
import numpy as np
from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, logging
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline
__lowerCamelCase = logging.get_lo... | 96 | 0 |
"""simple docstring"""
import json
import sys
import tempfile
import unittest
from pathlib import Path
import transformers
from transformers import (
CONFIG_MAPPING,
IMAGE_PROCESSOR_MAPPING,
AutoConfig,
AutoImageProcessor,
CLIPConfig,
CLIPImageProcessor,
)
fr... | 103 |
"""simple docstring"""
from typing import Optional, Tuple, Union
import tensorflow as tf
from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
TFBas... | 96 | 0 |
"""simple docstring"""
from collections import OrderedDict
from typing import Any, Mapping, Optional, Union
from ...configuration_utils import PretrainedConfig
from ...feature_extraction_utils import FeatureExtractionMixin
from ...onnx import OnnxConfig
from ...onnx.utils import compute_ef... | 104 |
"""simple docstring"""
from typing import Union
import fire
import torch
from tqdm import tqdm
def a ( __UpperCAmelCase : str , __UpperCAmelCase : str = "cpu" , __UpperCAmelCase : Union[str, None] = None ) -> None:
__ma... | 96 | 0 |
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, PatchingSpec
from ... | 105 |
"""simple docstring"""
def a ( __UpperCAmelCase : List[Any] ) -> str:
__magic_name__: Optional[int] = [0] * len(__UpperCAmelCase )
__magic_name__: str = []
__magic_name__: Any = []
__magic_name__: Union[... | 96 | 0 |
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTokenizer
from .tokeni... | 106 |
"""simple docstring"""
from argparse import ArgumentParser
from .env import EnvironmentCommand
def a ( ) -> Tuple:
__magic_name__: Optional[int] = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" )
... | 96 | 0 |
'''simple docstring'''
from collections import defaultdict
from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst
def _SCREAMING_SNAKE_CASE ( ):
_A , _A = 9, 1_4 # noqa: F841
_A = [
[0, 1, 4],
[0, 7, 8],
[1, 2, 8],
[7, ... | 107 |
"""simple docstring"""
import json
import os
import shutil
import tempfile
import unittest
from multiprocessing import get_context
from pathlib import Path
import datasets
import numpy as np
from datasets import load_dataset
from parameterized import parameterized
from transforme... | 96 | 0 |
import glob
import os
import random
from string import ascii_lowercase, digits
import cva
import numpy as np
# Parrameters
__a: List[Any] = (720, 1280) # Height, Width
__a: str = (0.4, 0.6) # if height or width lower than this scale, drop it.
__a: Optional[Any] = ... | 108 |
"""simple docstring"""
def a ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int:
while b:
__magic_name__, __magic_name__: Optional[int] = b, a % b
return a
def a ( __UpperCAmelCase : ... | 96 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_speech_available,
is_tf_available,
is_torch_available,
)
a = {
"configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINE... | 109 |
"""simple docstring"""
import argparse
import gc
import json
import os
import shutil
import warnings
import torch
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
try:
from transformers import LlamaTokenizerFast
except ImportError as e:
war... | 96 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
UpperCamelCase__ = {
'configuration_mask2former': [
'MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
'Mask2FormerConfig',
... | 110 |
"""simple docstring"""
from typing import List
from .keymap import KEYMAP, get_character
def a ( __UpperCAmelCase : str ) -> Optional[int]:
def decorator(__UpperCAmelCase : List[str] ):
__magic_name__: Union[str, Any] = ... | 96 | 0 |
"""simple docstring"""
import unittest
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline
from transformers.convert_graph_to_onnx import (
convert,
ensure_valid_input,
generate_identif... | 450 |
"""simple docstring"""
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin... | 96 | 0 |
'''simple docstring'''
from __future__ import annotations
a__ : str = 1_0
def _lowercase ( __A ):
'''simple docstring'''
__UpperCamelCase = 1
__UpperCamelCase = max(__UpperCAmelCase )
while placement <= max_digit:
# ... | 601 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
__lowerCamelCase ... | 96 | 0 |
import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class __lowerCamelCase ( SCREAMING_SNAKE_CAS... | 61 |
"""simple docstring"""
def a ( __UpperCAmelCase : list[int] ) -> float:
if not nums: # Makes sure that the list is not empty
raise ValueError("""List is empty""" )
__magic_name__: Dict = sum(__UpperCAmelCase ) / len(__UpperC... | 96 | 0 |
def _lowerCAmelCase ( ):
'''simple docstring'''
return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )]
__magic_name__ = generate_large_matrix()
__magic_name__ = (
[[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3... | 254 |
"""simple docstring"""
from random import randint
from tempfile import TemporaryFile
import numpy as np
def a ( __UpperCAmelCase : Optional[Any] , __UpperCAmelCase : Optional[int] , __UpperCAmelCase : Optional[int] ) -> int:
... | 96 | 0 |
import cva
import numpy as np
class _A:
"""simple docstring"""
def __init__( self , _A , _A ):
if k in (0.0_4, 0.0_6):
__A : int = k
__A : List[str] = window_size
else:
raise ValueError(... | 239 |
"""simple docstring"""
def a ( __UpperCAmelCase : int = 1_0_0 ) -> int:
__magic_name__: str = 0
__magic_name__: Any = 0
for i in range(1 , n + 1 ):
sum_of_squares += i**2
sum_of_ints += i
... | 96 | 0 |
class __lowerCAmelCase :
def __init__( self :Optional[int] , __magic_name__ :int , __magic_name__ :Dict , __magic_name__ :Optional[int] ):
'''simple docstring'''
a = None
a = None
... | 468 |
"""simple docstring"""
from __future__ import annotations
def a ( __UpperCAmelCase : list ) -> list:
if len(__UpperCAmelCase ) == 0:
return []
__magic_name__, __magic_name__: List[str] = min(__UpperCAmelCase ), max(__U... | 96 | 0 |
import numpy as np
import qiskit
def __UpperCamelCase ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
"""simple docstring"""
A : List[Any] = np.random.default_rng(seed=__UpperCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
... | 662 |
"""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... | 96 | 0 |
import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def __lowerCamelCase ( __a :bytes , __a :int ) -> np.array:
"""simple docstring"""
A__ = F'{sampling_rate}'
A__ ... | 176 |
"""simple docstring"""
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
EulerAncestralDiscreteSchedu... | 96 | 0 |
from __future__ import annotations
import math
class UpperCAmelCase__ :
"""simple docstring"""
def __init__( self: Optional[Any] , __lowerCAmelCase: int ) -> None:
'''simple docstring'''
__UpperCAmelCase = size
# approximate the overa... | 221 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_squeezebert import SqueezeBertTokenizer
__lowerCamelCase ... | 96 | 0 |
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
class lowerCamel... | 639 |
"""simple docstring"""
import json
import os
import unittest
from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokeni... | 96 | 0 |
from collections.abc import Sequence
def a__ ( _UpperCamelCase : Sequence[float] ,_UpperCamelCase : float ):
return sum(c * (x**i) for i, c in enumerate(__UpperCAmelCase ) )
def a__ ( _UpperCamelCase : Sequence[float] ,_UpperCamelCase : float ... | 175 |
"""simple docstring"""
from collections import OrderedDict
from typing import List, Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
__lowerCamelCase = logging.get_logger(__... | 96 | 0 |
"""simple docstring"""
import flax.linen as nn
import jax.numpy as jnp
from .attention_flax import FlaxTransformeraDModel
from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD
class SCREAMING_SNAKE_CASE ( nn.Module ):
"""simple docstring"""
lowerc... | 450 |
"""simple docstring"""
import argparse
import json
import os
import re
import torch
from transformers import BloomConfig, BloomModel
from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME
from transformers.utils import logging
logging.set_verbosity_info()
__lowerCamelC... | 96 | 0 |
'''simple docstring'''
from typing import Dict, List, Optional, Union
import numpy as np
from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
a__ : List[str] ... | 601 |
"""simple docstring"""
import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def a ( __UpperCAmelCase : bytes , __UpperCAmelCase : int ) -> np.array:
__magic_name__: Optional[i... | 96 | 0 |
import argparse
import ast
import logging
import os
import sys
import pandas as pd
import torch
from tqdm import tqdm
from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration
from transformers import logging as transformers_logging
... | 61 |
"""simple docstring"""
from typing import List, Union
import numpy as np
from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, logging
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline
__lowerCamelCase = logging.get_lo... | 96 | 0 |
from __future__ import annotations
from collections import deque
class lowercase :
'''simple docstring'''
def __init__( self , _snake_case ) -> Optional[Any]:
"""simple docstring"""
UpperCAmelCase = []
... | 254 |
"""simple docstring"""
from typing import Optional, Tuple, Union
import tensorflow as tf
from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
TFBas... | 96 | 0 |
import gc
import unittest
import numpy as np
import torch
from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel
from diffusers.utils import slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps
from ..pipeline_params import UNCONDI... | 239 |
"""simple docstring"""
from typing import Union
import fire
import torch
from tqdm import tqdm
def a ( __UpperCAmelCase : str , __UpperCAmelCase : str = "cpu" , __UpperCAmelCase : Union[str, None] = None ) -> None:
__ma... | 96 | 0 |
import argparse
import json
from collections import OrderedDict
from functools import partial
from pathlib import Path
import timm
import torch
from huggingface_hub import hf_hub_download
from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor
from transf... | 468 |
"""simple docstring"""
def a ( __UpperCAmelCase : List[Any] ) -> str:
__magic_name__: Optional[int] = [0] * len(__UpperCAmelCase )
__magic_name__: str = []
__magic_name__: Any = []
__magic_name__: Union[... | 96 | 0 |
from collections import OrderedDict
from typing import List, Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
SCREAMING_SNAKE_CASE_:Any = logging.get_logger(__name__)
SCREAMING_SNAKE_CASE_:int = {
"... | 662 |
"""simple docstring"""
from argparse import ArgumentParser
from .env import EnvironmentCommand
def a ( ) -> Tuple:
__magic_name__: Optional[int] = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" )
... | 96 | 0 |
from timeit import timeit
A : str = {
'''MALAYALAM''': True,
'''String''': False,
'''rotor''': True,
'''level''': True,
'''A''': True,
'''BB''': True,
'''ABC''': False,
'''amanaplanacanalpanama''': True, # "a man a plan a canal panama"
}
# Ensure our... | 176 |
"""simple docstring"""
import json
import os
import shutil
import tempfile
import unittest
from multiprocessing import get_context
from pathlib import Path
import datasets
import numpy as np
from datasets import load_dataset
from parameterized import parameterized
from transforme... | 96 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
a_ = logging.get_logger(__name__)
a_ = {
"""google/vivit-b-16x2-kinetics400""": (
"""https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json"""
),
# See all Vivit models at... | 221 |
"""simple docstring"""
def a ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int:
while b:
__magic_name__, __magic_name__: Optional[int] = b, a % b
return a
def a ( __UpperCAmelCase : ... | 96 | 0 |
import itertools
import json
import os
import unittest
from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast
from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, slow
from ...test_tokenization_common import T... | 639 |
"""simple docstring"""
import argparse
import gc
import json
import os
import shutil
import warnings
import torch
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
try:
from transformers import LlamaTokenizerFast
except ImportError as e:
war... | 96 | 0 |
import os
import sys
import unittest
a_ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, """utils"""))
import get_test_info # noqa: E402
from get_test_info import ( # noqa: E402
get_model_to_test_mapping,
get_model_t... | 175 |
"""simple docstring"""
from typing import List
from .keymap import KEYMAP, get_character
def a ( __UpperCAmelCase : str ) -> Optional[int]:
def decorator(__UpperCAmelCase : List[str] ):
__magic_name__: Union[str, Any] = ... | 96 | 0 |
"""simple docstring"""
from typing import List, Optional, Union
import numpy as np
import PIL
import torch
from PIL import Image
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import D... | 450 |
"""simple docstring"""
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin... | 96 | 0 |
'''simple docstring'''
class UpperCAmelCase__ :
def __init__( self ) -> str:
__UpperCamelCase = """"""
__UpperCamelCase = """"""
__UpperCamelCase = []
def __lowerCamelCase ( self , lowercase , lowercase ) -> int:
if ... | 601 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
__lowerCamelCase ... | 96 | 0 |
import json
import os
import re
import shutil
import tempfile
import unittest
from typing import Tuple
from transformers import AddedToken, BatchEncoding, ByTaTokenizer
from transformers.utils import cached_property, is_tf_available, is_torch_available
from ...test_tokenization_common import Toke... | 61 |
"""simple docstring"""
def a ( __UpperCAmelCase : list[int] ) -> float:
if not nums: # Makes sure that the list is not empty
raise ValueError("""List is empty""" )
__magic_name__: Dict = sum(__UpperCAmelCase ) / len(__UpperC... | 96 | 0 |
from heapq import heappop, heappush
import numpy as np
def _lowerCAmelCase ( A__: np.ndarray , A__: tuple[int, int] , A__: tuple[int, int] , A__: bool , ):
'''simple docstring'''
UpperCAmelCase = grid.shape
UpperCAmelC... | 254 |
"""simple docstring"""
from random import randint
from tempfile import TemporaryFile
import numpy as np
def a ( __UpperCAmelCase : Optional[Any] , __UpperCAmelCase : Optional[int] , __UpperCAmelCase : Optional[int] ) -> int:
... | 96 | 0 |
def _SCREAMING_SNAKE_CASE ( a , a = " " ) -> list:
__A : List[Any] = []
__A : Optional[int] = 0
for index, char in enumerate(__UpperCAmelCase ):
if char == separator:
split_words.append(string[last_index:index] ... | 239 |
"""simple docstring"""
def a ( __UpperCAmelCase : int = 1_0_0 ) -> int:
__magic_name__: str = 0
__magic_name__: Any = 0
for i in range(1 , n + 1 ):
sum_of_squares += i**2
sum_of_ints += i
... | 96 | 0 |
from pathlib import Path
import cva
import numpy as np
from matplotlib import pyplot as plt
def __A ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ) -> np.ndarray:
a = cva.getAffine... | 468 |
"""simple docstring"""
from __future__ import annotations
def a ( __UpperCAmelCase : list ) -> list:
if len(__UpperCAmelCase ) == 0:
return []
__magic_name__, __magic_name__: List[str] = min(__UpperCAmelCase ), max(__U... | 96 | 0 |
from ..utils import DummyObject, requires_backends
class SCREAMING_SNAKE_CASE__ ( metaclass=SCREAMING_SNAKE_CASE_ ):
'''simple docstring'''
__lowerCamelCase : List[str] = ["transformers", "torch", "note_seq"]
def __init__( self, *lowerCamelCase__, *... | 662 |
"""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... | 96 | 0 |
import json
import os
import unittest
from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers
from ...test_tokenization_co... | 176 |
"""simple docstring"""
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
EulerAncestralDiscreteSchedu... | 96 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.