code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
def __magic_name__ ( lowercase_ ) -> str: '''simple docstring''' return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7]...
606
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
1
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torc...
606
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_utils imp...
606
1
import os # Precomputes a list of the 100 first triangular numbers __a : Optional[int] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __magic_name__ ( ) -> Any: '''simple docstring''' UpperCamelCase = os.path.dirname(os.path.realpath(lowercas...
606
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
1
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
1
def __magic_name__ ( lowercase_ = 1000 ) -> int: '''simple docstring''' UpperCamelCase = 3 UpperCamelCase = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: ...
606
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
1
from collections.abc import Callable class __UpperCAmelCase : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) -> None: """simple docstring""" # Stores actual heap items. ...
606
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRContextEncod...
606
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler,...
606
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a : Optional[Any] = { """configuration_clipseg""": [ """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CLIPSegConfig""", """CLIPSegTextCon...
606
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
1
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback,...
606
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
1
from itertools import permutations def __magic_name__ ( lowercase_ ) -> bool: '''simple docstring''' if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return F...
606
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_imag...
606
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
1
def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def __magic_name__ ( lowercase_ = 100 ) -> int: '''...
606
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
1
import warnings from functools import wraps from typing import Callable def __magic_name__ ( lowercase_ ) -> Callable: '''simple docstring''' @wraps(lowercase_ ) def _inner_fn(*lowercase_ , **lowercase_ ): warnings.warn( ...
606
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
1
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoT...
606
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
1
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: ...
606
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
1
import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common imp...
606
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
1
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask __a : Any = logging.getLogger(__name__) class __UpperCAmelCase ( snake_case__ ): """si...
606
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
1
def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = [0] * len(lowercase_ ) UpperCamelCase = [] UpperCamelCase = [1] * len(lowercase_ ) for values in graph.values(): for i in val...
606
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
1
def __magic_name__ ( lowercase_ , lowercase_ ) -> Any: '''simple docstring''' UpperCamelCase = (boundary[1] - boundary[0]) / steps UpperCamelCase = boundary[0] UpperCamelCase = boundary[1] UpperCamelCase = make_poi...
606
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __a : Optional[Any] = logging.get_logger(__name__) __a : Optional[Any] = { """Salesforce/blip-vqa-base""": """https://huggingface.co/Sale...
606
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPi...
606
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=snake_case__ ) class __UpperCAmelCase ( snake_case__ ): """simple docstrin...
606
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
1
def __magic_name__ ( lowercase_ , lowercase_ ) -> Tuple: '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __magic_name__ ( lowercase_ , lowercase_=0 ) -> Optional[Any]: '''simple docstring'''...
606
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_utils imp...
606
1
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin ...
606
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
1
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __magic_name__ ( lowercase_ , lowercase_ ) -> np.array: '''simple docstring''' UpperCamelCase = f'''{sampling_rate}''' UpperCamelC...
606
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
1
def __magic_name__ ( lowercase_ = 1000 ) -> int: '''simple docstring''' return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
606
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
1
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterM...
606
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
1
def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = hex_num.strip() if not hex_num: raise ValueError("No value was passed to the function" ) UpperCamelCase = hex_num[0] == "-" if is_negati...
606
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
1
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore...
606
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
1
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
1
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
606
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
1
def __magic_name__ ( lowercase_ , lowercase_ ) -> float: '''simple docstring''' _validate_point(lowercase_ ) _validate_point(lowercase_ ) if len(lowercase_ ) != len(lowercase_ ): raise ValueError("Both points must be in the same...
606
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
1
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
1
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
1
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, re...
606
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
1
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
1
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets __a : Dict = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Mo...
606
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
1
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/res...
606
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
1
import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compu...
606
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
1
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __UpperCAmelCase ( snake_case__ ): """simple docstring""" def __init__(...
606
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
1
def __magic_name__ ( lowercase_ = 1000000 ) -> int: '''simple docstring''' UpperCamelCase = limit + 1 UpperCamelCase = [0] * limit for first_term in range(1 , lowercase_ ): for n in range(lowercase_ , lowercase_ ...
606
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
1
from abc import ABC, abstractmethod from typing import List, Optional class __UpperCAmelCase ( snake_case__ ): """simple docstring""" def __init__( self ) -> Any: """simple docstring""" # test for the a...
606
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
1
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_s...
606
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer __a : Optional[int] = logging.get_logger(__name__) ...
606
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
1
from __future__ import annotations def __magic_name__ ( lowercase_ ) -> list[int]: '''simple docstring''' UpperCamelCase = 2 UpperCamelCase = [] while i * i <= n: if n % i: i += 1 else: ...
606
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_utils imp...
606
1
def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = len(lowercase_ ) UpperCamelCase = len(matrix[0] ) UpperCamelCase = min(lowercase_ , lowercase_ ) for row in range(lowercase_ )...
606
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
1
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __a : Tuple = logging.get_logger(__name__) __a : Dict = { """huggingface/time-series-transformer-tourism-monthly""": ( """https://huggin...
606
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
1
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging __a : List[Any] = logging.get_logger(__name__) def __magic_name__ ( lowercase_ ) -> List[Any]: '''simple ...
606
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
1
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __magic_name__ ( lowercase_ = "laptop" ) -> DataFrame: '''simple docstring''' UpperCamelCase = f'''https://www.amazon.in/laptop/s?k={product}''' ...
606
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
1
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
1
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCAmelCase ( ...
606
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
1
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
1
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging __a : List[str] = logging.get_logger(__name__) class __UpperCAmelCase : """simple docstring""" lowercase ...
606
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
1
def __magic_name__ ( lowercase_ ) -> float: '''simple docstring''' if edge <= 0 or not isinstance(lowercase_ , lowercase_ ): raise ValueError("Length must be a positive." ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def ...
606
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
1
from __future__ import annotations import math class __UpperCAmelCase : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE ) -> None: """simple docstring""" UpperCamelCase = size ...
606
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCAmelCase ( snake_case__ ): """simple docstring""" lowercase = ["""image_processor""", """tokenizer"""] ...
606
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
1
from __future__ import annotations from cmath import sqrt def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ ) -> tuple[complex, complex]: '''simple docstring''' if a == 0: raise ValueError("Coefficient 'a' must not be zero." ) ...
606
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __a : Union[str, Any] = logging.get_logger(__name__) __a : Union[str, Any] = { """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-1...
606
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
1
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging __a : Tuple = logging.get_l...
606
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
1
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCAmelCase ( unittest.TestCase ): """simple docstring""" def __lowerCAmelCase ( self ) -> Union[str, Any]: "...
606
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
1
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer __a : Tuple = logging.get_logger(__name__) ...
606
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
1
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files" , [ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "dataset_infos.json"], ...
606
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
1
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __a : Tuple = 0 __a : List[Any] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], ...
606
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
1
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 tra...
606
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __a : Dict = logging.get_logger(__name__) __a : List[str] ...
606
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_utils imp...
606
1
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_utils imp...
606
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
606
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
1
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position __a : List[str] = """2.13.1""" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.pars...
606
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
1
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = os.path.join(args.tf_model_dir , "para...
606
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
1
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __UpperCAmelCase ...
606
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPa...
606
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
1
def __magic_name__ ( lowercase_ ) -> str: '''simple docstring''' if not all(char in "01" for char in bin_string ): raise ValueError("Non-binary value was passed to the function" ) if not bin_string: raise ValueError("Empty string was ...
606
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __a : Union[str, Any] = logging.get_logger(__name__) class __UpperCAmelCase ( snake_case__ ): """simple docstring""" def __init__...
606
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
1
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 TFModelTeste...
606
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
1
from __future__ import annotations from collections.abc import Iterator class __UpperCAmelCase : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE ) -> None: """simple docstring""" UpperCamel...
606
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
1
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class __UpperCAmelCase ( unittest.TestCase ): """simple docstring""" def __lowerCAmelCase ( se...
606
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
1
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_...
606
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
1
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 .tokenizati...
606
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
606
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
1
import argparse import importlib from pathlib import Path # Test all the extensions added in the setup __a : int = [ """kernels/rwkv/wkv_cuda.cu""", """kernels/rwkv/wkv_op.cpp""", """kernels/deformable_detr/ms_deform_attn.h""", """kernels/deformable_detr/cuda/ms_defor...
606
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available...
606
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
1
import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ ) ->...
606
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
1
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceC...
606
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __a : Union[str, Any] = logging.get_logger(__name__) __a : str = ...
606
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
1
from typing import Any import numpy as np def __magic_name__ ( lowercase_ ) -> bool: '''simple docstring''' return np.array_equal(lowercase_ , matrix.conjugate().T ) def __magic_name__ ( lowercase_ , lowercase_ ) -> Any: '''simpl...
606
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
1
__a : Optional[int] = {"""a""": ["""c""", """b"""], """b""": ["""d""", """e"""], """c""": [], """d""": [], """e""": []} __a : int = ["""a""", """b""", """c""", """d""", """e"""] def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ ) -> List[str]: ...
606
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from tra...
606
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_utils imp...
606
1
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 ( SegformerConfig, SegformerForImageClassification, SegformerForSemantic...
606
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
1
from __future__ import annotations import math def __magic_name__ ( lowercase_ ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # N...
606
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
1
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __UpperCAmelCase ( unittest....
606
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
1
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class ...
606
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffusio...
606
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
1
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_sof...
606
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
1
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_...
606
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
1
from math import sqrt def __magic_name__ ( lowercase_ ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even num...
606
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
1
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 __UpperCAmelCase ( snake_case__ ...
606
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
1
from functools import lru_cache def __magic_name__ ( lowercase_ ) -> set: '''simple docstring''' UpperCamelCase = 2 UpperCamelCase = set() while i * i <= n: if n % i: i += 1 else: ...
606
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
1