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 Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase : int = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, ...
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 = len(lowerCamelCase ) while cur > 1: # Find the maximum number in arr __lowerCAmelCase = arr.index(max(arr[0:cur] ) ) # Reve...
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 binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 lowerCAmelCase : Optional[int] = { # 1536-bit 5: { ...
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 warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils i...
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''' lowerCAmelCase : Any = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' def __lowerCAmelCase ( ): '''simple docstring''' __lowerCAmelCase = input("Enter message: " ) __lowerCAmelCase = input("Enter key [alphanumeric]: " ) __lowerCAmelCase ...
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 Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase : Optional[int] = logging.get_logger(__name__) lowerCAmelCase : List[Any] = { ''...
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''' from ... import PretrainedConfig lowerCAmelCase : int = { '''sijunhe/nezha-cn-base''': '''https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json''', } class UpperCAmelCase__ ( UpperCamelCase__ ): a : Union[str, Any] = NEZHA_...
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''' from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' def decorator(lowerCamelCase : List[Any] ): __lowerCAmelCase = getattr(lowerCamelCase ,...
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''' lowerCAmelCase : Optional[int] = range(2, 2_0 + 1) lowerCAmelCase : List[str] = [1_0**k for k in range(ks[-1] + 1)] lowerCAmelCase : dict[int, dict[int, list[list[int]]]] = {} def __lowerCAmelCase ( lowerCamelCase : Tuple , lowerCamelCase : ...
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 collections import os import re from pathlib import Path lowerCAmelCase : int = '''src/transformers''' # Matches is_xxx_available() lowerCAmelCase : int = re.compile(r'''is\_([a-z_]*)_available()''') # Catches a one-line _import_struct = {xxx} lowerCAmelCase : int ...
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''' 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
'''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, ) lowerCAmelCase : Optional[Any] = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''],...
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''' from timeit import timeit lowerCAmelCase : Dict = { '''MALAYALAM''': True, '''String''': False, '''rotor''': True, '''level''': True, '''A''': True, '''BB''': True, '''ABC''': False, '''amanaplanacanalpanama''': True, # "a man a plan a canal panama" ...
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 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
'''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 math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowerCAmelCase : Dict = logging.get_logger(__name__) class UpperCAmelCase__ ( UpperCamelCase...
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 os def __lowerCAmelCase ( lowerCamelCase : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(lowerCamelCase ) , lowerCamelCase ) ) as input_file: __lowerCAmelCase = [ [int(lowe...
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''' from __future__ import annotations from collections.abc import MutableSequence class UpperCAmelCase__ : def __init__( self , UpperCamelCase , UpperCamelCase ) -> None: if len(UpperCamelCase ) != degree + 1: raise ValueError( ...
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''' def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int ): '''simple docstring''' while a != 0: __lowerCAmelCase , __lowerCAmelCase = b % a, a return b def __lowerCAmelCase ( lowerCamelCase ...
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 math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int , lowerCamelCase : float = 1 / sqrt(2 ) ): '''simple docstring''' __lowerC...
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 argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) lowerC...
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 argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from...
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 argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration lowerCAmelCase : Optional[Any] = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', ''...
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 ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : str = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''abeja/gpt-neox-japanese-2.7b''': '''https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main...
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 time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder lowerCAmelCase : Tuple = '''__DUMMY_TRANSFORMERS_USER__''' lowerCAmelCase : Optional[int] = '''Dummy User''' lowerCAmel...
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 collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase : Any = logging.get_logger(__name__) lowerCAmelCase : Opti...
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''' def __lowerCAmelCase ( lowerCamelCase : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(lowerCamelCase , (list, tuple) ) or not all( isinstance(lowerCamelCase , lowerCamelCase ) for number in numbers...
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''' # 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 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 importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils imp...
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''' from __future__ import annotations lowerCAmelCase : List[Any] = list[tuple[int, int]] lowerCAmelCase : str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1...
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 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
'''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 os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_...
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 cva import numpy as np class UpperCAmelCase__ : def __init__( self , UpperCamelCase , UpperCamelCase ) -> Optional[int]: if k in (0.04, 0.06): __lowerCAmelCase = k __lowerCAmelCase = window_size ...
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''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : List[Any] = { '''configuration_longformer''': [ '''LONGFORMER_PRETR...
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 lowerCAmelCase : Optional[int] = { '''configuration_clap''': [ '''CLAP_PRETRAINED_MODEL_ARCHIVE_LIST''', '''ClapAudioConfig''', '''Clap...
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 itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.dat...
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 import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowerCAmelCase : str = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow(''''''...
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 typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase : Dict = {'''configuration_vit_msn''': ['''VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMSNConfig''']} try: if not is_torch_available(): rais...
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 : str , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = [[] for _ in range(lowerCamelCase )] __lowerCAmelCase = key - 1 if key <= 0: raise ValueError("Heig...
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''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMix...
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 unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
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 random from typing import Any def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' for _ in range(len(lowerCamelCase ) ): __lowerCAmelCase = random.randint(0 , len(lowerCamelCase ) - 1 ) __lo...
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 tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin fr...
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 torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__ ( UpperCamelCase__ ): a : List[str] = (CMStochasticIterativeScheduler,) a : str = 1_...
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 transformers.configuration_utils import PretrainedConfig lowerCAmelCase : List[str] = logging.getLogger(__name__) class UpperCAmelCase__ ( UpperCamelCase__ ): a : int = """masked_bert""" def __init__( self , ...
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 ...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
'''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 from collections import deque class UpperCAmelCase__ : def __init__( self , UpperCamelCase ) -> Optional[int]: __lowerCAmelCase = [] self.adlist.append( {"value": "", "next_states": [...
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 def __lowerCAmelCase ( lowerCamelCase : list[float] ): '''simple docstring''' if len(lowerCamelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for ...
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 numpy as np from PIL import Image def __lowerCAmelCase ( lowerCamelCase : np.ndarray , lowerCamelCase : int , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = np.array(lowerCamelCase ) if a...
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''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
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 functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Dict = logging.get_logger(__name__) lowerCAmelCase : Dict = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/...
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 argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCAmelCase : Dict = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': ''...
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''' def __lowerCAmelCase ( lowerCamelCase : list ): '''simple docstring''' if any(not isinstance(lowerCamelCase , lowerCamelCase ) or x < 0 for x in sequence ): raise TypeError("Sequence must be list of non-negative integers" ) for _ in ran...
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 itertools import product def __lowerCAmelCase ( lowerCamelCase : int , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = sides_number __lowerCAmelCase = max_face_number * dice_number __lowerCAme...
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 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 .tokenization_roberta i...
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 os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Tuple = logging.get_logger(__name__...
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 os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : str = logging.get_logger(__name__) lowerCAmelCase : int = {'''voca...
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''' def __lowerCAmelCase ( lowerCamelCase : str ): '''simple docstring''' __lowerCAmelCase = [0 for i in range(len(lowerCamelCase ) )] # initialize interval's left pointer and right pointer __lowerCAmelCase , __lowerCAmelCas...
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 typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase__ ( UpperCamelCa...
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 copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTest...
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 itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast lowerCAmelCase : List[str] = datasets.utils.logging.get_logger(__name__) @dataclass c...
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''' # 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
'''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 inspect import unittest from math import floor from transformers import CvtConfig 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_conf...
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 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_single_gpu, ) from accelerate...
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 argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorc...
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 json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def __lowerCAmelCase ( lowerCamelCase : str = "isbn/0140328726" ): '''simple docstring''' __lowerCAmelCase = olid.strip().strip("/" ...
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 def __lowerCAmelCase ( lowerCamelCase : list[int] , lowerCamelCase : int ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = [] __lowerCAmelCase = 0 __l...
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 argparse import struct import unittest class UpperCAmelCase__ : def __init__( self , UpperCamelCase ) -> None: __lowerCAmelCase = data # Initialize hash values __lowerCAmelCase = [ 0x6_A_0_9_E_...
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 argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, ...
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 gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device lowerCAmelCase : Optional[Any] = False class UpperCA...
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 logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase ...
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 typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline lowerCAmelCase : str = logging.get_logger(__name__) # pylint: disable=invalid-name class UpperCA...
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 os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from trans...
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 math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def __lowerCAmelCase ( lowerCamelCase : int = 3 ): '''simple docstring''' if isinstance(lowerCamelCase , lowerCamelCas...
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''' 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
'''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 unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import to...
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 sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoImageProcessor, ViTImageProcessor from transformers.testing_utils impo...
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''' from queue import PriorityQueue from typing import Any import numpy as np def __lowerCAmelCase ( lowerCamelCase : dict , lowerCamelCase : str , lowerCamelCase : set , lowerCamelCase : set , lowerCamelCase : dict , lower...
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 argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.u...
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''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class UpperCAmelCase__ ( UpperCamelCase__ ): def UpperCAmelCase_ ( self ) -> Optional[int]: return [ {"col_1": 3, "col_2": ...
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 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
'''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''' # 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: F401 from ..controln...
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 gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.model...
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 : list[int] ): '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("List is empty" ) __lowerCAmelCase = sum(lowerCamelCase ) / len(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''' 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
'''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 unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_at...
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 lowerCAmelCase : List[str] = logging.get_logger(__name__) lowerCAmelCase : Any = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', ...
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 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
'''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''' def __lowerCAmelCase ( lowerCamelCase : str = "The quick brown fox jumps over the lazy dog" , ): '''simple docstring''' __lowerCAmelCase = set() # Replace all the whitespace in our sentence __lowerCAmelCase = input_str.replace("...
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 __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
'''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 pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase ( lowerCamelCase : Optiona...
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 os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table i...
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 pathlib import Path import numpy as np from PIL import Image def __lowerCAmelCase ( lowerCamelCase : np.ndarray ): '''simple docstring''' __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase = rgb[:, :, 0], r...
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 __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, ...
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 warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipe...
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''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : list[int] ): '''simple docstring''' __lowerCAmelCase = len(lowerCamelCase ) // 2 # choose the middle 3 elements __lowerCAmelCase = lst[m - 1 : m +...
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 json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig, ...
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 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
'''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 typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import...
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''' from __future__ import annotations def __lowerCAmelCase ( lowerCamelCase : Any , lowerCamelCase : List[str] , lowerCamelCase : Tuple , lowerCamelCase : Union[str, Any] ): # noqa: E741 '''simple docstring''' while r - l...
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 importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __lowerCAmelCase ( ): '''simple docstring''' __lowerCAmelCase = ArgumentParser( descr...
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