code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass cla...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int , _lowercase : bool , _lowercase : list[int] , _lowercase : float ) ->Optional[int]: '''simple docstring''' ...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : Union[str, Any] , _lowercase : Any ) ->Optional[Any]: '''simple docstring''' a : Union[str, Any] = "" for i in table: res += inp[i - 1] return res def...
721
"""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, ) if is_sentencepiece_...
31
0
"""simple docstring""" from typing import Dict, Iterable, Optional, 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, to_pil_image from ...im...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" # This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def _SCR...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixi...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseMod...
703
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->str: '''simple docstring''' a : str = 0 # if input_string is "aba" than new_input_string become "a|b|a" a : List[str] = "" a : Tuple = "" #...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" import json import os from ...utils.constants import SAGEMAKER_PARALLEL_EC2_INSTANCES, TORCH_DYNAMO_MODES from ...utils.dataclasses import ComputeEnvironment, SageMakerDistributedType from ...utils.imports import is_botoa_available from .config_args import SageMakerCon...
706
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
31
0
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger a : Tuple = '''<<<<<<< This should probably be modified because it mentions: ''' a : List[Any] ...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : str = 100_0000 ) ->Optional[int]: '''simple docstring''' a : Optional[int] = limit + 1 a : Dict = [0] * limit for first_term in range(1 , _lowercase ): f...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def _SCREAMING_SNAKE_CA...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcess...
710
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" a : Optional[Any] = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import VerificationMode from .logging import...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 1000 ) ->int: '''simple docstring''' a : Union[str, Any] = 2**power a : Any = str(__snake_case ) a : Tuple = list(__snake_case ) a : st...
712
"""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 imp...
31
0
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __UpperCamelCase ( __lowercase ): lowerCamelCase : List[str] =(EulerDiscrete...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def _SCREAMING_SNAKE_CASE ( _lowercase : List[Any] , _lowercase : Optional[Any] , _lowercase : Any ) ->int: '''simple docstring''' ...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : Dict = { '''configuration_bigbird_pegasus''': [ '''BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BigBirdP...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor ...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Union[str, Any] = { '''configuration_convbert''': ['''CON...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""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 GradientSt...
718
"""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_...
31
0
import math class __UpperCamelCase : def __init__( self , lowerCAmelCase__=0 ) -> Tuple: # a graph with Node 0,1,...,N-1 a : int = n a : Union[str, Any] = [ [math.inf for j in range(0 , A__ )] for ...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_ava...
721
"""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, ) if is_sentencepiece_...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] , _lowercase : Tuple ) ->Optional[int]: '''simple docstring''' return number | (1 << position) def _SCREAMING_SNAKE_CASE ( _lowercase : str , _...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig a : Union[str, Any] = logging.get_logger(__name__) a : Dict = { '''Intel/dpt-large''': '''https://huggingface.co/Intel/dp...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] = 50 ) ->int: '''simple docstring''' a : str = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_len...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->Optional[int]: '''simple docstring''' while second != 0: a : List[str] = first & second first ^= second a : str = c << 1 r...
703
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""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: F40...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a : str = logging.get_logger(__name__) a : Dict = { '''nielsr/canine-s''': 2048, } # Unicode def...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. a : Any = 10 def _SCREAMING_SNAKE_CASE ( _lowercase : A...
706
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
31
0
def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] = 100_0000 ) ->Any: '''simple docstring''' a : List[Any] = limit + 1 a : Dict = [0] * limit for first_term in range(1 , _snake_case ): for n in range(_snake_case , _sn...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""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: F40...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" from collections import deque def _SCREAMING_SNAKE_CASE ( _lowercase : Union[str, Any] ) ->Optional[int]: '''simple docstring''' a : Any = len(A_ ) a : str = deque() a : List[str] = ...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel a : str = HfApi() a : List[str] = {} # fmt: off a : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
710
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
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, Vi...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" class __UpperCamelCase : def __init__( self , lowerCAmelCase__ ) -> Optional[Any]: a : Optional[int] = arr.split("," ) def __a ( self ) -> Tuple: a : Union[str...
712
"""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 imp...
31
0
"""simple docstring""" import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_ava...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : Any ) ->str: '''simple docstring''' if isinstance(a__ , a__ ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(a__ , a__ ): ...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from ...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : int = logging.get_logger(__name__) a : int = { 'facebook...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : Union[str, Any] ) ->list: '''simple docstring''' if n_term == "": return [] a : list = [] for temp in range(int(_lowercase ) ): series.append(F"""1/{temp + 1}""" if se...
718
"""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_...
31
0
from copy import deepcopy class __UpperCamelCase : def __init__( self , lowerCAmelCase__ = None , lowerCAmelCase__ = None ) -> int: if arr is None and size is not None: a : Dict = size a : Any = [0] *...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
import colorsys from PIL import Image # type: ignore def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float , _lowercase : int ) ->Dict: '''simple docstring''' a : Any = x a : int = y for st...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If u...
721
"""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, ) if is_sentencepiece_...
31
0
"""simple docstring""" import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate i...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : int ) ->Dict: '''simple docstring''' a : Optional[int] = u for i in range(1 , lowerCam...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class __UpperCamelCase : def __init__( self , lowerCAmelCase__=2 , lowerCAmelCase__=3 , ...
703
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : str , _lowercase : List[Any] ) ->Optional[Any]: '''simple docstring''' a : Dict = word.split() def justify(_lowercase : Optional[Any] , _lowercase : in...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __UpperCamelCase ( __lowercase ): lowerCamelCase : Optional[Any] =(DDPMScheduler,) def __a ( s...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_f...
706
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
31
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a : int = logging.get_logger(__name__) a : str = { '''google/vivit-b-16x2-kinetics400''': ( '''https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json''' ...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_files...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Tuple = { '''configuration_nezha''': ['''NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NezhaConfig'''], } tr...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" # This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTe...
710
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] = 2 ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Optional[int] = qubits # Using Aer's simulator a : Dict = ...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf ...
712
"""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 imp...
31
0
"""simple docstring""" from math import sqrt def _SCREAMING_SNAKE_CASE ( _lowercase : Union[str, Any] ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepie...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a : Optional[int] = logging.get_logger(__name__) a : Tuple = { '''google/realm-cc-news-pretrained-embedder''': ( '''https://huggingface.co/google/real...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""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_mobilebert import MobileBertTokenizer a : List[str] = ...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset a : List[str] = {1: (1, 1), 2: (2, 1), 3: (3, 1)...
718
"""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_...
31
0
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore a : Optional[int] = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" a : Dict = [file for file in file...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onn...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" from statistics import mean, stdev def _SCREAMING_SNAKE_CASE ( _lowercase : list , _lowercase : int = 3 ) ->Any: '''simple docstring''' a : Dict = min(_lowercase ) a : Any = max(_lo...
721
"""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, ) if is_sentencepiece_...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) a : Optional[Any] = { '''configuration_layoutlmv2''': ['...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 400_0000 ) ->int: '''simple docstring''' a : Optional[Any] = [] a : int = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(_lowercase ) a : Any ...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" a : Optional[Any] = [ '''Audio''', '''Array2D''', '''Array3D''', '''Array4D''', '''Array5D''', '''ClassLabel''', '''Features''', '''Sequence''', '''Value''', '''Image''', '''Translation''', '''TranslationV...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : str , _lowercase : int ) ->str: '''simple docstring''' a : list[list[str]] = [[] for _ in range(_lowercase )] a : Dict = key - 1 if key <= 0: rais...
703
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": a : Optional[Any] = argparse.ArgumentParser( description=( '''Extraction some layers of the full RobertaForMaskedLM ...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : str = "The quick brown fox jumps over the lazy dog" , ) ->bool: '''simple docstring''' a : str = set() # Replace all the whitespace in our sentence a : str = input_...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' return round(float(moles / volume ) * nfactor ) def _SCRE...
706
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
31
0
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --host ...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py a : Optional[int] ...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" from __future__ import annotations import requests a : str = set( '''approved_at_utc approved_by author_flair_background_color author_flair_css_class author_flair_richtext author_flair_template_id author_fullname author_premium can_mod_post category clic...
710
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort a : str = '''1''' a : List[str] = '''0''' a : str = '''1''' a : List[Any] = ort.SessionOptions() a : List[Any] = ort.GraphOptimizationLeve...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[Any] = logging.get_logger(__name__) a : Dict = { '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/main/confi...
712
"""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 imp...
31
0
"""simple docstring""" import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a : Tuple = ...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class __UpperCamelCase : ...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" from __future__ import annotations from functools import lru_cache from math import ceil a : int = 100 a : str = set(range(3, NUM_PRIMES, 2)) primes.add(2) a : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime not in pri...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""simple docstring""" from __future__ import annotations import time a : Optional[Any] = list[tuple[int, int]] a : str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, ...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_d...
718
"""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_...
31
0
from __future__ import annotations from collections.abc import Generator def _SCREAMING_SNAKE_CASE ( ) ->Generator[int, None, None]: '''simple docstring''' a : dict[int, int] = {} a : Dict = 2 while True: a : Optional[Any] = ...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: 1 way to make 0 pence for co...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" from __future__ import annotations from typing import TypedDict class __UpperCamelCase ( a__ ): lowerCamelCase : str lowerCamelCase : int def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->list[st...
721
"""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, ) if is_sentencepiece_...
31
0
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int ) ->int: '''simple docstring''' if not isinstance(_lowercase , _lowercase ): raise TypeError("Input value must be an 'int' type" ) a : List[Any] = 0 while num...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import Seq...
703
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
31
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator class __UpperCamelCase : def __init__( self , lowerCAmelCase__ ) -> None: a : Dict = value a : Node | None = None...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def _SCREAMING_SNAKE_CASE ( _lowercase : jnp.ndarray , _lowercase : int , _lowercase : float = 1 , _lowercase : float = 1 , _lowercase : float = 1.0E4 ...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel a : Optional[Any] = False a : List[Any] = True a : List[Any] = False i...
706
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
31
0
import argparse import os import subprocess from packaging.version import Version, parse from accelerate.commands.config.config_args import default_config_file, load_config_from_file a : Optional[int] = '''Run commands across TPU VMs for initial setup before running `accelerate launc...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : list[list] ) ->list[list]: '''simple docstring''' a : Union[str, Any] = current_set.copy() for row_index, row in enumerate(_lowercase ): a : Optional[int] = ro...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0