code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" def _snake_case ( lowercase__ , lowercase__ = False ): if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False if n ...
350
"""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 lowercase__ = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path))...
12
0
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedu...
351
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageI...
12
0
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowerCAmelCase__ ( _UpperCAmelCase, unittest.TestCase ): ''...
352
"""simple docstring""" import os import string import sys lowercase__ = 1 << 8 lowercase__ = { """tab""": ord("""\t"""), """newline""": ord("""\r"""), """esc""": 27, """up""": 65 + ARROW_KEY_FLAG, """down""": 66 + ARROW_KEY_FLAG, ...
12
0
"""simple docstring""" import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import T...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
"""simple docstring""" lowercase__ = { """joule""": 1.0, """kilojoule""": 1000, """megajoule""": 100_0000, """gigajoule""": 10_0000_0000, """wattsecond""": 1.0, """watthour""": 3600, """kilowatthour""": 360_0000, """newtonmeter""": 1.0, ...
354
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
0
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_C...
355
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "...
12
0
"""simple docstring""" 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 T...
356
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( lowercase ): '''simple docstring''' lowerCamelCase__ = (UnCLIPScheduler,) def ...
12
0
"""simple docstring""" def _snake_case ( lowercase__ , lowercase__ ): assert x is not None assert y is not None _lowerCamelCase : Optional[int] = len(__A ) _lowerCamelCase : List[str] = len(__A ) # declaring the array for st...
357
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2...
12
0
"""simple docstring""" import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCAmelCase__ ...
358
"""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....
12
0
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_commo...
359
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( ...
12
0
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ , lowercase__ , lowercase__ , lowercase__ , lowercase__ , ): _validation( __lowerCamelCase , __lowerCamelCase , __low...
360
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """M...
12
0
"""simple docstring""" import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state...
361
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...
12
0
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowercase__ = logging.getLogger() ...
362
"""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....
12
0
"""simple docstring""" # Copyright 2021 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....
363
"""simple docstring""" from __future__ import annotations def _snake_case ( lowercase__ , lowercase__ , lowercase__ ): _lowerCamelCase : Tuple = list(range(len(lowercase__ ) ) ) _lowerCamelCase : Any = [v / w for ...
12
0
"""simple docstring""" class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase ): _lowerCamelCase : Any = n _lowerCamelCase : Any = [None] * self.n _lowerCamelCase : Tuple = 0...
364
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase__ = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, ...
12
0
"""simple docstring""" def _snake_case ( lowercase__ = 100 ): _lowerCamelCase : str = n * (n + 1) * (2 * n + 1) / 6 _lowerCamelCase : int = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": ...
365
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import A...
12
0
"""simple docstring""" def _snake_case ( lowercase__ ): return " ".join( ''.join(word[::-1] ) if len(a_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words("""Hey woll...
366
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowercase__ = False class lowe...
12
0
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _snake_case ( lowercase__ ): return 1 / (1 + np.exp(-z )) def _snake_case ( lowercase__ , lowercase__ ): r...
367
"""simple docstring""" import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": ...
12
0
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer...
368
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig lowercase__ = logging.get_logger(__name__) class lo...
12
0
"""simple docstring""" import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ....
369
"""simple docstring""" def _snake_case ( lowercase__ = 10 ): if not isinstance(lowercase__ , lowercase__ ) or n < 0: raise ValueError('Invalid input' ) _lowerCamelCase : str = 10**n _lowerCamelCase : Union[str, Any] = 28433...
12
0
"""simple docstring""" from ...processing_utils import ProcessorMixin class lowerCAmelCase__ ( _UpperCAmelCase ): '''simple docstring''' lowerCamelCase__ = """WhisperFeatureExtractor""" lowerCamelCase__ = """WhisperTokenizer""" def __init__( self , ...
370
"""simple docstring""" import argparse import datetime def _snake_case ( lowercase__ ): _lowerCamelCase : Dict = { '0': 'Sunday', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday', ...
12
0
import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def _snake_case ( lowercase__ , lowercase__=1 ): if n_shave_prefix_segments >= 0: return ".".join(path.split('.' )[n_shave_prefix_segments:...
371
"""simple docstring""" import re def _snake_case ( lowercase__ ): _lowerCamelCase : Optional[int] = re.compile(r'^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$' ) if match := re.search(lowercase__ , lowercase__ ): return match.string == ...
12
0
"""simple docstring""" import os from datetime import datetime as dt from github import Github lowercase__ = [ """good first issue""", """feature request""", """wip""", ] def _snake_case ( ): _lowerCamelCase : Optio...
350
"""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 lowercase__ = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path))...
12
0
"""simple docstring""" def _snake_case ( lowercase__ , lowercase__ = 0 ): _lowerCamelCase : Optional[int] = length or len(_snake_case ) _lowerCamelCase : List[str] = False for i in range(length - 1 ): if list_data[i] > list...
351
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageI...
12
0
import requests lowercase__ = """https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=""" def _snake_case ( lowercase__ ): _lowerCamelCase : Dict = requests.get(_NEWS_API + bbc_news_api_key ).json() # each article in the list ...
352
"""simple docstring""" import os import string import sys lowercase__ = 1 << 8 lowercase__ = { """tab""": ord("""\t"""), """newline""": ord("""\r"""), """esc""": 27, """up""": 65 + ARROW_KEY_FLAG, """down""": 66 + ARROW_KEY_FLAG, ...
12
0
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.ut...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME...
354
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase__ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Opt...
355
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "...
12
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase__ = { """configuration_vision_encoder_decoder""": [...
356
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( lowercase ): '''simple docstring''' lowerCamelCase__ = (UnCLIPScheduler,) def ...
12
0
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim ...
357
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2...
12
0
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) fro...
358
"""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....
12
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/config.json""", } class low...
359
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( ...
12
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json',...
360
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """M...
12
0
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowercase__ = """\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human an...
361
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...
12
0
"""simple docstring""" def _snake_case ( lowercase__ ): if collection == []: return [] # get some information about the collection _lowerCamelCase : Optional[int] = len(UpperCamelCase__ ) _lowerCamelCase : List[Any]...
362
"""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....
12
0
"""simple docstring""" 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_form...
363
"""simple docstring""" from __future__ import annotations def _snake_case ( lowercase__ , lowercase__ , lowercase__ ): _lowerCamelCase : Tuple = list(range(len(lowercase__ ) ) ) _lowerCamelCase : Any = [v / w for ...
12
0
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) # TODO Update this lowercase__ = { ...
364
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase__ = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, ...
12
0
"""simple docstring""" import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create...
365
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import A...
12
0
"""simple docstring""" class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase ): _lowerCamelCase : Union[str, Any] = val _lowerCamelCase : Union[str, Any] = None _lowerCamelCase : ...
366
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowercase__ = False class lowe...
12
0
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def _snake_case ( lowercase__="ro" , lowercase__="en" , lowercase__="wmt16" , lowercase__=None ): try: import datasets except (ModuleNotFou...
367
"""simple docstring""" import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": ...
12
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ = { "configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"], ...
368
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig lowercase__ = logging.get_logger(__name__) class lo...
12
0
"""simple docstring""" import os import numpy import onnx def _snake_case ( lowercase__ , lowercase__ ): _lowerCamelCase : Dict = a.name _lowerCamelCase : Optional[int] = b.name _lowerCamelCase : Union[st...
369
"""simple docstring""" def _snake_case ( lowercase__ = 10 ): if not isinstance(lowercase__ , lowercase__ ) or n < 0: raise ValueError('Invalid input' ) _lowerCamelCase : str = 10**n _lowerCamelCase : Union[str, Any] = 28433...
12
0
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable lowercase__ = { """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoX...
370
"""simple docstring""" import argparse import datetime def _snake_case ( lowercase__ ): _lowerCamelCase : Dict = { '0': 'Sunday', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday', ...
12
0
def _snake_case ( lowercase__ = 1000000 ): _lowerCamelCase : List[str] = 1 _lowerCamelCase : str = 1 _lowerCamelCase : Dict = {1: 1} for inputa in range(2 , __lowerCAmelCase ): _lowerCamelCase : Union[str, An...
371
"""simple docstring""" import re def _snake_case ( lowercase__ ): _lowerCamelCase : Optional[int] = re.compile(r'^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$' ) if match := re.search(lowercase__ , lowercase__ ): return match.string == ...
12
0
"""simple docstring""" 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...
350
"""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 lowercase__ = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path))...
12
0
"""simple docstring""" import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import Config...
351
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageI...
12
0
class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase ): _lowerCamelCase : str = size _lowerCamelCase : Any = [0] * size _lowerCamelCase : Tuple = [0] * size @staticmethod def A...
352
"""simple docstring""" import os import string import sys lowercase__ = 1 << 8 lowercase__ = { """tab""": ord("""\t"""), """newline""": ord("""\r"""), """esc""": 27, """up""": 65 + ARROW_KEY_FLAG, """down""": 66 + ARROW_KEY_FLAG, ...
12
0
"""simple docstring""" import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
"""simple docstring""" 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_m...
354
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
0
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F...
355
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "...
12
0
"""simple docstring""" import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transf...
356
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( lowercase ): '''simple docstring''' lowerCamelCase__ = (UnCLIPScheduler,) def ...
12
0
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-au...
357
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2...
12
0
"""simple docstring""" from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding...
358
"""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....
12
0
lowercase__ = """Tobias Carryer""" from time import time class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase , lowercase , lowercase , lowercase=int(time() ) ): # noqa: B008 _lowerCamelCase ...
359
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( ...
12
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowercase__ = {"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not ...
360
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """M...
12
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from...
361
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...
12
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase__ = { 'configuration_convnext': ['CONVNEXT_PRETRA...
362
"""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....
12
0
"""simple docstring""" import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixi...
363
"""simple docstring""" from __future__ import annotations def _snake_case ( lowercase__ , lowercase__ , lowercase__ ): _lowerCamelCase : Tuple = list(range(len(lowercase__ ) ) ) _lowerCamelCase : Any = [v / w for ...
12
0
"""simple docstring""" def _snake_case ( lowercase__ ): _lowerCamelCase : Optional[Any] = len(_a ) while cur > 1: # Find the maximum number in arr _lowerCamelCase : Tuple = arr.index(max(arr[0:cur] ) ) # Reverse from ...
364
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase__ = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, ...
12
0
"""simple docstring""" def _snake_case ( lowercase__ , lowercase__ , lowercase__ , lowercase__ ): global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: _lowerCamelCase : Optional[int] = mf_kn...
365
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import A...
12
0
"""simple docstring""" import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class lowerCAme...
366
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowercase__ = False class lowe...
12
0
"""simple docstring""" import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, ...
367
"""simple docstring""" import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": ...
12
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCAmelCase__ ( metaclass=lowercase ): '''simple docstring''' lowerCamelCase__ = ["""torch""", """scipy"""] def __init__( self , *lowercase , **low...
368
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig lowercase__ = logging.get_logger(__name__) class lo...
12
0
"""simple docstring""" from typing import Any import numpy as np def _snake_case ( lowercase__ ): return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def _snake_case ( lowercase__ , lowercase__ ): _...
369
"""simple docstring""" def _snake_case ( lowercase__ = 10 ): if not isinstance(lowercase__ , lowercase__ ) or n < 0: raise ValueError('Invalid input' ) _lowerCamelCase : str = 10**n _lowerCamelCase : Union[str, Any] = 28433...
12
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusion...
370
"""simple docstring""" import argparse import datetime def _snake_case ( lowercase__ ): _lowerCamelCase : Dict = { '0': 'Sunday', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday', ...
12
0
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( a_ ): '''simple docstring''' def __lt__( self , lowercase ): return se...
371
"""simple docstring""" import re def _snake_case ( lowercase__ ): _lowerCamelCase : Optional[int] = re.compile(r'^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$' ) if match := re.search(lowercase__ , lowercase__ ): return match.string == ...
12
0
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image ...
350
"""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 lowercase__ = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path))...
12
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowerCAmelCase__ ( lowercase ): ...
351
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageI...
12
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependency...
352
"""simple docstring""" import os import string import sys lowercase__ = 1 << 8 lowercase__ = { """tab""": ord("""\t"""), """newline""": ord("""\r"""), """esc""": 27, """up""": 65 + ARROW_KEY_FLAG, """down""": 66 + ARROW_KEY_FLAG, ...
12
0
"""simple docstring""" # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowercase__ = TypeVar("""T""") class lower...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
"""simple docstring""" import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transforme...
354
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
0
"""simple docstring""" import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokeni...
355
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "...
12
0
"""simple docstring""" import argparse import os import re lowercase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowercase__ = re.compile(R"""^(\s*)\S""") # Pattern that matches `"key":" and puts `key` in group 0. lowerc...
356
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( lowercase ): '''simple docstring''' lowerCamelCase__ = (UnCLIPScheduler,) def ...
12
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, g...
357
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2...
12
0
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import...
358
"""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....
12
0
import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.ja...
359
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( ...
12
0
"""simple docstring""" from random import randint, random def _snake_case ( lowercase__ , lowercase__ , lowercase__ , lowercase__ = False , lowercase__ = False , lowercase__ = 5 , ): _lowerCamelCase : Opt...
360
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """M...
12
0
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set...
361
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...
12
0
"""simple docstring""" from __future__ import annotations from math import pow, sqrt def _snake_case ( lowercase__ , lowercase__ , lowercase__ ): if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError('One ...
362
"""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....
12
0
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "...
363
"""simple docstring""" from __future__ import annotations def _snake_case ( lowercase__ , lowercase__ , lowercase__ ): _lowerCamelCase : Tuple = list(range(len(lowercase__ ) ) ) _lowerCamelCase : Any = [v / w for ...
12
0
"""simple docstring""" import sys lowercase__ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963...
364
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase__ = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, ...
12
0
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def _snak...
365
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import A...
12
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 lowercase__ = ...
366
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowercase__ = False class lowe...
12
0
"""simple docstring""" from collections import deque from .hash_table import HashTable class lowerCAmelCase__ ( _a ): '''simple docstring''' def __init__( self , *lowercase , **lowercase ): super().__init__(*lowercase , ...
367
"""simple docstring""" import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": ...
12
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq...
368
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig lowercase__ = logging.get_logger(__name__) class lo...
12
0
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mode...
369
"""simple docstring""" def _snake_case ( lowercase__ = 10 ): if not isinstance(lowercase__ , lowercase__ ) or n < 0: raise ValueError('Invalid input' ) _lowerCamelCase : str = 10**n _lowerCamelCase : Union[str, Any] = 28433...
12
0
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp ...
370
"""simple docstring""" import argparse import datetime def _snake_case ( lowercase__ ): _lowerCamelCase : Dict = { '0': 'Sunday', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday', ...
12
0
from typing import TYPE_CHECKING from ...utils import _LazyModule lowercase__ = {"""tokenization_bertweet""": ["""BertweetTokenizer"""]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys lowercase__ = _LazyModule...
371
"""simple docstring""" import re def _snake_case ( lowercase__ ): _lowerCamelCase : Optional[int] = re.compile(r'^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$' ) if match := re.search(lowercase__ , lowercase__ ): return match.string == ...
12
0
"""simple docstring""" def _snake_case ( lowercase__ ): return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
350
"""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 lowercase__ = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path))...
12
0
"""simple docstring""" from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowercase__ = TypeVar("""T""") def _snake_case ( lowercase__ ): return (position - 1) // 2 def _snake_c...
351
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageI...
12
0
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging lowercase__ = logging.get_...
352
"""simple docstring""" import os import string import sys lowercase__ = 1 << 8 lowercase__ = { """tab""": ord("""\t"""), """newline""": ord("""\r"""), """esc""": 27, """up""": 65 + ARROW_KEY_FLAG, """down""": 66 + ARROW_KEY_FLAG, ...
12
0
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from t...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowercase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( UpperCamelCase...
354
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
0
"""simple docstring""" import argparse import copy def _snake_case ( lowercase__ ): _lowerCamelCase : Union[str, Any] = {} with open(lowerCamelCase_ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: ...
355
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "...
12
0
"""simple docstring""" import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from .....
356
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( lowercase ): '''simple docstring''' lowerCamelCase__ = (UnCLIPScheduler,) def ...
12
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor...
357
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2...
12
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCAmelCase__ ( metaclass=SCREAMING_SNAKE_CASE__ ): '''simple docstring''' lowerCamelCase__ = ['''torch''', '''scipy'''] def __init__( self , *lo...
358
"""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....
12
0
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time lowercase__ = Lock() def _snake_case ( lowercase__ , lowercase__ , lowercase__ , lowercase__ , lowercase...
359
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( ...
12
0
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_...
360
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """M...
12
0
"""simple docstring""" def _snake_case ( lowercase__ , lowercase__ ): if not len(__snake_case ) == len(__snake_case ) == 3: raise ValueError('Please enter a valid equation.' ) if equationa[0] == equationa[1] == equationa[0] == equationa[1] == ...
361
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...
12
0