code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowercase = ...
40
"""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
61
0
'''simple docstring''' import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, i...
41
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
0
'''simple docstring''' import os from datetime import datetime as dt from github import Github lowercase : List[str] = [ "good first issue", "good second issue", "good difficult issue", "enhancement", "new pipeline/model", "new scheduler", "wip", ] def ...
42
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
0
from random import randint, random def lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = False , SCREAMING_SNAKE_CASE = False , SCREAMING_SNAKE_CASE = 5 , ): '''simple docstring''' __UpperCamelCase :Optional[int] =...
43
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
0
"""simple docstring""" import argparse import os 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_task_guides.py _a : Optional[Any] = 'src/transformers' _a ...
44
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, r...
45
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae...
61
0
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for...
46
"""simple docstring""" 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_c...
61
0
'''simple docstring''' from collections import defaultdict def _lowerCAmelCase ( _UpperCamelCase : str , _UpperCamelCase : str ) -> bool: """simple docstring""" _SCREAMING_SNAKE_CASE =first_str.lower().strip() _SCREAMING_SNAKE_CASE ...
47
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_availab...
48
"""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 .t...
61
0
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 __snake_case ( _UpperCAmelCase ): __a = [] if isinstance(_Upp...
49
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
0
# 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 app...
50
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
0
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def A () -> Dict: """simple docstring""" with offline(OfflineSim...
51
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
0
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
52
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
0
'''simple docstring''' from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): ...
53
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig a__ : Optional[int] = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-finetuned-wtq''': ( ...
54
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
0
'''simple docstring''' import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConf...
55
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
0
'''simple docstring''' 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 ( HfArgumentPar...
56
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
0
"""simple docstring""" import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): '''simple...
57
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
0
'''simple docstring''' 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 class ...
58
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = { """distilbert-base-uncased""": ...
59
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
0
"""simple docstring""" import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def _sna...
60
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE__ : Option...
61
0
from __future__ import annotations from PIL import Image # Define glider example _A = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], ...
62
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
61
0
'''simple docstring''' import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import M...
63
"""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
61
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property fro...
64
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
0
from __future__ import annotations import math def lowerCAmelCase_ ( __A, __A ) -> float: '''simple docstring''' UpperCAmelCase__ = u for i in range(1, __A ): UpperCAmelCase__ = temp * (u - i) return temp ...
65
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
0
"""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, WEIGHTS_NAME, ...
66
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
0
'''simple docstring''' import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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_av...
67
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
0
from __future__ import annotations from typing import Any def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[Any] ) -> None: '''simple docstring''' create_state_space_tree(SCREAMING_SNAKE_CASE_ , [] , 0 ) def lowerCAmelCase__ ( SCREAMING_SNAKE_CA...
68
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae...
61
0
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> int: snake_case_ = [[0 for _ in range(UpperCAmelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): snake_case_ = 1 for n in range(m + 1 ): for k i...
69
"""simple docstring""" 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_c...
61
0
'''simple docstring''' import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch c...
70
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
0
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_tensor, load_image, l...
71
"""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 .t...
61
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''roberta-base...
72
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class A_ : _UpperCAmelCase : torch.Tensor # [batch_size x 3] _UpperCAmelCase : torch.Tensor # [batch_size x 3] _UpperCAmelCase : torch.Tensor # [bat...
73
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
0
"""simple docstring""" import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration _lowercase = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', '''layers.'''), ...
74
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
0
'''simple docstring''' import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.te...
75
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
0
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 .tokenization_barthez import B...
76
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
0
"""simple docstring""" from manim import * class UpperCAmelCase_ ( _a): def _UpperCAmelCase ( self ) -> int: lowercase__ : str = Rectangle(height=0.5 , width=0.5 ) lowercase__ : str = Rectangle(height=0.46 , width=0...
77
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_config...
78
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
0
'''simple docstring''' def __lowercase ( __lowercase , __lowercase ) -> int: '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def __lowercase ( ) -> None: '''simple docstring''' assert and_g...
79
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
0
'''simple docstring''' def _UpperCamelCase ( __A , __A , __A=False ) -> int: '''simple docstring''' if isinstance(__A , __A ) and isinstance(__A , __A ): UpperCamelCase__ = len(set_a.intersection(__A ) ) ...
80
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : List[str] = { """configuration_x_clip""": [ """XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XCLIPC...
81
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) fr...
82
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
0
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): fr...
83
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE__ : Option...
61
0
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="""session""" )...
84
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
61
0
'''simple docstring''' def UpperCamelCase_( snake_case : int ): '''simple docstring''' if not isinstance(snake_case , snake_case ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise ValueError("I...
85
"""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
61
0
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("""_T""") class A__ ( Generic[_T]): def __init__( self , _SCREAMING_SNAKE_CASE = None ): __lowerCAmelCase : list[_T] = list(iterabl...
86
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
0
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class snake...
87
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
0
def a__ ( A_ ): '''simple docstring''' if n_term == "": return [] __magic_name__ = [] for temp in range(int(A_ ) ): series.append(f'''1/{temp + 1}''' if series else """1""" ) return series if __name__ == "__main__": __lowe...
88
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
0
'''simple docstring''' def __lowerCamelCase ( lowerCAmelCase_ ) -> Any: _a , _a : List[str] = [], [] while len(lowerCAmelCase_ ) > 1: _a , _a : Tuple = min(lowerCAmelCase_ ), max(lowerCAmelCase_ ) start.append(lowe...
89
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
0
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
90
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae...
61
0
"""simple docstring""" def _A (__a , __a ) -> float: """simple docstring""" if density <= 0: raise ValueError('''Impossible fluid density''' ) if bulk_modulus <= 0: raise ValueError('''Impossible bulk modulus''' ) return (bulk_modu...
91
"""simple docstring""" 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_c...
61
0
def _a ( SCREAMING_SNAKE_CASE_ : int = 1_00_00_00 ): __lowerCAmelCase = set(range(3 , SCREAMING_SNAKE_CASE_ , 2 ) ) primes.add(2 ) for p in range(3 , SCREAMING_SNAKE_CASE_ , 2 ): if p not in primes:...
92
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowercase : Tuple = logging.get_logger(__name__) def snake_case_ ( __SCREAMING_SNAKE_CASE : Union[tf.Tensor, np.ndarray] ...
93
"""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 .t...
61
0
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTeste...
94
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
0
import random from typing import Any def _A ( SCREAMING_SNAKE_CASE : list ): """simple docstring""" for _ in range(len(SCREAMING_SNAKE_CASE ) ): a__ : Dict =random.randint(0 , len(SCREAMING_SNAKE_CASE ) - 1 ) ...
95
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
0
"""simple docstring""" from math import isqrt def _snake_case ( lowercase__ ): return all(number % divisor != 0 for divisor in range(2 , isqrt(lowercase__ ) + 1 ) ) def _snake_case ( lowercase__ = 10**6 ): _lowerCamelCase ...
96
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
0
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_...
97
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
0
"""simple docstring""" import math import sys def a_ ( lowerCamelCase ): if number != int(lowerCamelCase ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueError('the value of input must not be a negative number' ...
98
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
0
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Co...
99
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
0
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_availab...
100
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowercase__ :str = logging.get_logger(__name__) class lowercase ( SCREAMING_SNAKE_CASE__ ): lowercase_ : Union[str, Any] ...
101
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
0
"""simple docstring""" from __future__ import annotations from scipy.special import comb # type: ignore class _UpperCAmelCase : '''simple docstring''' def __init__(self , a_ ): '''simple docstring''' __snake_case : List[str] = list_of_points # Degree determ...
102
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
0
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline A__ : Union[str, Any] = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value network ...
103
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
0
'''simple docstring''' import math def _A ( A__ ): """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 even numbers, all multiples of 3 are not primes return False # All pri...
104
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
0
"""simple docstring""" from __future__ import annotations def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float , _lowercase : float , ) ->tuple[str, float]: '''simple docstring''' if (s...
105
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE__ : Option...
61
0
"""simple docstring""" import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, ...
106
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
61
0
import math import sys def __magic_name__ ( A : int ): '''simple docstring''' if number != int(A ): raise ValueError("the value of input must be a natural number" ) if number < 0: raise ValueError("the value of input must not be a negative number" ) if nu...
107
"""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
61
0
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor...
108
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
0
"""simple docstring""" def _snake_case ( UpperCamelCase : str ): return " ".join( """""".join(word[::-1] ) if len(UpperCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(rever...
109
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase = { 'configuration_mvp': ['MVP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MvpConfig', 'MvpOnnxConfig'], 'tokenization_mvp': ['MvpTokeniz...
110
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
0
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _UpperCAmelCase : str = logging.get_logger("transformers.models.speecht5") def A ( lowercase , lowercase , lowerca...
222
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
0
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalD...
24
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae...
61
0
"""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():...
221
"""simple docstring""" 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_c...
61
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale,...
153
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
0
import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor if is_flax_availabl...
9
"""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 .t...
61
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _a ( lowercase__): _a : Any = ["""image_processor""", """tokenizer"""] _a : Union[str, Any] = """ViTImageProcessor""" _a :...
131
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
0
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A_ : Union[str, Any] = '.' if __name__ == "__main__": A_ : List[Any] = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
192
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
0
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _SCREAMING_SNAKE_CASE (__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase = 1 / sqrt(2 ) ) -> List[Any]: '''simple docstring''' ...
136
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
0
"""simple docstring""" import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP _snake_case = ...
294
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
0
__lowerCAmelCase : Dict = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" __lowerCAmelCase : Optional[int] = [{"type": "code", "content": INSTALL_CON...
156
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
0
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) class UpperCamelCase__ ( lowercase__ ): '''simple docstring''' def __init__( self : Dic...
296
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf _UpperCAmelCase : List[Any] = logging.get_logger...
222
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
0
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL snake_case_ = version.parse(version.parse(torch.__version__).base_version) < version.parse('1.11') def lowerCamelCase__ ( ...
24
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCamelCase = { "configuration_mctct": ["MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MCTCTConfig"], "feature_extraction_mctct": ["MCTCTFeatu...
221
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
0
"""simple docstring""" import os import numpy import onnx def a__ ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): """simple docstring""" UpperCamelCase = a.name UpperCamelCase = b.name UpperCamelCase = "" UpperCamelCase = "" UpperCamelCase ...
153
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
0
__lowerCAmelCase : Any ={ 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'dataclasses': 'dataclasses', 'dat...
9
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
0
from collections import namedtuple lowerCamelCase = namedtuple('''from_to''', '''from_ to''') lowerCamelCase = { '''cubicmeter''': from_to(1, 1), '''litre''': from_to(0.0_0_1, 1000), '''kilolitre''': from_to(1, 1), '''gallon''': from_to(0.0_0_4_5_4, 2_6_4.1_7_2), '''cubi...
131
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE__ : Option...
61
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable A_ : Tuple = {'configuration_dpt': ['DPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DPTConfig']} try: if not is_vision...
192
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
61
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE (__lowerCAmelCase ) -> Union[str, Any]: '''simple docstring''' if not all(x.isalpha() for x in string ): raise ValueError("""String must only contain alphabetic characters.""" ) lowercase_ = ...
136
"""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
61
0
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from t...
294
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
0
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing...
156
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
0
import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_flax_com...
296
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
0
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 .tokenization_camembert impor...
222
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
0
def lowerCamelCase__ ( snake_case_ : Optional[int] = 3 , snake_case_ : Optional[Any] = 7 , snake_case_ : Tuple = 100_0000 ) -> List[str]: __snake_case = 0 __snake_case = 1 for current_denominator in range(1 , ...
24
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae...
61
0
"""simple docstring""" from __future__ import annotations __lowerCamelCase = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class UpperCamelCase__: def __init_...
221
"""simple docstring""" 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_c...
61
0
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config ...
153
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
0
import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_torch_...
9
"""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 .t...
61
0
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() ...
131
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import...
192
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
0
"""simple docstring""" 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 ...
136
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
0