code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tok...
281
"""simple docstring""" import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE...
281
1
from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function a__ = 1.0_54_57_18_17E-34 # unit of ℏ : J * s a__ = 3E8 # unit of c : m * s^-1 def lowercase ( SCREAMING_SNAKE_CASE__ ...
198
def lowercase ( SCREAMING_SNAKE_CASE__ : int = 1_000 ) -> int: _snake_case , _snake_case : str = 1, 1 _snake_case : List[Any] = 2 while True: _snake_case : Union[str, Any] = 0 _snake_case : int = fa + fa _snake_case , ...
198
1
'''simple docstring''' import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def _UpperCamelCase (_lowerCamelCase : List[Any] ...
24
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : List[Any] = {} try: if not is_sentencepiece_available():...
349
0
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( '''The `image_to_image.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionImg2ImgPipeline` instead.''' )
527
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : Union[str, Any] = {'''vocab_file''': ''...
527
1
'''simple docstring''' from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __snake_case ( UpperCAmelCase_ : str = "laptop" ): lowerCamelCase_ = F'''https://www.amazon.in/laptop/s?k={product}''' lowerCamelCase_ ...
675
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class snake_case ( pl.LightningModule ): """simple docstring""" def __init...
675
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ = logging.get_logger(__name__) A_ = { "junnyu/roformer_chinese_small": "https://huggingface.co/junnyu/r...
704
import math import sys import cva import numpy as np def __UpperCAmelCase ( UpperCAmelCase, UpperCAmelCase )-> np.ndarray: """simple docstring""" lowercase = math.sqrt(UpperCAmelCase ) lowercase = 1 / (sigma * math.sqrt(2...
479
0
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetY...
138
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowercase__( )-> Optional[int]: """simple docstring""" raise RuntimeError("CUDA ou...
138
1
"""simple docstring""" import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex __A = logging.getLogger(__name__) class a : def __init__( self : ...
702
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def UpperCamelCase ( _lowerCAmelCase : str , _lowerCAmelCase : str , _lowerCAmelCase : Optional[str] = None ...
173
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """google/realm-cc-news-pretrained-embedder""": ( """https://huggingface.co/google/re...
104
'''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 __UpperCAmelCase ( A ...
541
0
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": __a : Optional[int] = argparse.ArgumentParser() parser.add_argument( """--checkpoint_path""", default=None, type=str, re...
559
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class A ( lowerCamelCase_ , low...
559
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants _UpperCamelCase : Optional[Any] = 300 # TEMPERATURE (unit = K) def snake_case ( snake_case : Tuple , snake_case : List[Any] , snake_case : Union[str, Any...
284
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( ...
559
0
from collections.abc import Callable class lowercase : def __init__( self : List[str] , _UpperCamelCase : Callable | None = None ) -> None: '''simple docstring''' SCREAMING_SNAKE_CASE = [] # Store...
647
from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy _lowerCamelCase : Optional[Any] = logging.get_logger(__na...
647
1
'''simple docstring''' import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.ut...
212
'''simple docstring''' def __snake_case ( _UpperCAmelCase : int, _UpperCAmelCase : str): UpperCamelCase = '''''' for i in table: res += inp[i - 1] return res def __snake_case ( _UpperCAmelCase : Dict): return data[1:] + data[0]...
212
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Dict =logging.get_logger(__name__) UpperCAmelCase__ : Opti...
718
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ : str ={'''configuration_fnet''': ['''FNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FNe...
269
0
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' UpperCAmelCase_ = 0 for ch in input_str: UpperCAmelCase_ = ord(_UpperCamelCase ) UpperCAmelCase_ = pow(2 , _UpperCamelCase ) ...
390
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def __lowerCamelCase ( _UpperCamelCase : Tuple , _UpperCamelCase : List[Any] , _UpperCamelCase : Dict , _UpperCamelCase : Tuple ): '''simple docstring''' UpperCAmelC...
390
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging _lowerCAmelCase : Dict ...
694
'''simple docstring''' from sklearn.metrics import fa_score import datasets _lowerCAmelCase : List[Any] = "\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n" _lowerCAmelCase : ...
694
1
"""simple docstring""" from collections import deque class _SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> List[str]: lowercase__ : int = process_name # process...
200
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 OptionalDependencyNo...
47
0
def A(__a: int = 6008_5147_5143 ): try: lowerCAmelCase_ = int(__a ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: raise ValueError("Parameter n must be greater than or equal to one." ) lowerCAmelCas...
226
from __future__ import annotations def A(__a: float , __a: float , __a: float ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance cannot be negative" ) if v...
226
1
"""simple docstring""" import string from math import logaa def A ( _A, _A ): """simple docstring""" snake_case_ :Union[str, Any] = document.translate( str.maketrans("", "", string.punctuation ) ).replace("\n", "" ) snake_case_ :Tuple ...
584
"""simple docstring""" def A ( _A ): """simple docstring""" return 10 - x * x def A ( _A, _A ): """simple docstring""" # Bolzano theory in order to find if there is a root between a and b if equation(_A ) * equation(_A ) >= 0: raise Val...
584
1
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common im...
720
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = ...
437
0
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import id...
38
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from t...
38
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/LICE...
706
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () snake_case__ = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf(), gbe...
638
0
'''simple docstring''' from numpy import exp, pi, sqrt def a__ ( _SCREAMING_SNAKE_CASE : Any , _SCREAMING_SNAKE_CASE : float = 0.0 , _SCREAMING_SNAKE_CASE : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) ...
71
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on imp...
133
0
'''simple docstring''' import os import sys _A: int = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSeque...
704
'''simple docstring''' # Copyright 2021 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...
617
0
import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the roo...
132
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { 'YituTech/conv-bert-base': 'https://huggingface.co/YituT...
132
1
def _a ( __SCREAMING_SNAKE_CASE : str , __SCREAMING_SNAKE_CASE : str ): """simple docstring""" _lowerCAmelCase = len(__SCREAMING_SNAKE_CASE ) _lowerCAmelCase = len(__SCREAMING_SNAKE_CASE ) _lowerCAmelCase = ( first_str_length if firs...
702
from __future__ import annotations _UpperCamelCase: Dict =8.9_88e9 # units = N * m^s * C^-2 def _a ( __SCREAMING_SNAKE_CASE : float , __SCREAMING_SNAKE_CASE : float , __SCREAMING_SNAKE_CASE : float , __SCREAMING_SNAKE_CASE : float ): """...
585
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availab...
86
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __a :List[Any] = { 'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'], 'tokenization_tapas': ['TapasTokenizer'], } try: ...
86
1
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib SCREAMING_SNAKE_CASE__ : int ...
629
import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def _A ( lowerCamelCase ): a__ : List[str] = [] if isinstance(...
629
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase__ = { '''configuration_vision_text_dual_encoder''': ['''VisionTextDualEncoderConfig'''], '''proce...
122
"""simple docstring""" from math import sqrt def lowercase__( __SCREAMING_SNAKE_CASE : int ): assert isinstance(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int and positive" lowercase_ : List[Any] = T...
425
0
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets __snake_case = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav Kadavath ...
711
'''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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, res...
280
0
def a_ ( lowerCAmelCase_ : str, lowerCAmelCase_ : str ): def get_matched_characters(lowerCAmelCase_ : str, lowerCAmelCase_ : str ) -> str: __lowerCAmelCase = [] __lowerCAmelCase = min(len(_stra ), len(_stra ...
53
"""simple docstring""" import random def lowerCamelCase__ ( _lowerCamelCase ): '''simple docstring''' _lowerCAmelCase : List[str] = num - 1 _lowerCAmelCase : List[Any] = 0 while s % 2 == 0: _lowerCAmelCase : Tuple = s // 2...
259
0
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def a ( __a="ro" , __a="en" , __a="wmt16" , __a=None ) -> None: '''simple docstring''' try: import datasets except (ModuleNotFoundError, ImportError): ...
280
'''simple docstring''' import qiskit def a ( __a , __a ) -> qiskit.result.counts.Counts: '''simple docstring''' UpperCamelCase__ :int = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register U...
280
1
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscr...
625
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class snake_case_ ( a ): '''simple docstring''' __UpperCamelCase = 'EncodecFeatureExtractor' __UpperCamelCase ...
625
1
def snake_case (UpperCamelCase : str , UpperCamelCase : str ): '''simple docstring''' def get_matched_characters(UpperCamelCase : str , UpperCamelCase : str ) -> str: lowerCamelCase__ = [] lowerCamelCase__ = min(len(_stra ) , ...
235
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as...
235
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : Any = logging.get_logger(__name__) UpperCamelCase : int = {} class A__ ( A__ ): """simple docstring""" _lowercase = 'llama' _lowercase = [...
37
'''simple docstring''' from ...configuration_utils import PretrainedConfig class UpperCamelCase__ ( __lowerCAmelCase ): lowerCAmelCase__ : Any = "bert-generation" def __init__( self : Union[str, Any] , lowerCamelCase : Optiona...
489
0
"""simple docstring""" import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECOR...
229
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE : Optional[int] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} ...
229
1
'''simple docstring''' import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor fr...
394
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_s...
517
0
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def snake_case__ ( UpperCAmelCase : int ): # A local function to see if a dot lands in the circle. def is_in_circle(UpperCAmelCase : float , Up...
111
from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils import AudioPipelineOut...
111
1
'''simple docstring''' def A ( UpperCamelCase_ : int ) -> str: '''simple docstring''' if number > 0: raise ValueError("input must be a negative integer" ) lowerCAmelCase__ = len(bin(UpperCamelCase_ )[3:] ) lowerCAmelCase__ = bin(abs(Up...
48
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def A ( UpperCamelCase_ : Tuple ) -> int: '''simple docstring''' for param in module.parameters(): lowerCAmelCase__ = False def A ( ) ->...
48
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase = { "configuration_xlm_roberta_xl": [ "XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMRobertaXLConfig", "XLMRo...
707
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('''repo_id''' , ['''canonical_dataset_name''', '''org-name/dataset-name'''] ) @pytest.mark.parametrize('''path''' , ['''filename.csv''', '''filename with blanks.csv'''...
694
0
import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging __snake_case :Optional[Any] =logging.get_logger(__name__) def ...
106
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case :List[str] =logging.get_logger(__name__) __snake_case :int ={'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class lowerCAmelCase__ ( _lowerCamelCase ...
106
1
'''simple docstring''' import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) lowerCAmelCase_ : int = ...
718
'''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...
521
0
'''simple docstring''' def lowerCAmelCase_ ( a : int ): assert ( isinstance(a , a ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if number_of_steps == 1: return 1 a__ ...
394
'''simple docstring''' def lowerCAmelCase_ ( a : int ): a__ = generate_pascal_triangle(a ) for row_idx in range(a ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=' ' ) ...
394
1
import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, OpenAIGPTDoubleHea...
704
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CO...
613
0
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class lowerCamelCase_ : '''simple docstring''' def __init__( self , __lowercase=2 , __lowercase=3 , __lowercase=64 , __lowerc...
167
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCamelCase ( ): '''simple docstring''' __UpperCamelCase :Optional[Any] = { '''repo_name''': ['''test_repo1''', '''test_repo2''', '...
167
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def lowercase_ ( __A : Union[str, Any] ) -> Union[str, Any]: """simple docstring""" lowercas...
701
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE = { 'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'], } try: if not ...
8
0
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impo...
583
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=__lowerCamelCase ) class UpperCAmelCase ( __lowerCamelCase ): a__: str = fi...
583
1
from typing import TYPE_CHECKING from ....utils import _LazyModule lowerCAmelCase = {"""tokenization_tapex""": ["""TapexTokenizer"""]} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys lowerCAmelCase = _LazyModule(__name__, globals()["""__file...
675
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_modeling_common import ModelTe...
675
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase : Tuple = logging.get_logger(__name__) lowerCAmelCase : str = { 'distilbert-base-uncased': 'https://huggingf...
511
def A_ ( a ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Dict = int(a ) if n_element < 1: SCREAMING_SNAKE_CASE_ : Optional[int] = ValueError('a should be a positive number' ) raise my_error SCREAMING_SNAKE_CASE_ : str ...
511
1
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 GPTaTokenizer if TYPE_CHECKING: ...
583
def _lowercase ( lowercase__ , lowercase__ ): __lowerCAmelCase : Union[str, Any] = len(lowercase__ ) __lowerCAmelCase : Any = len(lowercase__ ) __lowerCAmelCase : str = [[False for _ in range(m + 1 )] for _ in range(n + 1 )] __low...
583
1
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments
198
"""simple docstring""" def lowercase__( __SCREAMING_SNAKE_CASE : int = 2_00 ): lowercase_ : str = [1, 2, 5, 10, 20, 50, 1_00, 2_00] lowercase_ : Dict = [0] * (pence + 1) lowercase_ : List[Any] = 1 # base case: 1 way to make ...
425
0
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase( _a ): snake_case_ : Dict = (UnCLIPScheduler,) def SCREAMING_SNAKE_CASE_ ( self : Optional[Any] , **SCREAMING_SNAKE_C...
473
import os from datetime import datetime as dt from github import Github A : Union[str, Any] = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _lowe...
473
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { "MIT/ast-finetuned-audioset-10-10-0.4593": ( "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0...
366
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is...
366
1
from collections.abc import Generator from math import sin def A_ ( lowercase_ ) ->Dict: """simple docstring""" if len(__A ) != 3_2: raise ValueError('Input must be of length 32' ) SCREAMING_SNAKE_CASE = b'' for i in [3, 2, 1, 0]: little_endian += string_aa[8 * i : 8 ...
701
def A_ ( lowercase_ , lowercase_ ) ->int: """simple docstring""" if len(lowercase_ ) != len(lowercase_ ): raise ValueError('String lengths must match!' ) SCREAMING_SNAKE_CASE = 0 for chara, chara in zip(lowercase_ , lowercase_ ): if chara != chara: count += 1...
259
0
"""simple docstring""" import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ....
602
"""simple docstring""" from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers im...
602
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowercase = { '''configuration_gpt_neo''': ['''GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoConfig''', '''GPTNeoO...
41
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase = { '''configuration_timesformer''': ['''TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimesformerConfig'''], } try: i...
41
1
import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_case = logging.get_logger(__n...
472
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging __snake_case = { """cola""": ...
472
1
"""simple docstring""" def __a ( ) ->Union[str, Any]: a__: List[str] = 0 for i in range(1 , 1001 ): total += i**i return str(_SCREAMING_SNAKE_CASE )[-10:] if __name__ == "__main__": print(solution())
714
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { 'configuration_distilbert': [ 'DISTILBERT_PRETRAIN...
217
0
'''simple docstring''' import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def _A ( lowercase__ , lowercase__ , lowercase__ ): lowercase__ = OmegaConf.load(lowercase__ ) lowercase__ = to...
325
'''simple docstring''' def _A ( lowercase__ ): assert ( isinstance(lowercase__ , lowercase__ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if number_of_steps == 1: return 1 lowercase__ ...
325
1
import os import string import sys __snake_case : List[str] =1 << 8 __snake_case : Optional[int] ={ 'tab': ord('\t'), 'newline': ord('\r'), 'esc': 2_7, 'up': 6_5 + ARROW_KEY_FLAG, 'down': 6_6 + ARROW_KEY_FLAG, 'right': 6_7 + ARROW_KEY_FLAG, 'left': 6_...
717
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.modeling_roberta_series import ...
90
0
class A : def __init__( self: List[Any] ) -> Optional[int]: '''simple docstring''' UpperCAmelCase_ ={} def lowerCAmelCase__ ( self: str ) -> None: '''simple docstring''' ...
54
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowercase_ ( UpperCamelCase_ ): """simple docstring""" def __lt__( self , __SCREAMING_SNAKE_CASE ) ->Optiona...
312
0
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMixin ...
90
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 __snake_case : Union[str, Any] =logging.get_logger(__name__) __snake_case : Dict ={'voc...
90
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelT...
8
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if i...
171
0
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights...
572
'''simple docstring''' import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedC...
572
1
"""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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
153
'''simple docstring''' import math from collections.abc import Iterator from itertools import takewhile def SCREAMING_SNAKE_CASE ( lowercase_ : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3...
588
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Union[str, Any] = logging.get_logger(__name__) _A : Optional[int] = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/config...
518
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __magic_name__ ( __snake_case : List[str] ) -> Tuple: lowercase : Union[str, Any] = ...
518
1
"""simple docstring""" from __future__ import annotations _lowerCAmelCase :List[str] = '#' class _UpperCAmelCase : '''simple docstring''' def __init__( self ) -> None: _UpperCAmelCase : dict = {} def __lowerCAmelCase ( ...
506
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
506
1
import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _snake_case ...
704
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer __UpperCAmelCase : str = logging.get_logger(__name__) __UpperCAmelCase : List[Any] ...
57
0
def _lowerCAmelCase ( A__: Optional[int] , A__: str ): '''simple docstring''' UpperCAmelCase = [1] for i in range(2 , __UpperCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of ...
254
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBas...
96
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import Regres...
718
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging __a = '\\n\n' __a = '\nPerplexity (PPL) is one of the most common metrics for evaluating language models.\nIt...
300
0
import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParser, Trainer, Tra...
622
a__ : Tuple = "Tobias Carryer" from time import time class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : List[str] , lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : ...
622
1
"""simple docstring""" import unittest from transformers import DonutProcessor lowercase__ = 'naver-clova-ix/donut-base' class __snake_case ( unittest.TestCase ): def lowerCamelCase_ ( self) -> List[Any]: '''simple docstring''' a__: Union[st...
217
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = '▁' lowercase__ ...
217
1
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseO...
538
'''simple docstring''' import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin...
538
1
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffusers....
102
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS_NAM...
102
1
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, )...
458
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __magic_name__ ( ) -> str: """simple docstring""" lowercase_ : Optional[int] = ArgumentP...
458
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...
393
"""simple docstring""" import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) SCREAMING_SNAKE_CASE__ = ...
393
1
"""simple docstring""" def lowercase__ ( lowerCAmelCase : int = 100 ) -> int: """simple docstring""" UpperCAmelCase = n * (n + 1) * (2 * n + 1) / 6 UpperCAmelCase = (n * (n + 1) / 2) ** 2 return int(square_of_sum - ...
373
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator class _UpperCAmelCase : def __init__( self , lowercase_ ) -> None: UpperCAmelCase = value UpperCAmelCase = None ...
373
1
import logging from transformers import PretrainedConfig SCREAMING_SNAKE_CASE : Tuple = logging.getLogger(__name__) SCREAMING_SNAKE_CASE : Dict = { "bertabs-finetuned-cnndm": "https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summariza...
441
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import Vide...
441
1
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowercase : str = logging.get_logger(__name__) lowercase : Optional[Any] = { 'nielsr/canine-s': 2_0_4_...
649
'''simple docstring''' import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax...
649
1
"""simple docstring""" from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone...
498
"""simple docstring""" from __future__ import annotations A_ = [] def _lowerCAmelCase ( UpperCAmelCase__ : list[list[int]], UpperCAmelCase__ : int, UpperCAmelCase__ : int ) ->bool: for i in range(len(UpperCAmelCase__ ) ): ...
498
1
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_utils impo...
62
"""simple docstring""" from typing import TYPE_CHECKING from ..utils import _LazyModule _UpperCamelCase : int = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ], ...
599
0
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore snake_case_ : Optional[Any] = namedtuple('covid_data', 'cases deaths recovered') def __snake_case ( _UpperCAmelCase : str = "https://www.worldometers.info/coronavirus/"): ...
702
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Dict = logging.get_logger(__name__) snake_case_ : Union[str, Any] = { 'facebook/encodec_24khz': '...
350
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : Tuple ={ """configuration_roberta_prelayernorm""": [ """ROBERTA_PRELAYERNORM_PRETRA...
483
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple =logging.get_logger(__name__) A_ : int ={ """snap-research/efficientformer-l1-300""": ( """https://huggingface.co/snap-research/effici...
483
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowerCAmelCase : List[Any] = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTo...
284
import csv import tweepy # Twitter API credentials __lowerCAmelCase : str = "" __lowerCAmelCase : Any = "" __lowerCAmelCase : Any = "" __lowerCAmelCase : Optional[int] = "" def UpperCAmelCase_ ( __lowerCAmelCase ) -> None: ...
284
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, Rand...
257
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fro...
497
0
'''simple docstring''' import argparse from collections import defaultdict import yaml _lowerCAmelCase = "docs/source/en/_toctree.yml" def _lowerCAmelCase ( lowercase : Any ) ->str: """simple docstring""" lowercase__ = ...
706
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( lowercase : List[str] , lower...
318
0
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=_UpperCAmelCase ) class UpperCAmelCase ( _UpperCAmelCase ): '''simple docstring''' SCREAMING_SNAKE_C...
42
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers impo...
588
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType, l...
297
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __magic_name__ ...
297
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor a : Dict = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( _UpperCamelCase ): def __init__( self : ...
69
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_ten...
135
0
"""simple docstring""" import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py ...
295
"""simple docstring""" # Copyright 2021 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 ...
295
1
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) fro...
269
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_determinism, load_nump...
269
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging....
381
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase__: '''simple docstring''' def __init__( self , __lowerCamelCase ) -> Tuple: _SCREAMING_SNAKE_CASE : List[str] = list_of_po...
381
1
'''simple docstring''' from __future__ import annotations class a_ : def __init__( self : List[str] , lowercase : Optional[Any]=None ): """simple docstring""" lowercase_ :Optional[int] = data lowe...
172
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase : Optional[Any] ={'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_av...
172
1
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets A_ : Optional[Any] = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass cl...
706
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_...
696
0
"""simple docstring""" import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils...
573
"""simple docstring""" import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order speci...
573
1
import copy import random from transformers import CLIPTokenizer class UpperCamelCase__ ( snake_case_ ): def __init__( self : List[Any] , *UpperCamelCase__ : int , **UpperCamelCase__ : List[Any] ): '''simple docstring''' ...
701
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
650
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor...
38
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def A ( lowercase__ : dict ) -> tuple: return (data["data"], d...
45
0
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewT...
214
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def _A ( __snake_case :int ) -> Optional[int]: """simple docstring""" if ( (cp >= 0x4E_00 and cp <= 0x9F_FF) or (cp >= 0x34_0...
214
1
import heapq def _a ( __UpperCamelCase : dict ): lowerCAmelCase__ : list[list] = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Priority Queue # heapq works with a min priority queu...
233
def _a ( __UpperCamelCase : int ): if not isinstance(__UpperCamelCase ,__UpperCamelCase ): raise ValueError('''check_bouncy() accepts only integer arguments''' ) lowerCAmelCase__ : List[str] = str(__UpperCamelCase ) lowerCAmelCase__ : List[Any] ...
233
1
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from .modeling_utils import ...
193
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 a_ = datasets.utils.logging.get_logger(__name__) @dataclass class _UpperCamelCase ( datasets.B...
193
1