code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class UpperCAmelCase ( UpperCamelCase__ ): __lowercas...
237
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCAmelCase ( UpperCamelCase__ ): __...
237
1
'''simple docstring''' 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_mvp impor...
237
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requi...
237
1
'''simple docstring''' import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline __lowerCAmelCase : Dict =version.pa...
237
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
237
1
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[float] , _lowerCamelCase : list[float] ): A__ = sorted(numsa + numsa ) A__, A__ = divmod(len(_lowerCamelCase ) , 2 ...
237
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp...
237
1
'''simple docstring''' import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow fr...
237
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from tor...
237
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.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controln...
237
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
1
'''simple docstring''' import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class UpperCAmelCase ( UpperCamelCase__ ): def __init__...
237
'''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 ( ...
237
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import f...
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
'''simple docstring''' import math import unittest def UpperCamelCase ( _lowerCamelCase : int ): assert isinstance(_lowerCamelCase , _lowerCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: #...
237
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowerCAmelCase : List[str] ={ "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int | float | str ): try: A__ = float(_lowerCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) A__ = decimal - int(_lowerCamelCase ) ...
237
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Any =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402...
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int = 10**12 ): A__ = 1 A__ = 0 A__ = 1 A__ = 1 while numerator <= 2 * min_total - 1: prev_numerator += 2 * numerator numerator += 2 * prev_numerator prev_...
237
'''simple docstring''' # 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...
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCase : int ): if principal <= 0: raise Exception("Principal borrowed must be > 0" ) if rate_per_annum < 0: ra...
237
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def UpperCamelCase ( _lowerCamelCase : list[list[float]] ): A__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
237
1
'''simple docstring''' import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_module...
237
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""note_seq"""] def __init__( self :Optional[Any] , *lowercase_ :List[Any] , **lowercase_ :List[str] ...
237
1
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset from utils import logger class UpperCAmelCase ( UpperCamelCase__ ): def __init__( self :Tuple , lowercase_ :str , lowercase_ :List[Any] )-> List[Any]...
237
'''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.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controln...
237
1
'''simple docstring''' import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met cl...
237
'''simple docstring''' import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met cl...
237
1
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowerCAmelCase : List[str] ={ "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
237
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int | float | str ): try: A__ = float(_lowerCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) A__ = decimal - int(_lowerCamelCase ) ...
237
1
'''simple docstring''' import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subproce...
237
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as...
237
1
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_R...
237
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testi...
237
1
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu,...
237
'''simple docstring''' from __future__ import annotations import time import numpy as np __lowerCAmelCase : Optional[Any] =[8, 5, 9, 7] __lowerCAmelCase : Optional[int] =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __lowerCAmelCase : List[...
237
1
'''simple docstring''' from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def UpperCamelCase ( _lowerCamelCase : int ): # A local function to see if a dot lands in the circle. def is_in_circle(_lowerCame...
237
'''simple docstring''' from __future__ import annotations class UpperCAmelCase : def __init__( self :Optional[int] , lowercase_ :int )-> None: A__ = order # a_{0} ... a_{k} A__ = [1.0] + [0.0] * order # b_{0} ... b_{k} A__ = [...
237
1
'''simple docstring''' from __future__ import annotations import typing from collections.abc import Iterable import numpy as np __lowerCAmelCase : List[str] =typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 __lowerCAmelCase : List[Any] =typing.Union[np.floataa, int, floa...
237
'''simple docstring''' import warnings warnings.warn( "memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: " "`from accelerate import find_executable_batch_size` to avoid this warning.", FutureWarning, )
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : int ): A__ = word.split() def justify(_lowerCamelCase : list , _lowerCamelCase : int , _lowerCamelCase : int ) ->...
237
'''simple docstring''' import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class UpperCAmelCase ( Uppe...
237
1
'''simple docstring''' from string import ascii_lowercase, ascii_uppercase def UpperCamelCase ( _lowerCamelCase : str ): if not sentence: return "" A__ = dict(zip(_lowerCamelCase , _lowerCamelCase ) ) return lower_to_upper.get(sent...
237
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCAmelCase ( UpperCamelCase__ ): __...
237
1
'''simple docstring''' import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester ...
237
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requi...
237
1
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. __lowerCAmelCase : str =200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of t...
237
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
237
1
'''simple docstring''' import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput __lowerCAmelCase : str =logging.getLogger(__name__) if is_torch_t...
237
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp...
237
1
'''simple docstring''' import argparse __lowerCAmelCase : Optional[int] ="docs/source/_static/js/custom.js" def UpperCamelCase ( _lowerCamelCase : List[Any] ): with open(_lowerCamelCase , encoding="utf-8" , newline="\n" ) as f: A...
237
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from tor...
237
1
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class UpperCAmelCase ( unittest.TestCase ): def UpperCAmelCase_ ( self :List[Any] )-> Optional[int]: A__ = [ "safety_checker/pytorc...
237
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
1
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def UpperCamelCase ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase ...
237
'''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 ( ...
237
1
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ta impor...
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate....
237
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowerCAmelCase : List[str] ={ "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
237
1
'''simple docstring''' from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_visi...
237
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Any =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402...
237
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, get_resize_output_image_size, normalize, rescale, resize, to_chan...
237
'''simple docstring''' # 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...
237
1
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as...
237
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def UpperCamelCase ( _lowerCamelCase : list[list[float]] ): A__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
237
1
'''simple docstring''' import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging __lowerCAmelCase : Any =logging.get_logger(__name__) class UpperCAmelCase ( UpperCamelC...
237
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""note_seq"""] def __init__( self :Optional[Any] , *lowercase_ :List[Any] , **lowercase_ :List[str] ...
237
1
'''simple docstring''' import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __lowerCAmelCase : List[Any] =g...
237
'''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.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controln...
237
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""speech"""] def __init__( self :Optional[Any] , *lowercase_ :int , **lowercase_ :List[str] )-> ...
237
'''simple docstring''' import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met cl...
237
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer __lowerCAmelCase : List[str] =logging.get...
237
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int | float | str ): try: A__ = float(_lowerCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) A__ = decimal - int(_lowerCamelCase ) ...
237
1
'''simple docstring''' import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTe...
237
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as...
237
1
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : list[str] | None = None , _lowerCamelCase : dict[str, float] | None = None , _lowerCamelCase : bool = False...
237
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testi...
237
1
'''simple docstring''' import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCAmelCase : List[Any] =logging.get_logger(__name__) __lowerCAmelCase : List[Any] ={ "vo...
237
'''simple docstring''' from __future__ import annotations import time import numpy as np __lowerCAmelCase : Optional[Any] =[8, 5, 9, 7] __lowerCAmelCase : Optional[int] =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __lowerCAmelCase : List[...
237
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tenso...
237
'''simple docstring''' from __future__ import annotations class UpperCAmelCase : def __init__( self :Optional[int] , lowercase_ :int )-> None: A__ = order # a_{0} ... a_{k} A__ = [1.0] + [0.0] * order # b_{0} ... b_{k} A__ = [...
237
1
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging __lowerCAmelCase : Tupl...
237
'''simple docstring''' import warnings warnings.warn( "memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: " "`from accelerate import find_executable_batch_size` to avoid this warning.", FutureWarning, )
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : list[int] ): A__ = len(_lowerCamelCase ) for i in range(_lowerCamelCase ): for j in range(i + 1 , _lowerCamelCase ): if numbers[j] < numbers[i]: ...
237
'''simple docstring''' import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class UpperCAmelCase ( Uppe...
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : bool = False ): if not isinstance(_lowerCamelCase , _lowerCamelCase ): A__ = F"Expected string as input, found {type(_lowerCamelCase )}" ...
237
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCAmelCase ( UpperCamelCase__ ): __...
237
1
'''simple docstring''' import cmath import math def UpperCamelCase ( _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCase : float ): A__ = math.radians(_lowerCamelCase ...
237
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requi...
237
1
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMi...
237
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
237
1
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accele...
237
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp...
237
1
'''simple docstring''' import os from math import logaa def UpperCamelCase ( _lowerCamelCase : str = "base_exp.txt" ): A__ = 0 A__ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(_lowerCamelCase ) , _lowerCamelCase ) ...
237
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from tor...
237
1
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def UpperCamelCase ( _lowerCamelCase : list[list[float]] ): A__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
237
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
1
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( ...
237
'''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 ( ...
237
1
'''simple docstring''' import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class UpperCAmelCase ( UpperCamelCase__ ): __lowercase = """Speech2TextFeatureExtractor""" __lowercase = """Speech2TextTokenizer""" def __init__( self...
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
'''simple docstring''' import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __lowerCAmelCase : Optional[Any] =argparse.ArgumentParser("Stable Diffusion script with intel optimization", add_help=False) parser...
237
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowerCAmelCase : List[str] ={ "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
237
1
'''simple docstring''' import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __lowerCAmelCase : List[Any] =get_logger(__name__) class UpperCAmelCase ( enum.Enum ): __lowercase = """all_checks""" __l...
237
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Any =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402...
237
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Optional[int] =logging.get_logger(__name__) __lowerCAmelCase : Optional[Any] ={ "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-sm...
237
'''simple docstring''' # 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...
237
1
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from...
237
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def UpperCamelCase ( _lowerCamelCase : list[list[float]] ): A__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
237
1
'''simple docstring''' import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.sp...
237
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""note_seq"""] def __init__( self :Optional[Any] , *lowercase_ :List[Any] , **lowercase_ :List[str] ...
237
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 transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers...
237
'''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.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controln...
237
1
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCa...
237
'''simple docstring''' import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met cl...
237
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase : List[str] ={ "configuration_squeezebert": [ "SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Squeeze...
237
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int | float | str ): try: A__ = float(_lowerCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) A__ = decimal - int(_lowerCamelCase ) ...
237
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor __lowerCAmelCase : Optional[Any] =logging.get_logger(__name__) class UpperCAmelCase ( UpperCamelCase__ ): def __init__( self :Any , ...
237
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as...
237
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCAmelCase : Tuple =logging.get_logger(__name__) __lowerCAmelCase : List[Any] ={ ...
237
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testi...
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : list ): if any(not isinstance(_lowerCamelCase , _lowerCamelCase ) or x < 0 for x in sequence ): raise TypeError("Sequence must be list of non-negative integers" ) for _ in range...
237
'''simple docstring''' from __future__ import annotations import time import numpy as np __lowerCAmelCase : Optional[Any] =[8, 5, 9, 7] __lowerCAmelCase : Optional[int] =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __lowerCAmelCase : List[...
237
1
'''simple docstring''' import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCAmelCase : str =logging.get_logger(__name__) __lowerCAmelCase : int ="...
237
'''simple docstring''' from __future__ import annotations class UpperCAmelCase : def __init__( self :Optional[int] , lowercase_ :int )-> None: A__ = order # a_{0} ... a_{k} A__ = [1.0] + [0.0] * order # b_{0} ... b_{k} A__ = [...
237
1
'''simple docstring''' import argparse import collections import json import os import re import string import sys import numpy as np __lowerCAmelCase : int =re.compile(R"\b(a|an|the)\b", re.UNICODE) __lowerCAmelCase : List[str] =None def UpperCamelCase ( ): A__ = ...
237
'''simple docstring''' import warnings warnings.warn( "memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: " "`from accelerate import find_executable_batch_size` to avoid this warning.", FutureWarning, )
237
1
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): A__ = [] create_all_state(1 , _lowerCamelCase , _lowerCamelCase , [] , _low...
237
'''simple docstring''' import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class UpperCAmelCase ( Uppe...
237
1
'''simple docstring''' import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data im...
237
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCAmelCase ( UpperCamelCase__ ): __...
237
1
'''simple docstring''' from __future__ import annotations from cmath import sqrt def UpperCamelCase ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : int ): if a == 0: raise ValueError("Coefficient 'a' must no...
237
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requi...
237
1
'''simple docstring''' import os # Precomputes a list of the 100 first triangular numbers __lowerCAmelCase : int =[int(0.5 * n * (n + 1)) for n in range(1, 101)] def UpperCamelCase ( ): A__ = os.path.dirname(os.path.realpath(_lowerCamelCase ) ) A__ = os....
237
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
237
1
'''simple docstring''' from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_sing...
237
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp...
237
1
'''simple docstring''' import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase fro...
237
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from tor...
237
1
'''simple docstring''' __lowerCAmelCase : dict[str, float] ={ "km/h": 1.0, "m/s": 3.6, "mph": 1.609344, "knot": 1.852, } __lowerCAmelCase : dict[str, float] ={ "km/h": 1.0, "m/s": 0.277777778, "mph": 0.621371192, "knot": 0.539956803, } def UpperCamelCas...
237
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
1
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union __lowerCAmelCase : int =TypeVar("T") __lowerCAmelCase : str =Union[List[T], Tuple[T, ...]] __lowerCAmelCase : Dict =Union[T, List[T], Dict[str, T]] __lowerCAmelCase : Tuple =Union[str, bytes, ...
237
'''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 ( ...
237
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging __lowerCAmelCase : List[Any] ...
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from...
237
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowerCAmelCase : List[str] ={ "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
237
1
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : int =logging.get_logger(__name__) __lowerCAmelCase : Union[str, Any] ={ "BridgeTower/bridgetower-base": "https://huggin...
237
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Any =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402...
237
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
237
'''simple docstring''' # 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...
237
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor __lowerCAmelCase : Dict =logging.get_logger(__name__) class UpperCAmelCase ( UpperCamelCase__ ): def __init__( self :List[Any] , *lowercase_ ...
237
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def UpperCamelCase ( _lowerCamelCase : list[list[float]] ): A__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
237
1
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str = "cpu" , _lowerCamelCase : Union[str, None] = None ): A__ = torch.lo...
237
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""note_seq"""] def __init__( self :Optional[Any] , *lowercase_ :List[Any] , **lowercase_ :List[str] ...
237
1
'''simple docstring''' import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.trai...
237
'''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.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controln...
237
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase : Dict ={ "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
237
'''simple docstring''' import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met cl...
237
1
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSe...
237
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int | float | str ): try: A__ = float(_lowerCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) A__ = decimal - int(_lowerCamelCase ) ...
237
1
'''simple docstring''' 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 sta...
237
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as...
237
1
'''simple docstring''' import math class UpperCAmelCase : def UpperCAmelCase_ ( self :int , lowercase_ :list[list[float]] , lowercase_ :list[int] )-> int: A__ = 0.0 A__ = 0.0 for i in range(len(lowercase_ ) ...
237
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testi...
237
1
'''simple docstring''' from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMi...
237
'''simple docstring''' from __future__ import annotations import time import numpy as np __lowerCAmelCase : Optional[Any] =[8, 5, 9, 7] __lowerCAmelCase : Optional[int] =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __lowerCAmelCase : List[...
237
1
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp...
237
'''simple docstring''' from __future__ import annotations class UpperCAmelCase : def __init__( self :Optional[int] , lowercase_ :int )-> None: A__ = order # a_{0} ... a_{k} A__ = [1.0] + [0.0] * order # b_{0} ... b_{k} A__ = [...
237
1
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf f...
237
'''simple docstring''' import warnings warnings.warn( "memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: " "`from accelerate import find_executable_batch_size` to avoid this warning.", FutureWarning, )
237
1
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilB...
237
'''simple docstring''' import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class UpperCAmelCase ( Uppe...
237
1
'''simple docstring''' import warnings warnings.warn( "memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: " "`from accelerate import find_executable_batch_size` to avoid this warning.", FutureWarning, )
237
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCAmelCase ( UpperCamelCase__ ): __...
237
1
'''simple docstring''' def UpperCamelCase ( _lowerCamelCase : int , _lowerCamelCase : float , _lowerCamelCase : float ): return round(float(moles / volume ) * nfactor ) def UpperCamelCase ( _lowerCamelCase ...
237
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requi...
237
1
'''simple docstring''' import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_fl...
237
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
237
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 accele...
237
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp...
237
1
'''simple docstring''' import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class UpperCAmelCase ( UpperCamelCase__...
237
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from tor...
237
1
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Any =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402...
237
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
1
'''simple docstring''' from __future__ import annotations import time import numpy as np __lowerCAmelCase : Optional[Any] =[8, 5, 9, 7] __lowerCAmelCase : Optional[int] =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __lowerCAmelCase : List[...
237
'''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 ( ...
237
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase : Optional[int] ={ "configuration_jukebox": [ "JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP", "JukeboxConfig", "JukeboxPrio...
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase : Union[str, Any] ={"c...
237
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowerCAmelCase : List[str] ={ "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
237
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCAmelCase : List[str] ={ "configuration_chinese_clip": [ "CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "ChineseCL...
237
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __lowerCAmelCase : Any =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402...
237
1
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase : Optional[int] =logging.get_logger(__name__) __l...
237
'''simple docstring''' # 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...
237
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { "facebook/timesformer": "https://huggingface.co/facebook/timesformer/resolve/main/config.json", } class lowercas...
0
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def UpperCamelCase ( _lowerCamelCase : list[list[float]] ): A__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
237
0