code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration __lowerCamelCase : Any = 5_00_00 __lowerCamelCase : Tuple = 50_00 __lowerCamelCase , __lowerCamelCase : List[str] = os.path.split(__file__) __lowerCamelCase : Li...
18
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. UpperCamelCase_ = 2_0_0 # Number of elements selected in every generation of evolution. The selection takes # place from b...
251
0
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
197
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__) class a__ ( __snake_case ): def __init__( self , UpperCAmelCase=None , **UpperCAmelCase ) -> Any: ...
197
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor...
34
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": lowercase__ : List[Any] = pd.read_csv('''s...
190
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerat...
367
import argparse import os import torch from transformers.utils import WEIGHTS_NAME a__ = ['''small''', '''medium''', '''large'''] a__ = '''lm_head.decoder.weight''' a__ = '''lm_head.weight''' def __UpperCAmelCase ( __a : str ,__a : str ) -> ...
15
0
import pytest import datasets # Import fixture modules as plugins lowercase__ : Any = ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def lowerCamelCase__ ( _A , _A ): '''simple docstring''' for item in items: ...
187
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.data imp...
187
1
# 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 # # Unless required by applica...
189
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitConfig, ViTHybridC...
189
1
from __future__ import annotations snake_case : List[Any] = tuple[int, int, int] snake_case : Union[str, Any] = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase snake_case : Optional[Any] = '''ABCDEFGHIJKLMNOP...
94
snake_case : str = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git ''' snake_case : List[...
94
1
from importlib import import_module from .logging import get_logger _lowerCamelCase : str = get_logger(__name__) class __UpperCAmelCase : def __init__( self : str, __A : str, __A : Any=None ): UpperCAmelCase : str = ...
355
from __future__ import annotations import queue class __UpperCAmelCase : def __init__( self : str, __A : Union[str, Any] ): UpperCAmelCase : Dict = data UpperCAmelCase : Tuple = None UpperCAmelCase : Any = None ...
99
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, f...
197
"""simple docstring""" import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL __lowerCAmelCase : Dict =version.parse(version.parse(torch.__version__).base_version) < version.parse(...
197
1
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu __UpperCAmelCase = get_tests...
359
"""simple docstring""" import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor __UpperCAmelCase = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( A__ ): def __init__( self , *__A , ...
1
0
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_bart import BartTokenizer __lowercase...
43
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel SCREAMING_SNAKE_CASE :Union[str, Any] = False SCREAMING_SNAKE_CASE :Any = True SCREAMING_SNAKE_CASE :Tuple = False ...
15
0
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
1
import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowerCamelCase : Union[str, Any] =argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', ...
189
from math import factorial class __a : def __init__( self : Union[str, Any] , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ): '''simple docstring''' UpperCamelCase__ : Tuple ...
189
1
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datase...
357
"""simple docstring""" def lowerCamelCase_ ( ): lowerCamelCase__ : Optional[Any] = [] lowerCamelCase__ : List[Any] = 1 while len(_lowerCamelCase ) < 1e6: constant.append(str(_lowerCamelCase ) ) i += 1 lowerCamelCase__ : str = ...
316
0
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, r...
25
import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_co...
99
0
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __lowerCAmelCase = logging.get_logger(__name__) def snake_case_ ( snake_case , snake_c...
366
from collections import deque from math import floor from random import random from time import time class __a : def __init__( self ) -> Dict: '''simple docstring''' lowercase__: Dict = {} def SCREAMING_SNAKE_CASE__ ( s...
288
0
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preproc...
150
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) UpperCAmelCase_ = str(bin(snake_cas...
1
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbar...
369
'''simple docstring''' 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 B...
147
0
"""simple docstring""" import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore lowerCamelCase_ : Union[str, Any] = list(good_file_paths()) assert filepaths, "good_file_path...
81
"""simple docstring""" import copy 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 from ..auto import CONFIG_MAPPING lowerCame...
81
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_tensor, r...
114
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase : List[str] = {"UserAgent": UserAgent().random} def _lowerCAmelCase ( _UpperCamelCase : str ) -> dict: ...
114
1
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaP...
316
"""simple docstring""" import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device ...
316
1
'''simple docstring''' from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _lowercase : List[Any] = 'https://www.indeed.co.in/jobs?q=mobile+app+development&l=' def lowerCamelCase ( UpperCAmelCase__ : str = "mumb...
366
'''simple docstring''' from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_av...
21
0
'''simple docstring''' import torch from torch import nn class lowerCamelCase_ (nn.Module ): '''simple docstring''' def __init__( self : Optional[Any] , A : Dict , A : Tuple , A : Optional[Any] , A : Tuple , ...
31
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
288
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 fro...
351
'''simple docstring''' import math __snake_case : List[Any] = 10 __snake_case : Dict = 7 __snake_case : str = BALLS_PER_COLOUR * NUM_COLOURS def __lowerCamelCase ( __snake_case : int = 20 ) -> str: """simple docstring""...
136
0
'''simple docstring''' import numpy as np def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : np.ndarray ,_UpperCAmelCase : np.ndarray ,_UpperCAmelCase : float = 1e-12 ,_UpperCAmelCase : int = 100 ,) -> Dict: assert np.shape(lowerCAmelCase__ )[0] == np.shape(lowerCAmelC...
276
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : Optional[Any] ...
147
0
from __future__ import annotations def _lowercase ( UpperCamelCase_ , UpperCamelCase_ ) -> int: '''simple docstring''' if len(UpperCamelCase_ ) <= 1 or n <= 1: return insert_next(UpperCamelCase_ , n - 1 ) rec_insertion_sort(UpperCamelCase_ ...
169
import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP __snake_case = False try: __snake_case = _is_packa...
169
1
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 a : int = logging.get_logger(__name__) a : Optional[Any] ...
114
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a : Dict = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a : Any = typing.Union[np.floataa, int, float] # noqa: UP007 def ...
114
1
"""simple docstring""" import warnings from .state import AcceleratorState, GradientState warnings.filterwarnings("ignore", category=UserWarning, module="torch.optim.lr_scheduler") class __lowerCAmelCase : '''simple docstring''' def __init__( self , _a , _a ...
354
"""simple docstring""" from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline lowercase_ ...
11
0
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging UpperCAmelCase_ : Dict = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE_ ( __magic_name__ : T...
38
from __future__ import annotations from math import ceil, floor, sqrt def UpperCamelCase_( lowerCamelCase_ = 200_0000 ) -> int: _lowercase : list[int] = [0] _lowercase : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle...
21
0
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _lowerCamelCase ( _UpperCamelCase = 3 ): '''simple docstring''' if isinstance(_UpperCamelCase , _UpperCamelCase ): raise Typ...
353
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging A : List[Any] = logging.get_logger(__name__) A : Tuple = { "facebook/data2vec-base-960h": "https://huggingface.co/facebook/data2vec-audio-base-96...
259
0
"""simple docstring""" def __lowerCAmelCase (_UpperCamelCase = 1000 ): __lowerCAmelCase , __lowerCAmelCase : Optional[int] = 1, 1 __lowerCAmelCase : int = 2 while True: __lowerCAmelCase : Optional[int] = 0 __lowerCAmelCase : L...
86
"""simple docstring""" from typing import Dict, Optional import numpy as np import datasets UpperCAmelCase : Tuple = "\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and the ground truth...
136
0
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
369
'''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...
283
0
def lowerCAmelCase ( _lowerCAmelCase : List[Any] , _lowerCAmelCase : Dict , _lowerCAmelCase : str , _lowerCAmelCase : Union[str, Any] , _lowerCAmelCase : Any , _lowerCAmelCase : List[str] ): """si...
169
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class _UpperCamelCase ( lowerCAmelCase ): UpperCAmelCase_ = ...
169
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer else: ...
221
from __future__ import annotations import unittest from transformers import 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_tensor, random_attention_mask fro...
221
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Optional[int] = logging.get_logger(__name__) A : int = { "xlm-mlm-en-2048": "...
57
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch clas...
11
0
"""simple docstring""" import math import random def lowercase ( _SCREAMING_SNAKE_CASE : Dict , _SCREAMING_SNAKE_CASE : Optional[int] = False ): '''simple docstring''' if deriv: return value * (1 - value) return 1 / (1 + math.exp...
358
"""simple docstring""" import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Traine...
326
0
'''simple docstring''' import requests lowerCAmelCase: Optional[Any] = 'https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=' def lowerCamelCase__ ( _A ): # fetching a list of articles in json format a : Tuple = requests.get(_NEWS...
297
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_commo...
259
0
"""simple docstring""" __UpperCamelCase : int = '''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .dat...
350
"""simple docstring""" from __future__ import annotations def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : str , _UpperCAmelCase : list[str] | None = None ): lowerCAmelCase = word_bank or [] # create a table lowerCAmelCase = len(_UpperCAmelCase ) + 1 lowerCAmelCase ...
309
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase_ ( unit...
74
# 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.0 # # Unless re...
283
0
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": _UpperCamelCase = pd.read_csv('''sample_data.csv''', h...
370
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCamelCase = { '...
16
0
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def UpperCAmelCase ( UpperCamelCase__ ): """simple docstring""" for param in module.parameters(): A__ = False d...
221
"""simple docstring""" from __future__ import annotations import unittest from transformers import 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_tensor, rand...
221
1
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing import APIRout...
353
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 UpperCAmelCase : Optional[Any] = logging.get_logger(...
66
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionP...
74
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def lowerCAmelCase__( lowercase : Dict ) -> str: # picklable for multip...
326
0
from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
367
def A_ ( _UpperCAmelCase , _UpperCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": ...
127
0
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin _snake_case = get_tests_dir("fixtures/test_sentencepiece_bpe.model") c...
36
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} try: ...
309
0
def lowerCAmelCase( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ )-> int: """simple docstring""" while b: UpperCamelCase_ , UpperCamelCase_ = b, a % b return a def lowerCAmelCase( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ )-> ...
360
def lowerCAmelCase( SCREAMING_SNAKE_CASE_ )-> list: """simple docstring""" if len(SCREAMING_SNAKE_CASE_ ) <= 1: return lst UpperCamelCase_ = 1 while i < len(SCREAMING_SNAKE_CASE_ ): if lst[i - 1] <= lst[i]: i += 1 else: ...
60
0
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSequenceClassification, Auto...
21
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ ...
16
0
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging lowerCamelCase ...
211
import math class _a : def __init__( self : List[Any] , _SCREAMING_SNAKE_CASE : Any=0 )-> Optional[Any]: # a graph with Node 0,1,...,N-1 lowerCAmelCase__ : Optional[int] = n lowerCAmelCase__ : List[Any] = [ [math.inf fo...
211
1
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a__ : Tuple = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '''attention.self''', '''sel...
313
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __a = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", "AltCLIPTextConfig...
66
0
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def lowerCamelCase_ ( _UpperCamelCase ): """simp...
358
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import ...
279
0
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 _lowerCamelCase : List[Any] = logging.get_logger(__name__) ...
14
def UpperCAmelCase__ (UpperCamelCase_ ,UpperCamelCase_ ): """simple docstring""" snake_case = [1] for i in range(2 ,UpperCamelCase_ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds"...
127
0
'''simple docstring''' import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _lowercase : Union[str, Any] ...
369
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: lowercase_ : Any = prime_factors(UpperCAmelCase__ ) if is_square_free(UpperCAmelCase__ ...
21
0
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore, ) from trans...
52
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformer...
60
0
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, ...
371
from collections import defaultdict from math import ceil, sqrt def lowercase__ ( __snake_case : int = 1_000_000 , __snake_case : int = 10 ): '''simple docstring''' UpperCAmelCase_ : defaultdict = defaultdict(__snake_case ) ...
145
0
'''simple docstring''' import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup lowercase_ = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" " (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.1...
211
'''simple docstring''' from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowercase_ = datasets.utils.logging.get_logger(__name__) class __A ( folder_based_builder.FolderBasedBuilderConfig ): ...
211
1
def SCREAMING_SNAKE_CASE ( ) -> Any: UpperCamelCase__ : Optional[int] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] UpperCamelCase__ : List[Any] = 6 UpperCamelCase__ : Optional[int] = 1 UpperCamelCase__ : ...
371
def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> list: UpperCamelCase__ : Tuple = False while is_sorted is False: # Until all the indices are traversed keep looping UpperCamelCase__ : Tuple = True for i in range(0 , le...
196
0
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_space_optuna, default...
330
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowerCAmelCase ( _a, unittest.TestCase ): ...
279
0
'''simple docstring''' import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask snake_case__ : Optional[int] = logging.getLogger(__name__) class __SCREAMING_SNAKE_CASE ( lowerC...
274
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class __SCREAMING_SNAKE_CASE ( lowerCamelCase_ , lowerCamelCase_ ): '''simp...
274
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.set...
329
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 impor...
21
0
def _UpperCamelCase (a__ :List[str] ): """simple docstring""" UpperCamelCase__ = [False] * len(lowercase__ ) UpperCamelCase__ = [-1] * len(lowercase__ ) def dfs(a__ :Optional[int] , a__ :str ): ...
362
import argparse import glob import logging import os from argparse import Namespace from importlib import import_module import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score f...
87
0
"""simple docstring""" 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 SCREAMING_SNAKE_CASE ( a_...
106
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class A__ : """simple docstring""" def __init__( self : Any , lowerCAmelCase__ : Any ) -> Dict: """simple docstring""" _UpperCAmelCase ...
145
0
import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForConditionalGeneration as Pr...
295
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def lowerCamelCase__ ( UpperCamelCa...
295
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/config.json'''} class __lowerCamelCase ( __UpperCamelCase): """sim...
39
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data impo...
196
0
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCamelCase ( unittest.TestCase , snake_case ): """simple docstring""" def lowerCamelCase__ ( self ): _lowercase : Union...
336
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () UpperCAmelCase: Optional[Any] = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defin...
336
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : int = { '''xlm-roberta-base''': '''...
274
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, ...
274
1
import math def _snake_case( SCREAMING_SNAKE_CASE__ : int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all ...
357
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis...
282
0
import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def lowerCAmelCase_ ( ) -> Optio...
10
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar UpperCamelCase = TypeVar('''T''') class snake_case_ ( Generic[T] ): __A : deque[T] # Cache store of keys __A : set[T] # References of the keys in cache ...
87
0
def _a ( SCREAMING_SNAKE_CASE_ : list[list[float]] ): __lowerCAmelCase = [] for data in source_data: for i, el in enumerate(SCREAMING_SNAKE_CASE_ ): if len(SCREAMING_SNAKE_CASE_ ) < i + 1: data_lists.append([] ) ...
102
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging UpperCamelCase__ = """\ """ UpperCamelCase__ = """ Perplexity (PPL) is one of the most common metrics for ev...
102
1
from random import randint, random def _lowerCamelCase( lowercase__ , lowercase__ , lowercase__ , lowercase__ = False , lowercase__ = False , lowercase__ = 5 , ) -> list: '''simple docstring''' __lowercase= [[-1] * number_of_cells] # Create a highway without any car __...
295
def _lowerCamelCase( lowercase__ , lowercase__ = " " ) -> list: '''simple docstring''' __lowercase= [] __lowercase= 0 for index, char in enumerate(lowercase__ ): if char == separator: split_words.append(string[last_index:index] ) __lowercase= index + 1 elif in...
295
1
'''simple docstring''' from pathlib import Path import numpy as np from PIL import Image def __UpperCamelCase ( UpperCAmelCase ) -> Union[str, Any]: lowercase__ : str = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2] return 0.2_9_8_9 * r + 0.5_8_7_0 * g + 0.1_1_4_0 * b def __UpperCamelCa...
365
'''simple docstring''' import qiskit def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ): lowercase__ : Dict = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register lowercase__ : Any = qiskit.QuantumCircuit(UpperCAmelCase ...
214
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class __UpperCAmelCase ( unittest.TestCase , lowerCamelCase__ ): def __magic_name__ ( self : Union[str, Any] ): UpperCAmelCase : Optiona...
336
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling ...
336
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from ...
153
"""simple docstring""" import argparse import torch from safetensors.torch import load_file from diffusers import StableDiffusionPipeline def A_ ( _lowerCAmelCase : Union[str, Any], _lowerCAmelCase : Tuple, _lowerCAmelCase : Optional[Any], _lowerCAmelCase ...
153
1
import warnings from ..trainer import Trainer from ..utils import logging __lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase_ ( _A ): '''simple docstring''' def __init__( self : List[Any] , UpperCamelC...
88
from collections.abc import Sequence def a_ ( __lowercase : Sequence[float] , __lowercase : float ) -> float: return sum(c * (x**i) for i, c in enumerate(__lowercase ) ) def a_ ( __lowercase : Sequence[float] , __lowercase : float ) -> float: ...
282
0
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_...
350
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def _snake_case( SCREAMING_SNAKE_CASE__...
282
0
"""simple docstring""" from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance SCREAMING_SNAKE_CASE : List[str] = 6_378_137.0 SCREAMING_SNAKE_CASE : Tuple = 6_356_752.314_245 SCREAMING_SNAKE_CASE : Dict = 637_8137 def lowerc...
102
"""simple docstring""" from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
102
1
"""simple docstring""" import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def _lowercase ( __lowerCAmelCase ) -> Optional[int]: ...
358
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging a :Optional[int] = logging.get_logger(__name__) def _lowercase ( __lowerCAmelCase ) -> List[int]: if isinstance(__lowerCAmelCase , np.nd...
56
0
import sys def lowerCAmelCase__ ( lowerCamelCase_ : List[Any]): '''simple docstring''' lowerCAmelCase__ : List[Any] = len(SCREAMING_SNAKE_CASE_) lowerCAmelCase__ : Optional[int] = [[0 for x in range(SCREAMING_SNAKE_CASE_)] for x in range(SCR...
129
from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self , a , a , a = 0): lowercase__ , lowercase__ : Dict = row, column lowercase__ : Optional[Any] = [[default_va...
214
0
import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFe...
362
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass snake_case_ : List[Any] = (3, 9, -11, 0, 7, 5, 1, -1) snake_case_ : str = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class __snake_case : UpperCAmelCa...
7
0
"""simple docstring""" from scipy.stats import spearmanr import datasets lowerCAmelCase__ = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. P...
153
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # n...
153
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, I...
350
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.co...
226
0
'''simple docstring''' import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _lowerCAmelCase = 50_0000 _lowerCAmelCase , _lowerCAmelCase = os.path.split(__file__) _lowerCAmelCase = os.path....
37
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def a_ ( __lowercase : Dict ) -> List[Any]: _snake_case = args.pruning_method _snake_case = args.threshold _snake_case = args.model_name_or_...
282
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_available...
350
from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __lowerCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , ): if donor_conc <= 0: raise ValueError('Dono...
119
0
from typing import Dict from .base import GenericTensor, Pipeline class SCREAMING_SNAKE_CASE__ ( _lowerCamelCase ): """simple docstring""" def A__ ( self , SCREAMING_SNAKE_CASE_=None , SCREAMING_SNAKE_CASE_=None , SCREAMING_SNAKE_CASE_=None , **SCREAMIN...
328
'''simple docstring''' import re def __magic_name__ ( __UpperCAmelCase ) -> bool: '''simple docstring''' snake_case_ = 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(__UpperCAmelCase, __U...
56
0
"""simple docstring""" A = { '''km/h''': 1.0, '''m/s''': 3.6, '''mph''': 1.609344, '''knot''': 1.852, } A = { '''km/h''': 1.0, '''m/s''': 0.277777778, '''mph''': 0.621371192, '''knot''': 0.539956803, } def __A ( a_ :fl...
351
"""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 logging A = logging.get_...
188
0
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets A : Optional[Any] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matthew a...
57
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowercase_ = get_tests_dir("fixtures/spiece.model") ...
7
0
"""simple docstring""" from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class __magic_name__ : '''simple docstring''' def _lowerCAmelCase ( self , _a ): """simple docs...
358
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import Scheduler...
168
0
"""simple docstring""" import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def _A ( lowercase , lowercase ): """simple docstring""" a =f'''{sampling_rate}''' a ='''1''' a ='...
81
import qiskit def a ( _UpperCAmelCase : int , _UpperCAmelCase : int ): '''simple docstring''' __UpperCAmelCase : List[str] = qiskit.Aer.get_backend('''aer_simulator''' ) __UpperCAmelCase : Optional[A...
226
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logg...
353
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
0
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def __snake_case ( _lowerCAmelCase : Dict , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : int , _lowerCAmelCase : Union[str, Any]=1024...
300
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPipeline, UNetaDCon...
119
0
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : str , UpperCAmelCase_ : str ): if not (isinstance(UpperCAmelCase_ , UpperCAmelCase_ ) and isinstance(UpperCAmelCase_ , UpperCAmelCase_ )): raise ValueError("""longest_common_substr...
355
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : int = 50 ): A__ = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length +...
69
0
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common ...
71
from __future__ import annotations def UpperCAmelCase__ ( _A : float , _A : float , _A : float , ): '''simple docstring''' if (stress, tangential_force, area).count(0 ) != 1: raise ValueError('''You cannot supply more or less than 2 values''' )...
188
0
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @re...
350
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils impo...
121
0
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_00 ) -> int: __lowerCamelCase : str = set() __lowerCamelCase : List[str] = 0 __lowerCamelCase : Optional[Any] = n + 1 # maximum limit for a in range(2 , low...
185
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar a_ : Any = TypeVar("T") class a ( Generic[T] ): def __init__( self , __magic_name__ , __magic_name__ )...
168
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) A_ : int = { """configuration_speech_to_text"""...
349
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pi...
349
1
"""simple docstring""" import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline UpperCAmelCase__ : List[str] = { 'n_samples': 6_4, 'horizon': 3_2, 'num_inference_steps': 2_0, 'n_guide_steps': 2, # can set to 0 for faste...
25
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __a = logging.get_logger(__name__) __a = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class __SCREAMING_SNAKE_CASE ...
337
0
"""simple docstring""" import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import Conf...
313
"""simple docstring""" import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor ...
313
1
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers....
123
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCAmelCase ( ) -> int: snake_case_ = HfArgumentParser(UpperCAmelCase ) snake_case_ = parser.parse_args_into_dataclasses()[0] ...
69
0
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common impor...
357
import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class lowercase_ ( lowercase ): '''simp...
26
0
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _UpperCa...
220
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @re...
121
0
'''simple docstring''' def a__ ( _SCREAMING_SNAKE_CASE : List[Any] ) -> Any: """simple docstring""" UpperCAmelCase_ : List[Any] = [] UpperCAmelCase_ : Dict = set({"(", "[", "{"} ) UpperCAmelCase_ : Any = ...
67
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def a__ ( _SCREAMING_SNAKE_CASE : Optional[Any] , _SCREAMING...
67
1