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""" 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
"""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
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'google/realm-cc-news-pretrained-embedder': ( 'https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/co...
61
"""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
1
"""simple docstring""" import os def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[Any] = len(grid[0] ) UpperCAmelCase_ : Tuple = len(__lowerCamelCase ) UpperCAmelCase_ : List[Any] = 0 UpperCAmelCase_ : List[str] ...
61
"""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
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig _a = logging.get_logger(__name__) _a = { 'Intel/dpt-large': 'https://huggingface.co/Intel/dpt-large/resolve/main/config.json', # S...
61
"""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
1
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def __a ( __lowerCamelCase ): UpperCAmelCase_ : Any = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation only works for...
61
"""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
1
"""simple docstring""" import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import TokenizerTest...
61
"""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
1
"""simple docstring""" def __a ( __lowerCamelCase ): return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
61
"""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
1
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if days_between_payments <= 0: raise ValueError("days_between_payments must be > 0" ) if daily_interest_rate < 0: raise ValueError("daily_interest_rate mus...
61
"""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
1
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline _a = logging.get_logger(__name__) # pylint: disable=invalid-name class A_ (lowercase__ ): ...
61
"""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
1
"""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 @dataclass ...
61
"""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
1
"""simple docstring""" import argparse 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 accelerate import...
61
"""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
1
"""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
"""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
1
"""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
"""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
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
61
"""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
1
"""simple docstring""" import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CON...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class A_ (unittest.TestCase ): '''simple docstring''' def UpperCamelCase__ ( self ): """simple docstring""" U...
61
"""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
1
"""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
"""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
1
"""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
"""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
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, s...
61
"""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
1
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=lowercase__ ) class A_ (lowercase__ ): '''simple docstring''' # `task` is not a ClassVar since we...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class A_ (metaclass=lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = ["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowercase_ , **lower...
61
"""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
1
"""simple docstring""" import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP _a = False try: _a = ...
61
"""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
1
"""simple docstring""" 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...
61
"""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
1
"""simple docstring""" import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithNoAttenti...
61
"""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
1
"""simple docstring""" import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging _a = logging.get_logger(__name__) de...
61
"""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
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 .t...
61
"""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
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', } class A_ (lowercas...
61
"""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
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase ): # Check if the input is valid if not len(__lowerCamelCase ) == len(__lowerCamelCase ) == 3: raise ValueError("Please enter a valid equation." ) if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0: ...
61
"""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
1
"""simple docstring""" from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward fro...
61
"""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
1
"""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
"""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
1
"""simple docstring""" _a = { 0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f', } def __a ( __lowerCamelCase ): assert type(__lowerCame...
61
"""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
1
"""simple docstring""" import math def __a ( __lowerCamelCase, __lowerCamelCase ): if ( not isinstance(__lowerCamelCase, (int, float) ) or power_factor < -1 or power_factor > 1 ): raise ValueError("power_factor must be a valid float value between -1 and 1." ) ...
61
"""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
1
"""simple docstring""" _a = 9.8_0665 def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = g ): if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: ...
61
"""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
1
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def __a ( __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : List[Any] = analyze_text(__lowerCamelCase ) UpperCAmelCase_ :...
61
"""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
1
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _a = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generation...
61
"""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
1
"""simple docstring""" import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class A_ (lowercase__ ,unittest.TestCase ): ...
61
"""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
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def __a ( __lowerCamelCase ): return DownloadCommand(args.model, args.cache_dir, args.force, args.trust_remote_code ) class A_ (lowercase__ ): '''simple docstring''' @sta...
61
"""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
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
61
"""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
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 .t...
61
"""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
1
"""simple docstring""" import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_loggi...
61
"""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
1
"""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.test_...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( ...
61
"""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
1
"""simple docstring""" import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL _a = version.parse(version.parse(torch.__version__).base_version) < version.parse('1.11') def __a ( __lowerCam...
61
"""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
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import ...
61
"""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
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase ): return int(input_a == input_a == 0 ) def __a ( ): print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2 | Output |" ) print(f"""| 0 | 0 | {nor_gate(0, 0 )} |""" ) p...
61
"""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
1
"""simple docstring""" import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline,...
61
"""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
1
"""simple docstring""" 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() ...
61
"""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
1
"""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
"""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
1
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar _a = TypeVar('KEY') _a = TypeVar('VAL') @dataclass(frozen=lowercase__ ,slots=lowercase__ ) class A_ (Generic[KEY, VAL] ): ...
61
"""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
1
"""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
"""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
1
"""simple docstring""" from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a = logging.get_logger(__name__) _a = { 'nielsr/canine-s': 2_048, } # Unicode defines 1,114,112 total “codepoints” _a...
61
"""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
1
"""simple docstring""" from typing import List, Union import numpy as np 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 PIL import Image from ..image_utils import...
61
"""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
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
61
"""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
1
"""simple docstring""" import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class A_ (lowercase__ ): ''...
61
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _a = { 'configuration_convnext': ['CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvNextConf...
61
"""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
1
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCam...
61
"""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
1
"""simple docstring""" _a = { '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': 'datacl...
61
"""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
1
"""simple docstring""" import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __a ( __lowerCamelCase ): UpperCAmelCase_ : int = [ "encoder.version", "decoder.version", "model.encoder.vers...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # ...
61
"""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
1
"""simple docstring""" import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, ...
61
"""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
1
"""simple docstring""" from __future__ import annotations import math _a = '2020.9.26' _a = 'xcodz-dot, cclaus, dhruvmanila' def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if not all(isinstance(__lowerCamelCa...
61
"""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
1
"""simple docstring""" import os from collections.abc import Iterator def __a ( __lowerCamelCase = "." ): for dir_path, dir_names, filenames in os.walk(__lowerCamelCase ): UpperCAmelCase_ : Tuple = [d for d in dir_names if d != "scripts" and d[0] not in "._"] for fi...
61
"""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
1
"""simple docstring""" import math from numpy import inf from scipy.integrate import quad def __a ( __lowerCamelCase ): if num <= 0: raise ValueError("math domain error" ) return quad(__lowerCamelCase, 0, __lowerCamelCase, args=(__lowerCamelCase) )[0] def __a ( __lowe...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""simple docstring""" class A_ : '''simple docstring''' def __init__( self ): """simple docstring""" UpperCAmelCase_ : List[Any] = "" UpperCAmelCase_ : Optional[int] = "" UpperCAmelCase_ : Optional[Any] = [] def ...
61
"""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
1
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transfor...
61
"""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
1
"""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
"""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
1
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMod...
61
"""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
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMo...
61
"""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
1
"""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
"""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
1
"""simple docstring""" import os import sys _a = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassif...
61
"""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
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'hustvl/...
61
"""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
1
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): # Initialise PyTorch model UpperCAme...
61
"""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
1
"""simple docstring""" 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...
61
"""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
1
"""simple docstring""" import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTeste...
61
"""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
1
"""simple docstring""" import unittest import numpy as np from transformers import DistilBertConfig, 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(): import ...
61
"""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
1
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependency...
61
"""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
1
"""simple docstring""" from itertools import permutations def __a ( __lowerCamelCase ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False UpperCAmelCase_ : List[str] = [7, 11, 13, ...
61
"""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
1
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultiste...
61
"""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
1
"""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
"""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
1
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home _a = HUGGINGFACE_HUB_CACHE _a = 'config.json' _a = 'diffusion_pytorch_model.bin' _a = 'diffusion_flax_model.msgpack' _a = 'model.on...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" import requests from bsa import BeautifulSoup def __a ( __lowerCamelCase = "https://www.worldometers.info/coronavirus" ): UpperCAmelCase_ : str = BeautifulSoup(requests.get(__lowerCamelCase ).text, "html.parser" ) UpperCAmelCase_ : List[str] ...
61
"""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
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a = logging.get_logger(__name__) _a = '▁' _...
61
"""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
1
"""simple docstring""" import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils ...
61
"""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
1
"""simple docstring""" from typing import List import numpy as np def __a ( __lowerCamelCase ): UpperCAmelCase_ : Dict = {key: len(__lowerCamelCase ) for key, value in gen_kwargs.items() if isinstance(__lowerCamelCase, __lowerCamelCase )} if len(set(lists_lengths.values()...
61
"""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
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase ): while b: UpperCAmelCase_ , UpperCAmelCase_ : Dict = b, a % b return a def __a ( __lowerCamelCase, __lowerCamelCase ): return a if b == 0 else euclidean_gcd_recursive(__lowerCamelCas...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""simple docstring""" _a = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100_000)] def __a ( __lowerCamelCase ): UpperCAmelCase_ : Optional[Any] = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_dig...
61
"""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
1
"""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, floats_tensor, i...
61
"""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
1
"""simple docstring""" import numpy as np def __a ( __lowerCamelCase ): return 1 / (1 + np.exp(-vector )) def __a ( __lowerCamelCase ): return vector * sigmoid(__lowerCamelCase ) if __name__ == "__main__": import doctest doctest.testmod()
61
"""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
1
"""simple docstring""" from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from acceler...
61
"""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
1
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class A_ (lowercase__ ): '''simple docstring''' # to overwrite at feature e...
61
"""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
1
"""simple docstring""" from __future__ import annotations from collections import deque class A_ : '''simple docstring''' def __init__( self , lowercase_ ): """simple docstring""" UpperCAmelCase_ : list[dict] = [] self.adlist.append( {"value": ""...
61
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _a = { 'configuration_data2vec_audio': ['DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Data2VecAudioConfig'], 'configuration_data...
61
"""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
1
"""simple docstring""" from manim import * class A_ (lowercase__ ): '''simple docstring''' def UpperCamelCase__ ( self ): """simple docstring""" UpperCAmelCase_ : str = Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase_ : Optional[...
61
"""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
1
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def __a ( __lowerCamelCase ): return (data["dat...
61
"""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
1
"""simple docstring""" from math import factorial def __a ( __lowerCamelCase = 20 ): UpperCAmelCase_ : List[Any] = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCAmelCase_ : int = n // 2 return int(fact...
61
"""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
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Any = ["""image_processor""", """tokenizer"""] SCREAMING_SNAKE_CASE__ ...
61
"""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
1
"""simple docstring""" class A_ : '''simple docstring''' def __init__( self , lowercase_ ): """simple docstring""" # we need a list not a string, so do something to change the type UpperCAmelCase_ : Any = arr.split("," ) def UpperCamelCase__...
61
"""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
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase ): return int((input_a, input_a).count(0 ) == 0 ) def __a ( ): assert and_gate(0, 0 ) == 0 assert and_gate(0, 1 ) == 0 assert and_gate(1, 0 ) == 0 assert and_gate(1, 1 ) == 1 if __name__ == "__main_...
61
"""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
1
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : Tuple = len(__lowerCamelCase ) for _ in range(__lowerCamelCase ): for i in range(_ % 2, arr_size - 1, 2 ): if arr[i + 1] < arr[i]: UpperCAmelCase_ , UpperCAmelCase_ : ...
61
"""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
1