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
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_backbone_common i...
101
'''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
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _UpperCAmelCase ( unit...
102
'''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
0
from collections.abc import Sequence def UpperCamelCase( __UpperCamelCase : Sequence[float] ,__UpperCamelCase : bool = False ): if not arr: return 0 lowerCAmelCase_ : Tuple = 0 if allow_empty_subarrays else float('''-inf''' ) lowerCAmelCase_ : Optional[Any] ...
103
'''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
0
'''simple docstring''' import argparse import gc import json import os 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...
104
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
0
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] ) ->Optional[Any]: '''simple docstring''' if "model" in orig_key: a ...
105
'''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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) __UpperCamelCase : Union[str, Any] = {'''configuration_beit''': ['''BEIT_PRETRAINED_C...
106
'''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
0
from math import sqrt def __magic_name__ ( A : int ): '''simple docstring''' a = 0 for i in range(1, int(sqrt(A ) + 1 ) ): if n % i == 0 and i != sqrt(A ): total += i + n // i elif i == sqrt(A ): total += i return total - n ...
107
'''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
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils...
108
'''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
0
"""simple docstring""" from typing import Dict, List, Optional, Tuple, 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_...
109
'''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
0
from string import ascii_uppercase _lowerCAmelCase : Any = {str(ord(c) - 55): c for c in ascii_uppercase} def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : int ) -> Dict: if isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeErro...
300
'''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
"""simple docstring""" class SCREAMING_SNAKE_CASE__ : def __init__( self : List[str] ): lowerCAmelCase = {} def __lowercase ( self : Optional[int] ): print(self.vertex ) for i in self.vertex: pri...
155
'''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
0
"""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_visio...
100
'''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
0
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split lowercase_ = datasets.load_iris() lowercase_ = np.array(data['data']) lowercase_ = np.array(data['target']) lowercase_ = data["tar...
205
'''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
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A =logging.get_logger(__name__) A ={ "google/switch-base-8": "https://huggingface.co/google/switch-base-8/blob/main/config.json", } class _a ( UpperCamelCase__ ): __a : ...
34
'''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
0
"""simple docstring""" from __future__ import annotations class UpperCamelCase : def __init__( self ,__UpperCamelCase ) -> None: '''simple docstring''' lowercase_ : int = order # a_{0} ... a_{k} lowercase_ : Optional[Any] ...
213
'''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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase = {"configuration_yolos": ["YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP", "YolosConfig", "YolosOnnxConfig"]} try: ...
126
'''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
0
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device _a : Dict = False class __A ( unittest.Te...
44
'''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
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCAmelCase ( UpperCamelCase__ ): UpperCAmelCase__ = ["""image_processor""", """tokenizer"""] UpperCAmelCase__ = """CLIPImageProcessor""" Upper...
50
'''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
0
"""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 Se...
16
'''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
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: Tuple =Decimal # Check if the provided matrix has 2 rows and 2 columns # since this imple...
173
'''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
0
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", "LxmertConfig"...
300
'''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
0
"""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 fro...
155
'''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
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from...
100
'''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
0
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.spectrogram_diffu...
205
'''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
0
'''simple docstring''' import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuratio...
34
'''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
0
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def lowercase__( __SCREAMING_SNAKE_CASE : str ): for param in module.parameters(): lowercase_ : str = False def lowercase__( ): lowercase_ :...
213
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase = {"configuration_vit": ["VIT_PRETRAINED_CON...
126
'''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
0
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE ( _lowerCamelCase : list[float] ,_lowerCamelCase : list[float] ) -> Dict: _lowerCAmelCase : Dict = sorted(numsa + numsa ) _lowerCAmelCase , _lowerCAmelCase...
44
'''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
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCAmelCase ( UpperCamelCase__ ): UpperCAmelCase__ = """Speech2TextFeatureExtractor""" UpperCAmelCase__ = """Speech2TextTokenizer""" def __init__( self ...
50
'''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
0
"""simple docstring""" import argparse lowerCAmelCase_ = "docs/source/_static/js/custom.js" def __UpperCAmelCase ( __lowerCamelCase ) -> Dict: with open(_lowerCamelCase , encoding='''utf-8''' , newline='''\n''' ) as f: lowerc...
16
'''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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "caidas/swin2sr-classicalsr-x2-64": ( "https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolve/main/confi...
173
'''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
0
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _lowerCAmelCase : Optional[Any] = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def __snake_case ( _lowerCAmelCase : str = "mumbai" ) -...
300
'''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
"""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 a = logging.ge...
155
'''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
0
"""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 fro...
100
'''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
0
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger lowercase_ = get_logger(__name__) class __lowerCAmelCase ( enum.Enum ): _a = """all_checks""" _a = """basic_check...
205
'''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
0
'''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 A =logging.getLogger(__name__) if is_torch_tpu_available(check_d...
34
'''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
0
"""simple docstring""" from bisect import bisect from itertools import accumulate def lowercase__( __SCREAMING_SNAKE_CASE : Union[str, Any] , __SCREAMING_SNAKE_CASE : Tuple , __SCREAMING_SNAKE_CASE : Tuple , __SCREAMING_SNAKE_CASE : Any )...
213
'''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
0
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: lowerCAmelCase = None try: import msvcrt except ImportError: lowerCAmelCase = None try: import fcntl except Import...
126
'''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
0
"""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 ...
44
'''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
0
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, infer_...
50
'''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
0
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_...
16
'''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
0
"""simple docstring""" import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...im...
173
'''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
0
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, AutoModelForSeqaSeqLM, AutoTokeniz...
300
'''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
0
"""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 imp...
155
'''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
0
"""simple docstring""" def _lowerCAmelCase ( UpperCamelCase_ , UpperCamelCase_ , UpperCamelCase_ ): return round(float(moles / volume ) * nfactor ) def _lowerCAmelCase ( UpperCamelCase_ , UpperCamelCase_ , UpperCamelCase_ ): return round(float((moles * 0....
100
'''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
0
def a ( A__ : list[int] ) -> Union[str, Any]: """simple docstring""" _lowercase =len(_lowerCamelCase ) for i in range(_lowerCamelCase ): for j in range(i + 1 , _lowerCamelCase ): if numbers[j] < ...
205
'''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
0
'''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 ...
34
'''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
0
"""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 ...
213
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
0
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ...
126
'''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
0
"""simple docstring""" def SCREAMING_SNAKE_CASE ( _lowerCamelCase : list ) -> int: _lowerCAmelCase : str = False while is_sorted is False: # Until all the indices are traversed keep looping _lowerCAmelCase : Optional[Any] = True f...
44
'''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
0
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.test_utils import requir...
50
'''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
0
"""simple docstring""" import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline lowerCAmelCase_ = argparse.ArgumentParser('Stable Diffusion script with intel optimization', add_help=Fal...
16
'''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
0
"""simple docstring""" import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class a ( UpperCamelCase__ ): @require_torch def lowerCamelCase__ ( self : ...
173
'''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
0
import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version _lowerCAmelCase : Dict ...
300
'''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
"""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....
155
'''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
0
"""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, DistilBe...
100
'''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
0
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, )
205
'''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
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A =logging.get_logger(__name__) A ={ "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), # See al...
34
'''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
0
"""simple docstring""" from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffus...
213
'''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
0
"""simple docstring""" import os def lowerCAmelCase_ ( ) ->Optional[Any]: with open(os.path.dirname(_lowerCamelCase ) + '/grid.txt' ) as f: lowerCamelCase__ : int =[] # noqa: E741 for _ in range(2_0 ): l.append([int(_lowerCamelCase ) for ...
126
'''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
0
"""simple docstring""" from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer from .base import PipelineTool _a : Optional[Any] = { "Acehnese Arabic": "ace_Arab", "Acehnese Latin": "ace_Latn", "Mesopotamian Arabic": "acm_Arab", "Ta'izzi-Adeni Arabic": "acq_Arab", "Tun...
44
'''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
0
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo _UpperCAmelCase : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={...
50
'''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
0
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase = 1_00 ) -> str: lowercase__ : Dict = 0 lowercase__ : Optional[int] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints*...
16
'''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
0
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_par...
173
'''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
0
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 from tokenizers import pre_toke...
300
'''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
0
"""simple docstring""" from __future__ import annotations def lowercase (snake_case__ : int , snake_case__ : int ) -> Any: '''simple docstring''' lowerCAmelCase = [] create_all_state(1 , _lowerCamelCase , ...
155
'''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
0
"""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....
100
'''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
0
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 from ...utils imp...
205
'''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
0
'''simple docstring''' A ={ "km/h": 1.0, "m/s": 3.6, "mph": 1.609_344, "knot": 1.852, } A ={ "km/h": 1.0, "m/s": 0.277_777_778, "mph": 0.621_371_192, "knot": 0.539_956_803, } def snake_case_ (_a : float , _a : str , _a : s...
34
'''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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __SCREAMING_SNAKE_CASE ={ "configuration_wav2vec2": ["WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "W...
213
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
0
"""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, TrainingJ...
126
'''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
0
"""simple docstring""" def SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 10**12 ) -> Dict: _lowerCAmelCase : Any = 1 _lowerCAmelCase : Optional[Any] = 0 _lowerCAmelCase : Tuple = 1 _lowerCAmelCase : int ...
44
'''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
0
from ..utils import DummyObject, requires_backends class lowerCAmelCase ( metaclass=UpperCamelCase__ ): UpperCAmelCase__ = ["""note_seq"""] def __init__( self : Optional[Any] , *UpperCAmelCase : List[Any] , **UpperCAmelCase : List[str] ) -> int: ...
50
'''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
0
"""simple docstring""" import copy from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCA...
16
'''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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase = { "configuration_whisper": ["WHISPER_PRE...
173
'''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
0
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, require_tf, require_torch fro...
300
'''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
"""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 TFModelTes...
155
'''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
0
"""simple docstring""" import socket def _lowerCAmelCase ( ): __SCREAMING_SNAKE_CASE = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __SCREAMING_SNAKE_CASE = socket.gethostname() __SCREAMING_SNAKE_CASE = 1_2312 sock.connect((host, port) ) ...
100
'''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
0
def a ( A__ : int ) -> Any: """simple docstring""" return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def a ( A__ : int ) -> Optional[Any]: """simple docstring""" _lowercase =0 ...
205
'''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
0
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def snake_case_ (_a : Optional[int] , _a : Optional[Any]=1 ): if n_shave_prefix_segments >= 0: return ".".join(path.split...
34
'''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
0
"""simple docstring""" def lowercase__( __SCREAMING_SNAKE_CASE : bytes ): return "".join([hex(_lowerCamelCase )[2:].zfill(2 ).upper() for byte in list(_lowerCamelCase )] ) def lowercase__( __SCREAMING_SNAKE_CASE : str ): # Check dat...
213
'''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
0
"""simple docstring""" from __future__ import annotations import time import numpy as np lowerCAmelCase = [8, 5, 9, 7] lowerCAmelCase = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] lowerCAmelCase = [ [3, 2,...
126
'''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
0
"""simple docstring""" from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def SCREAMING_SNAKE_CASE ( _lowerCamelCase : int ) -> str: # A local function to see if a dot lands in the circle. def is_in_circl...
44
'''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
0
_UpperCAmelCase : Optional[int] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def SCREAMING_SNAKE_CASE ( ) -> List[Any]: lowerCamelCase__ : Optional[Any] = input('Enter message: ' ) lowerCamelCase__ : List[Any] = input('Enter key [alphanumeric]: ' ) ...
50
'''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
0
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase = None , __lowerCamelCase = None , __lowerCamelCase = False , ) -> Union[str, Any]: lowercase__ : Optiona...
16
'''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
0
"""simple docstring""" class a : def __init__( self : Any ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE_: Optional[Any] =0 SCREAMING_SNAKE_CASE_: List[str] =0 SCREAMING_SNAKE_CASE_: int ={} def l...
173
'''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
0
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : int , _lo...
300
'''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
0
"""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 ...
155
'''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
0
"""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_...
100
'''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
0
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 __lowerCAmelCase ( UpperCame...
205
'''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
0
'''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 num...
34
'''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
0
"""simple docstring""" 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 __SCREAMING_SNAKE_CASE =logging.get_logger(__name__) __SCREAMING_SNAKE_...
213
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
0
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require...
126
'''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
0
"""simple docstring""" from __future__ import annotations from math import gcd def SCREAMING_SNAKE_CASE ( _lowerCamelCase : int ,_lowerCamelCase : int = 2 ,_lowerCamelCase : int = 1 ,_lowerCamelCase : int = 3 ,) -> Union[str, Any]: ...
44
'''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
0
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) class lowerCAmelCase ( UpperCamelCase__ ): def __init__( self : Any , *UpperCAmelCase :...
50
'''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
0
"""simple docstring""" 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 T...
16
'''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
0
"""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, ) _UpperCAmelCase = {"configurat...
173
'''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
0
from typing import List import numpy as np def __snake_case ( _lowerCAmelCase : dict ) -> List[Any]: A_ : str = {key: len(_lowerCamelCase ) for key, value in gen_kwargs.items() if isinstance(_lowerCamelCase , _lowerCamelCase )} if len(set(lists_lengths.values() ) )...
300
'''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
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar a = TypeVar('T') a = TypeVar('U') class SCREAMING_SNAKE_CASE__ ( Generic[T, U] ): def __init__( self : Dict...
155
'''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
0
"""simple docstring""" from __future__ import annotations def _lowerCAmelCase ( UpperCamelCase_ ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def _lowerCAmelCase ( UpperCamelCase_ , UpperCamelCase_ , ...
100
'''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
0