code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase : Union[str, Any] = { '''configuration_squeezebert''': [ '''SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
39
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kan...
39
1
'''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.org/licenses/LICENSE-2...
39
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
39
1
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCAmelCase ( lowerCamelCase : Callable , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float ): '''s...
39
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_ta...
39
1
'''simple docstring''' import unittest from transformers import DonutProcessor lowerCAmelCase : int = '''naver-clova-ix/donut-base''' class UpperCAmelCase__ ( unittest.TestCase ): def UpperCAmelCase_ ( self ) -> Any: __lowerCAmelCase = DonutProce...
39
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IM...
39
1
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __lowerCAmelCase ( lowerCamelCase : bytes , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = f''...
39
'''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 : Optional[Any] = logging....
39
1
'''simple docstring''' from __future__ import annotations import requests def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = f'''https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty''' return requests.get...
39
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(lowerCamelCase ) / len(lowerCamelCase ) if __name__ == "__main__": im...
39
1
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase : str = { '''huggingface/informer-tourism-monthly''': ( '''http...
39
'''simple docstring''' import re def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = 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(lowerCamelCase , lowerC...
39
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCAmelCase : Dict = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { ''...
39
'''simple docstring''' import os import sys import unittest lowerCAmelCase : str = 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_m...
39
1
'''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_CHECKING: from transformer...
39
'''simple docstring''' from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @data...
39
1
'''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 from .tokenization_gpta import GPTaTo...
39
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __lowerCAmelCase ( lowerCamelCase : bytes , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = f''...
39
1
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property fro...
39
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def __lowerCAmelCase ( lowerCamelCase : List[str] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_co...
39
1
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = int(lowerCamelCase ) if n_element < 1: __lowerCAmelCase = ValueError("a should be a positive number" ) raise my_error __lowerCA...
39
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : Union[str, Any] ): '''simple docstring''' __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity += 1 ...
39
1
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def __lowerCAmelCase ( lowerCamelCase : Any , lowerCamelCase : Dict , l...
39
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/d...
39
1
'''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 : Tuple = '''sshleifer...
39
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Union[str, Any] = { '''configuration_distilbert''': ...
39
1
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase : Optional[int] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies #...
39
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lo...
39
1
'''simple docstring''' import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel lowerCAmelCase : List[str] ...
39
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) lowerCAmelCase : Optional[Any] = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CO...
39
1
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E4...
39
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__ ( UpperCamelCase__ ): a : List[str] = (CMStochasticIterativeScheduler,) a : str = 1_...
39
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor lowerCAmelCase : List[Any] = logging.get_logger(__name__) class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self , *UpperCamelCase , **Upp...
39
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCAmelCase ( lowerCamelCase : str = "https://www.worldometers.info/coronavirus" ): '''simple docstring''' __lowerCAmelCase = BeautifulSoup(requests.get(lowerCamelCase ).text , ...
39
1
'''simple docstring''' from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __lowerCAmelCase ( ): '''simple docstring''' __lowerCAmelCase = { "repo_name": ["test_repo1", "test_rep...
39
'''simple docstring''' from __future__ import annotations import math def __lowerCAmelCase ( lowerCamelCase : list , lowerCamelCase : list ): '''simple docstring''' if len(lowerCamelCase ) != 2 or len(a[0] ) != 2 or len(lowerCamelCase ) != 2 or len(b[...
39
1
'''simple docstring''' import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_mod...
39
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput lowerCAmelCase : Optional[Any] = '''scheduler_config.json''' class UpperCAmelCase__ ( UpperCame...
39
1
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = os.path.join(args.tf...
39
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock fro...
39
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase : Dict = { '''configuration_mobilenet_v2''': [ '''MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MobileN...
39
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self ) -> List[str]: # test for the above condition self.test() def UpperCAmelCase_ ( self ) ...
39
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import f...
39
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kan...
39
1
'''simple docstring''' import re def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = 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(lowerCamelCase , lowerC...
39
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
39
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, ) logging.se...
39
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_ta...
39
1
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_p...
39
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IM...
39
1
'''simple docstring''' import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__ ( UpperCamelCase__ , unittest.TestCase ): a ...
39
'''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 : Optional[Any] = logging....
39
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig lowerCAmelCase : Any = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''Intel/dpt-large''': '''https://huggingface.co/Intel/dpt-lar...
39
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(lowerCamelCase ) / len(lowerCamelCase ) if __name__ == "__main__": im...
39
1
'''simple docstring''' from __future__ import annotations import csv import requests from bsa import BeautifulSoup def __lowerCAmelCase ( lowerCamelCase : str = "" ): '''simple docstring''' __lowerCAmelCase = url or "https://www.imdb.com/chart/top/?ref_=nv_mv_2...
39
'''simple docstring''' import re def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = 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(lowerCamelCase , lowerC...
39
1
'''simple docstring''' from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowerCAmelCase ( lowerCamelCase : str = "laptop" ): '''simple docstring''' __lowerCAmelCase = f'''https://www.amazon.in/lapt...
39
'''simple docstring''' import os import sys import unittest lowerCAmelCase : str = 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_m...
39
1
'''simple docstring''' import cmath import math def __lowerCAmelCase ( lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float ): '''simple docstring''' __lowerCAmelCase = math.radians(low...
39
'''simple docstring''' from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @data...
39
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
39
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __lowerCAmelCase ( lowerCamelCase : bytes , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = f''...
39
1
'''simple docstring''' from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def __lowerCAmelCase ( l...
39
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def __lowerCAmelCase ( lowerCamelCase : List[str] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_co...
39
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_...
39
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : Union[str, Any] ): '''simple docstring''' __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity += 1 ...
39
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @r...
39
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/d...
39
1
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self ) -> List[str]: # test for the above condition self.test() def UpperCAmelCase_ ( self ) ...
39
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Union[str, Any] = { '''configuration_distilbert''': ...
39
1
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
39
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lo...
39
1
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenize...
39
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) lowerCAmelCase : Optional[Any] = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CO...
39
1
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : int ): '''simple docstring''' if length <= 0 or not isinstance(lowerCamelCase , lowerCamelCase ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(lowerCa...
39
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__ ( UpperCamelCase__ ): a : List[str] = (CMStochasticIterativeScheduler,) a : str = 1_...
39
1
'''simple docstring''' import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, ...
39
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCAmelCase ( lowerCamelCase : str = "https://www.worldometers.info/coronavirus" ): '''simple docstring''' __lowerCAmelCase = BeautifulSoup(requests.get(lowerCamelCase ).text , ...
39
1
'''simple docstring''' import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP lowerCAmelCase : str = False try: lowerCAm...
39
'''simple docstring''' from __future__ import annotations import math def __lowerCAmelCase ( lowerCamelCase : list , lowerCamelCase : list ): '''simple docstring''' if len(lowerCamelCase ) != 2 or len(a[0] ) != 2 or len(lowerCamelCase ) != 2 or len(b[...
39
1
'''simple docstring''' from math import factorial lowerCAmelCase : dict[str, int] = {str(digit): factorial(digit) for digit in range(1_0)} def __lowerCAmelCase ( lowerCamelCase : int ): '''simple docstring''' if not isinstance(lowerCamelCase , lowerCamelCase )...
39
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput lowerCAmelCase : Optional[Any] = '''scheduler_config.json''' class UpperCAmelCase__ ( UpperCame...
39
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
39
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock fro...
39
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase : Optional[int] = logging.get_logger(__name__) lowerCAmelCase : Union[str, Any] = { '''ut/deta''': '''https://huggingface.co/ut/...
39
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self ) -> List[str]: # test for the above condition self.test() def UpperCAmelCase_ ( self ) ...
39
1
'''simple docstring''' # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tes...
39
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kan...
39
1
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list[int] , lowerCamelCase : int ): '''simple docstring''' if len(lowerCamelCase ) < k or k < 0: raise ValueError("Invalid Input" ) __lowerCAmelCase ...
39
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
39
1
'''simple docstring''' from math import factorial def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int ): '''simple docstring''' if n < k or k < 0: raise ValueError("Please enter positive integers for n and k where n >= k" ) return factorial(l...
39
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_ta...
39
1
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : List[str] , lowerCamelCase : Union[str, Any] ): '''simple docstring''' __lowerCAmelCase = [0 for i in range(r + 1 )] # nc0 = 1 __lowerCAmelCase = 1 for i in range(1 , n ...
39
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IM...
39
1
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int ): '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) __lowerCAmelCase = str(bin(lowerCamelCase ) ...
39
'''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 : Optional[Any] = logging....
39
1
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class UpperCAmelCase__ ( ctypes.Structure ): # _fields is a specific attr expected by ctypes a : Tuple = [(""...
39
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(lowerCamelCase ) / len(lowerCamelCase ) if __name__ == "__main__": im...
39
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IM...
39
'''simple docstring''' import re def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = 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(lowerCamelCase , lowerC...
39
1
'''simple docstring''' import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_c...
39
'''simple docstring''' import os import sys import unittest lowerCAmelCase : str = 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_m...
39
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Union[str, Any] = { '''configuration_distilbert''': ...
39
'''simple docstring''' from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @data...
39
1
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lo...
39
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __lowerCAmelCase ( lowerCamelCase : bytes , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = f''...
39
1
'''simple docstring''' import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class UpperCAmelCase__ ( UpperCamelCase__ , UpperCamelCase__ ): @register_to_config def __init__( self , *, ...
39
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def __lowerCAmelCase ( lowerCamelCase : List[str] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_co...
39
1
'''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_modeling_tf_common import TFMo...
39
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : Union[str, Any] ): '''simple docstring''' __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity += 1 ...
39
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[int] = logging.get_logger(__name__) lowerCAmelCase : Union[str, Any] = { '''microsoft/biogpt''': '''https://huggingface.co/microsoft/biogpt/resolve/main/config.json...
39
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/d...
39
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
39
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Union[str, Any] = { '''configuration_distilbert''': ...
39
1
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common imp...
39
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lo...
39
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import lo...
39
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) lowerCAmelCase : Optional[Any] = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CO...
39
1
'''simple docstring''' import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPri...
39
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__ ( UpperCamelCase__ ): a : List[str] = (CMStochasticIterativeScheduler,) a : str = 1_...
39
1
'''simple docstring''' import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def __lowerCAmelCase ( lowerCamelCase : Optional[Any] ...
39
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCAmelCase ( lowerCamelCase : str = "https://www.worldometers.info/coronavirus" ): '''simple docstring''' __lowerCAmelCase = BeautifulSoup(requests.get(lowerCamelCase ).text , ...
39
1
'''simple docstring''' import warnings from functools import wraps from typing import Callable def __lowerCAmelCase ( lowerCamelCase : Callable ): '''simple docstring''' @wraps(lowerCamelCase ) def _inner_fn(*lowerCamelCase : Any , **lowerCamelCase : D...
39
'''simple docstring''' from __future__ import annotations import math def __lowerCAmelCase ( lowerCamelCase : list , lowerCamelCase : list ): '''simple docstring''' if len(lowerCamelCase ) != 2 or len(a[0] ) != 2 or len(lowerCamelCase ) != 2 or len(b[...
39
1
'''simple docstring''' from math import factorial def __lowerCAmelCase ( lowerCamelCase : int = 20 ): '''simple docstring''' __lowerCAmelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... __lowerCAmelCase ...
39
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput lowerCAmelCase : Optional[Any] = '''scheduler_config.json''' class UpperCAmelCase__ ( UpperCame...
39
1
'''simple docstring''' import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow fr...
39
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock fro...
39
1
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int ): '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError("both inputs must be positive integers" ) __lowerCAmelCase = str(bin(lowerCamel...
39
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self ) -> List[str]: # test for the above condition self.test() def UpperCAmelCase_ ( self ) ...
39
1
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modelin...
39
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kan...
39
1
'''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 : Optional[Any] = logging....
39
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
39
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffus...
39
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_ta...
39
1
'''simple docstring''' import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import ...
39
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IM...
39
1
'''simple docstring''' import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available...
39
'''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 : Optional[Any] = logging....
39
1
'''simple docstring''' import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torc...
39
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(lowerCamelCase ) / len(lowerCamelCase ) if __name__ == "__main__": im...
39
1
'''simple docstring''' import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer lowerCAmelCase : List[Any] = logging.getLogger(__name__) def __lowerCAmelCase ( ): '''simple docstring''' __lowerCAmelCase ...
39
'''simple docstring''' import re def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = 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(lowerCamelCase , lowerC...
39
1
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : bool = False ): '''simple docstring''' 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 re...
39
'''simple docstring''' import os import sys import unittest lowerCAmelCase : str = 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_m...
39
1
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow...
39
'''simple docstring''' from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @data...
39
1
'''simple docstring''' import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments lowerCAmelCase : List[Any] = logging.getLogger(__name__) @dataclass class UpperCAmelCase__ ( Upp...
39
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __lowerCAmelCase ( lowerCamelCase : bytes , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = f''...
39
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowerCAmelCase : Any = logging.get_logger(__name__) class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self , *UpperCamelCase , ...
39
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def __lowerCAmelCase ( lowerCamelCase : List[str] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_co...
39
1
'''simple docstring''' import re from filelock import FileLock try: import nltk lowerCAmelCase : Dict = True except (ImportError, ModuleNotFoundError): lowerCAmelCase : Tuple = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) def __lo...
39
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : Union[str, Any] ): '''simple docstring''' __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity += 1 ...
39
1
'''simple docstring''' from __future__ import annotations import math from collections.abc import Callable def __lowerCAmelCase ( lowerCamelCase : Callable[[int | float], int | float] , lowerCamelCase : int | float , lowerCamelCase : int | float , lowerCamelCase ...
39
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/d...
39
1
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultist...
700
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Union[str, Any] = { '''configuration_distilbert''': ...
39
0
def __lowerCAmelCase ( lowerCamelCase : Optional[int] ): '''simple docstring''' if not isinstance(__A , __A ): raise TypeError("only integers accepted as input" ) else: __lowerCAmelCase = str(abs(__A ) ) __lowerCAmelCase = [list(_...
701
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lo...
39
0
'''simple docstring''' from maths.prime_factors import prime_factors def __lowerCAmelCase ( lowerCamelCase : Optional[Any] ): '''simple docstring''' if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): __lowerCAmelCase = f'''Input value of...
702
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) lowerCAmelCase : Optional[Any] = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CO...
39
0
'''simple docstring''' from numpy import exp, pi, sqrt def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int = 0.0 , lowerCamelCase : List[str] = 1.0 ): '''simple docstring''' return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) /...
703
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__ ( UpperCamelCase__ ): a : List[str] = (CMStochasticIterativeScheduler,) a : str = 1_...
39
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : int = { '''configuration_electra''': ['''ELECTRA_PRE...
704
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCAmelCase ( lowerCamelCase : str = "https://www.worldometers.info/coronavirus" ): '''simple docstring''' __lowerCAmelCase = BeautifulSoup(requests.get(lowerCamelCase ).text , ...
39
0
'''simple docstring''' import argparse import json import subprocess def __lowerCAmelCase ( lowerCamelCase : Dict , lowerCamelCase : Tuple ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = ( f'''curl -H \"Accept: app...
705
'''simple docstring''' from __future__ import annotations import math def __lowerCAmelCase ( lowerCamelCase : list , lowerCamelCase : list ): '''simple docstring''' if len(lowerCamelCase ) != 2 or len(a[0] ) != 2 or len(lowerCamelCase ) != 2 or len(b[...
39
0
'''simple docstring''' import argparse import struct import unittest class UpperCAmelCase__ : def __init__( self , UpperCamelCase ) -> Any: __lowerCAmelCase = data # Initialize hash values __lowerCAmelCase = [ 0x6_A_0_9_E_6...
706
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput lowerCAmelCase : Optional[Any] = '''scheduler_config.json''' class UpperCAmelCase__ ( UpperCame...
39
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedKV...
707
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock fro...
39
0
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : Optional[Any] ): '''simple docstring''' __lowerCAmelCase = [0] * len(__A ) __lowerCAmelCase = [] __lowerCAmelCase = [1] * len(__A ) for values in graph.values(): for...
708
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase__ ( UpperCamelCase__ ): def __init__( self ) -> List[str]: # test for the above condition self.test() def UpperCAmelCase_ ( self ) ...
39
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
709
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kan...
39
0
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py lowerCAmelCase : int = "\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = ...
710
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
39
0
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def __lowerCAmelCase ( lowerCamelCase : Union[str, Any] , lowerCamelCase : bool = True , lowerCamelCase : float = math.inf , lowerCamelCase : fl...
711
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_ta...
39
0
'''simple docstring''' import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditio...
712
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IM...
39
0
'''simple docstring''' lowerCAmelCase : List[str] = { '''km/h''': 1.0, '''m/s''': 3.6, '''mph''': 1.609344, '''knot''': 1.852, } lowerCAmelCase : Optional[Any] = { '''km/h''': 1.0, '''m/s''': 0.277777778, '''mph''': 0.621371192, '''knot''': 0.539956803, } def __l...
713
'''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 : Optional[Any] = logging....
39
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 import AcceleratorState f...
714
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(lowerCamelCase ) / len(lowerCamelCase ) if __name__ == "__main__": im...
39
0
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils i...
715
'''simple docstring''' import re def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = 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(lowerCamelCase , lowerC...
39
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from s...
716
'''simple docstring''' import os import sys import unittest lowerCAmelCase : str = 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_m...
39
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Any = logging.get_logger(__name__) lowerCAmelCase : List[Any] = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', ...
717
'''simple docstring''' from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @data...
39
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase__ ( metaclass=_UpperCAmelCase ): a : Union[str, Any] = ["""flax"""] def __init__( self , *UpperCamelCase , **UpperCamelCase ) -> Optional[int]: ...
718
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __lowerCAmelCase ( lowerCamelCase : bytes , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = f''...
39
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channe...
719
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def __lowerCAmelCase ( lowerCamelCase : List[str] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_co...
39
0
'''simple docstring''' from __future__ import annotations import math def __lowerCAmelCase ( lowerCamelCase : List[str] , lowerCamelCase : Dict ): '''simple docstring''' __lowerCAmelCase = u for i in range(1 , lowerCamelCase ): __lowerCAmel...
720
'''simple docstring''' def __lowerCAmelCase ( lowerCamelCase : Union[str, Any] ): '''simple docstring''' __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity += 1 ...
39
0