code stringlengths 82 54.1k | code_codestyle int64 0 699 | style_context stringlengths 111 35.6k | style_context_codestyle int64 0 699 | label int64 0 1 |
|---|---|---|---|---|
'''simple docstring'''
import inspect
import unittest
class _lowercase ( unittest.TestCase ):
'''simple docstring'''
def lowerCAmelCase__ ( self ) -> str:
'''simple docstring'''
try:
import diffusers # noqa: F401
except ... | 614 | '''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.ndarray , _A : np.ndarray , _A : float = 1e-12 , _A : int = 1_00 , ):
'''simple docstring'''
assert np.shape(_A )[0] == np.shape(_A )[1]
# Ensure proper dimensiona... | 614 | 1 |
'''simple docstring'''
import inspect
from typing import Optional, Union
import numpy as np
import PIL
import torch
from torch.nn import functional as F
from torchvision import transforms
from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,... | 614 | '''simple docstring'''
import math
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin
class _lowercase ( lowerCAmelCase ,low... | 614 | 1 |
'''simple docstring'''
from random import randint, random
def __UpperCamelCase( _A : int , _A : int , _A : int , _A : bool = False , _A : bool = False , _A : int = 5 , ):
'''simple docstring'''
UpperCAmelCase__ : ... | 614 | '''simple docstring'''
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from tra... | 614 | 1 |
'''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
EulerAncestralDiscreteScheduler,
LMSDiscreteScheduler,
P... | 614 | '''simple docstring'''
import baseaa
def __UpperCamelCase( _A : str ):
'''simple docstring'''
return baseaa.baaencode(string.encode('''utf-8''' ) )
def __UpperCamelCase( _A : bytes ):
'''simple docstring'''
return baseaa.baadecode(_A ).decode('''utf-8''... | 614 | 1 |
'''simple docstring'''
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available
from ...utils import OptionalDependencyNotAvailable
try:
if not (is_transformers_available() and is_torch_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
... | 614 | '''simple docstring'''
import logging
import re
import pytorch_quantization
import pytorch_quantization.nn as quant_nn
import torch
from pytorch_quantization import calib
from pytorch_quantization.tensor_quant import QuantDescriptor
UpperCamelCase__ : Optional[Any] = logging.getLogger(__name__)
Uppe... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : int ):
'''simple docstring'''
if number > 0:
raise ValueError('''input must be a negative integer''' )
UpperCAmelCase__ : str = len(bin(_A )[3:] )
UpperCAmelCase__ : Dict = bin(abs(_A ) - (1 << bin... | 614 | '''simple docstring'''
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ... | 614 | 1 |
'''simple docstring'''
from math import isqrt
def __UpperCamelCase( _A : int ):
'''simple docstring'''
return all(number % divisor != 0 for divisor in range(2 , isqrt(_A ) + 1 ) )
def __UpperCamelCase( _A : int = 10**6 ):
'''simple docstring'''
Upp... | 614 | '''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int , _A : int , _A : int ):
'''simple docstring'''
if (direction == 1 and array[indexa] > array[indexa]) or (
direction == 0 and array[in... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : str ):
'''simple docstring'''
UpperCAmelCase__ : Tuple = [0 for i in range(len(_A ) )]
# initialize interval's left pointer and right pointer
UpperCAmelCase__ , UpperCAmelCase__ : Optional[Any] = 0, 0
... | 614 | '''simple docstring'''
def __UpperCamelCase( _A : float , _A : list[float] ):
'''simple docstring'''
if discount_rate < 0:
raise ValueError('''Discount rate cannot be negative''' )
if not cash_flows:
raise ValueError('''Cash flows list cannot be empty''' )
U... | 614 | 1 |
'''simple docstring'''
from math import atan, cos, radians, sin, tan
from .haversine_distance import haversine_distance
UpperCamelCase__ : Dict = 637_8137.0
UpperCamelCase__ : int = 635_6752.31_4245
UpperCamelCase__ : str = 6_378_137
def __UpperCamelCase( _A ... | 614 | '''simple docstring'''
import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelFo... | 614 | 1 |
'''simple docstring'''
import re
import string
from collections import Counter
import sacrebleu
import sacremoses
from packaging import version
import datasets
UpperCamelCase__ : List[str] = '\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text ... | 614 | '''simple docstring'''
import argparse
import logging
import pickle
import random
import time
import numpy as np
from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging... | 614 | 1 |
'''simple docstring'''
import numpy as np
UpperCamelCase__ : Optional[int] = [
['a', 'b', 'c', 'd', 'e'],
['f', 'g', 'h', 'i', 'k'],
['l', 'm', 'n', 'o', 'p'],
['q', 'r', 's', 't', 'u'],
['v', 'w', 'x', 'y', 'z'],
]
class _lowercase :
'''simple docstring'''
... | 614 | '''simple docstring'''
from math import factorial, radians
def __UpperCamelCase( _A : float , _A : int = 18 , _A : int = 10 ):
'''simple docstring'''
UpperCAmelCase__ : int = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)
# Converti... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
import math
import random
from typing import Any
class _lowercase :
'''simple docstring'''
def __init__( self ) -> None:
'''simple docstring'''
UpperCAmelCase__ : list[Any] = []
... | 614 | '''simple docstring'''
import gc
import unittest
import torch
from parameterized import parameterized
from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
fro... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : int | float | str , _A : int | float | str ):
'''simple docstring'''
if nth_term == "":
return [""]
UpperCAmelCase__ : List[str] = int(_A )
UpperCAmelCase__ : ... | 614 | '''simple docstring'''
from typing import List, Optional, Union
import torch
from transformers import (
XLMRobertaTokenizer,
)
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDIMS... | 614 | 1 |
'''simple docstring'''
import warnings
from ...utils import is_sklearn_available, requires_backends
if is_sklearn_available():
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import fa_score, matthews_corrcoef
UpperCamelCase__ : Dict = (
'This metric will be removed from th... | 614 | '''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,
)
| 614 | 1 |
'''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 PretrainedConfig
from ...onnx... | 614 | '''simple docstring'''
# Note: if you intend to run this script make sure you look under scripts/fsmt/
# to locate the appropriate script to do the work correctly. There is a set of scripts to:
# - download and prepare data and run the conversion script
# - perform eval to get the best hparam into the config
# - gener... | 614 | 1 |
'''simple docstring'''
import argparse
import json
import torch
from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel
def __UpperCamelCase( _A : Any , _A : Union[str, Any]=1 ):
'''simple docstring'''
if n_shave_prefix_segments >= 0:
return ".".join(pat... | 614 | '''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast
from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky... | 614 | 1 |
'''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.array ):
'''simple docstring'''
return 1 / (1 + np.exp(-vector ))
def __UpperCamelCase( _A : np.array ):
'''simple docstring'''
return vector * sigmoid(1.7_0_2 * vector )
if __name__ ... | 614 | '''simple docstring'''
from __future__ import annotations
import unittest
from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
from typing import Any
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
pass
class _lowercase :
'''simple docstring'''
def __init__( self ,lowerCamelCase_ ) -> None:
... | 614 | '''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase__ : List[str] = logging.get_logger(__name__)
UpperCamelCase__ : str = {
... | 614 | 1 |
'''simple docstring'''
import gc
import unittest
import numpy as np
import torch
from torch.backends.cuda import sdp_kernel
from diffusers import (
CMStochasticIterativeScheduler,
ConsistencyModelPipeline,
UNetaDModel,
)
from diffusers.utils import randn_tensor, slow, torch_device
from diffusers.utils.te... | 614 | '''simple docstring'''
import os
from datetime import datetime as dt
from github import Github
UpperCamelCase__ : str = [
'good first issue',
'good second issue',
'good difficult issue',
'enhancement',
'new pipeline/model',
'new scheduler',
'wip',
]
def __UpperCamel... | 614 | 1 |
'''simple docstring'''
from functools import lru_cache
@lru_cache
def __UpperCamelCase( _A : int ):
'''simple docstring'''
if num < 0:
raise ValueError('''Number should not be negative.''' )
return 1 if num in (0, 1) else num * factorial(num - 1 )
if __name__ == "__main__... | 614 | '''simple docstring'''
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError
from transformers import AutoImageProcessor, ViTImageProcessor
from transformers.testing_utils import TOK... | 614 | 1 |
'''simple docstring'''
import sys
from typing import Tuple
import numpy as np
import torch
from PIL import Image
from torch import nn
from transformers.image_utils import PILImageResampling
from utils import img_tensorize
class _lowercase :
'''simple docstring'''
def __init__( self ... | 614 | '''simple docstring'''
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Sequence, Value
from .base import TaskTemplate
@dataclass(frozen=lowerCAmelCase )
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
UpperCAmelCase_ ... | 614 | 1 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCamelCase__ : int = logging.get_logger(__name__)
UpperCamelCase__ : Optional[int] = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'}
class _lo... | 614 | '''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
UpperCamelCase__ : str = {
'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'],
'processing_git': ['GitProcessor'... | 614 | 1 |
'''simple docstring'''
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError
from transformers import AutoImageProcessor, ViTImageProcessor
from transformers.testing_utils import TOK... | 614 | '''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.ndarray , _A : np.ndarray , _A : float = 1e-12 , _A : int = 1_00 , ):
'''simple docstring'''
assert np.shape(_A )[0] == np.shape(_A )[1]
# Ensure proper dimensiona... | 614 | 1 |
'''simple docstring'''
import os
import re
import unicodedata
from shutil import copyfile
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import is_torch_available, logging
if is_torch_availabl... | 614 | '''simple docstring'''
import math
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin
class _lowercase ( lowerCAmelCase ,low... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
from sys import maxsize
from typing import Generic, TypeVar
UpperCamelCase__ : Optional[Any] = TypeVar('T')
def __UpperCamelCase( _A : int ):
'''simple docstring'''
return (position - 1) // 2
def __UpperCamelCa... | 614 | '''simple docstring'''
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from tra... | 614 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
UpperCamelCase__ : List[str] = {
'configuration_groupvit': [
'GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP',
'GroupViTConfig',
... | 614 | '''simple docstring'''
import baseaa
def __UpperCamelCase( _A : str ):
'''simple docstring'''
return baseaa.baaencode(string.encode('''utf-8''' ) )
def __UpperCamelCase( _A : bytes ):
'''simple docstring'''
return baseaa.baadecode(_A ).decode('''utf-8''... | 614 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
UpperCamelCase__ : Union[str, Any] = {
'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'],
'tokenization_tap... | 614 | '''simple docstring'''
import logging
import re
import pytorch_quantization
import pytorch_quantization.nn as quant_nn
import torch
from pytorch_quantization import calib
from pytorch_quantization.tensor_quant import QuantDescriptor
UpperCamelCase__ : Optional[Any] = logging.getLogger(__name__)
Uppe... | 614 | 1 |
'''simple docstring'''
UpperCamelCase__ : Tuple = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n'
... | 614 | '''simple docstring'''
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ... | 614 | 1 |
'''simple docstring'''
from collections.abc import Iterable
from typing import Generic, TypeVar
UpperCamelCase__ : str = TypeVar('_T')
class _lowercase ( Generic[_T] ):
'''simple docstring'''
def __init__( self ,lowerCamelCase_ = None ) -> None:
... | 614 | '''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int , _A : int , _A : int ):
'''simple docstring'''
if (direction == 1 and array[indexa] > array[indexa]) or (
direction == 0 and array[in... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : list[int] , _A : list[int] , _A : list[list[str]] , _A : int , ):
'''simple docstring'''
UpperCAmelCase__ : Dict = le... | 614 | '''simple docstring'''
def __UpperCamelCase( _A : float , _A : list[float] ):
'''simple docstring'''
if discount_rate < 0:
raise ValueError('''Discount rate cannot be negative''' )
if not cash_flows:
raise ValueError('''Cash flows list cannot be empty''' )
U... | 614 | 1 |
'''simple docstring'''
import unittest
from transformers import MobileBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTeste... | 614 | '''simple docstring'''
import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelFo... | 614 | 1 |
'''simple docstring'''
UpperCamelCase__ : Optional[Any] = [0, 2, 4, 6, 8]
UpperCamelCase__ : List[str] = [1, 3, 5, 7, 9]
def __UpperCamelCase( _A : int , _A : int , _A : list[int] , _A : int ):
'''simple docstring'''
... | 614 | '''simple docstring'''
import argparse
import logging
import pickle
import random
import time
import numpy as np
from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging... | 614 | 1 |
'''simple docstring'''
from abc import ABC, abstractmethod
from typing import List, Optional
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
def __init__( self ) -> Optional[Any]:
'''simple docstring'''
self.test()
def lowerCA... | 614 | '''simple docstring'''
from math import factorial, radians
def __UpperCamelCase( _A : float , _A : int = 18 , _A : int = 10 ):
'''simple docstring'''
UpperCAmelCase__ : int = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)
# Converti... | 614 | 1 |
'''simple docstring'''
import os
import tempfile
import unittest
from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter
from transformers.testing_utils import slow
from transformers.utils import cached_property
@unittest.skipUnless(os.path.exists(lowerCAmelCase ) ,'... | 614 | '''simple docstring'''
import gc
import unittest
import torch
from parameterized import parameterized
from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
fro... | 614 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
UpperCamelCase__ : Optional[Any] = {'configuration_sew': ['SEW_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SEWConfig']}
try:
if not is_torch_available():
raise Opti... | 614 | '''simple docstring'''
from typing import List, Optional, Union
import torch
from transformers import (
XLMRobertaTokenizer,
)
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDIMS... | 614 | 1 |
'''simple docstring'''
from queue import Queue
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from ..models.auto import AutoTokenizer
class _lowercase :
'''simple docstring'''
def lowerCAmelCase__ ( self ,lowerCamelCase_ ) -> Any:
'... | 614 | '''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,
)
| 614 | 1 |
'''simple docstring'''
import unittest
from parameterized import parameterized
from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configur... | 614 | '''simple docstring'''
# Note: if you intend to run this script make sure you look under scripts/fsmt/
# to locate the appropriate script to do the work correctly. There is a set of scripts to:
# - download and prepare data and run the conversion script
# - perform eval to get the best hparam into the config
# - gener... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : Any , _A : Tuple ):
'''simple docstring'''
# "extended trapezoidal rule"
# int(f) = dx/2 * (f1 + 2f2 + ... + fn)
UpperCAmelCase__ : Optional[Any] = (boundary[1] - boundary[0]) / steps
UpperCAmelCase__ : Tup... | 614 | '''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast
from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : float , _A : list[float] ):
'''simple docstring'''
if discount_rate < 0:
raise ValueError('''Discount rate cannot be negative''' )
if not cash_flows:
raise ValueError('''Cash flows list cannot be empty''' )
U... | 614 | '''simple docstring'''
from __future__ import annotations
import unittest
from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand... | 614 | 1 |
'''simple docstring'''
import argparse
import io
import requests
import torch
from omegaconf import OmegaConf
from diffusers import AutoencoderKL
from diffusers.pipelines.stable_diffusion.convert_from_ckpt import (
assign_to_checkpoint,
conv_attn_to_linear,
create_vae_diffusers_config,
renew_vae_atte... | 614 | '''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase__ : List[str] = logging.get_logger(__name__)
UpperCamelCase__ : str = {
... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( ):
'''simple docstring'''
return [list(range(10_00 - i , -10_00 - i , -1 ) ) for i in range(10_00 )]
UpperCamelCase__ : Any = generate_large_matrix()
UpperCamelCase__ : List[str] = (
[[4, 3, 2, -1], [3, 2, 1, -... | 614 | '''simple docstring'''
import os
from datetime import datetime as dt
from github import Github
UpperCamelCase__ : str = [
'good first issue',
'good second issue',
'good difficult issue',
'enhancement',
'new pipeline/model',
'new scheduler',
'wip',
]
def __UpperCamel... | 614 | 1 |
'''simple docstring'''
import argparse
import os
from . import (
ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
BART_PRETRAINED_MODEL_ARCHIVE_LIST,
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP,
DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
... | 614 | '''simple docstring'''
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError
from transformers import AutoImageProcessor, ViTImageProcessor
from transformers.testing_utils import TOK... | 614 | 1 |
'''simple docstring'''
import copy
import random
from transformers import CLIPTokenizer
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
def __init__( self ,*lowerCamelCase_ ,**lowerCamelCase_ ) -> Union[str, Any]:
'''simple docstring'''
... | 614 | '''simple docstring'''
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Sequence, Value
from .base import TaskTemplate
@dataclass(frozen=lowerCAmelCase )
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
UpperCAmelCase_ ... | 614 | 1 |
'''simple docstring'''
import unittest
from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from ...test_tokenization_common import TokenizerTesterMixin
UpperCamelCase__ : Union[str, Any] ... | 614 | '''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
UpperCamelCase__ : str = {
'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'],
'processing_git': ['GitProcessor'... | 614 | 1 |
'''simple docstring'''
import importlib
import math
import os
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Tuple, Union
import flax
import jax.numpy as jnp
from ..utils import BaseOutput
UpperCamelCase__ : int = 'scheduler_config.json'
class ... | 614 | '''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.ndarray , _A : np.ndarray , _A : float = 1e-12 , _A : int = 1_00 , ):
'''simple docstring'''
assert np.shape(_A )[0] == np.shape(_A )[1]
# Ensure proper dimensiona... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[float] ):
'''simple docstring'''
if len(_A ) < 2:
raise ValueError('''Monogons and Digons are not polygons in the Euclidean space''' )
if any(i <= 0 for i in nums ):
raise Val... | 614 | '''simple docstring'''
import math
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin
class _lowercase ( lowerCAmelCase ,low... | 614 | 1 |
'''simple docstring'''
import uuid
from typing import Any, Dict, List, Optional, Union
from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_tf_available():
import tensorflow as tf
if is_torch_available():
import torch
UpperC... | 614 | '''simple docstring'''
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from tra... | 614 | 1 |
'''simple docstring'''
import gc
import unittest
import torch
from parameterized import parameterized
from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
fro... | 614 | '''simple docstring'''
import baseaa
def __UpperCamelCase( _A : str ):
'''simple docstring'''
return baseaa.baaencode(string.encode('''utf-8''' ) )
def __UpperCamelCase( _A : bytes ):
'''simple docstring'''
return baseaa.baadecode(_A ).decode('''utf-8''... | 614 | 1 |
'''simple docstring'''
import numpy as np
import torch
from torch.utils.data import Dataset, IterableDataset
from ..utils.generic import ModelOutput
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
def __init__( self ,lowerCamelCase_ ,lowerCamelCase_ ,lower... | 614 | '''simple docstring'''
import logging
import re
import pytorch_quantization
import pytorch_quantization.nn as quant_nn
import torch
from pytorch_quantization import calib
from pytorch_quantization.tensor_quant import QuantDescriptor
UpperCamelCase__ : Optional[Any] = logging.getLogger(__name__)
Uppe... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : int , _A : bool = False ):
'''simple docstring'''
if n == 2:
return True
if not n % 2 or n < 2:
return False
if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit
return False
if n > 3_31_... | 614 | '''simple docstring'''
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ... | 614 | 1 |
'''simple docstring'''
import argparse
import numpy as np
import torch
from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging
logging.set_verbosity_info()
UpperCamelCase__ : List[Any] = logging.get_logger('transformers.models.speecht5')
def __UpperCamelCase( _A : A... | 614 | '''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int , _A : int , _A : int ):
'''simple docstring'''
if (direction == 1 and array[indexa] > array[indexa]) or (
direction == 0 and array[in... | 614 | 1 |
'''simple docstring'''
from typing import List, Optional, Union
import torch
from transformers import (
XLMRobertaTokenizer,
)
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDIMS... | 614 | '''simple docstring'''
def __UpperCamelCase( _A : float , _A : list[float] ):
'''simple docstring'''
if discount_rate < 0:
raise ValueError('''Discount rate cannot be negative''' )
if not cash_flows:
raise ValueError('''Cash flows list cannot be empty''' )
U... | 614 | 1 |
'''simple docstring'''
import unittest
import numpy as np
from transformers import BertConfig, 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():
from ... | 614 | '''simple docstring'''
import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelFo... | 614 | 1 |
'''simple docstring'''
import os
from shutil import copyfile
from typing import List, Optional, Tuple
from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging
if is_sentencepiece_available():
from .tokeniza... | 614 | '''simple docstring'''
import argparse
import logging
import pickle
import random
import time
import numpy as np
from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging... | 614 | 1 |
'''simple docstring'''
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets,
# U and V such that every edge (u, v) either connects a vertex from U to V or a vertex
# from V to U. In other words, for every edge (u, v), either u belongs to U and v to V,
# or u belongs to V and v to U. W... | 614 | '''simple docstring'''
from math import factorial, radians
def __UpperCamelCase( _A : float , _A : int = 18 , _A : int = 10 ):
'''simple docstring'''
UpperCAmelCase__ : int = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)
# Converti... | 614 | 1 |
'''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast
from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky... | 614 | '''simple docstring'''
import gc
import unittest
import torch
from parameterized import parameterized
from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
fro... | 614 | 1 |
'''simple docstring'''
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run
import doctest
import sys
import warnings
from os.path import abspath, dirname, join
import _pytest
from transformers.testing_utils import HfDoctestModule, HfDocTestParser
# allow havin... | 614 | '''simple docstring'''
from typing import List, Optional, Union
import torch
from transformers import (
XLMRobertaTokenizer,
)
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDIMS... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : int = 1_00 ):
'''simple docstring'''
UpperCAmelCase__ : str = (n * (n + 1) // 2) ** 2
UpperCAmelCase__ : int = n * (n + 1) * (2 * n + 1) // 6
return sum_cubes - sum_squares
if __name__ == "__main__":
print(f"""{solu... | 614 | '''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,
)
| 614 | 1 |
'''simple docstring'''
import os
import unittest
from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer
from ...test_tokenization_common import TokenizerTesterMixin
class _lowercase ( lowerCAmelCase ,unittest.TestCase ):
'''simple docstring'''
Up... | 614 | '''simple docstring'''
# Note: if you intend to run this script make sure you look under scripts/fsmt/
# to locate the appropriate script to do the work correctly. There is a set of scripts to:
# - download and prepare data and run the conversion script
# - perform eval to get the best hparam into the config
# - gener... | 614 | 1 |
'''simple docstring'''
import argparse
from pathlib import Path
import torch
from transformers import OPTConfig, OPTModel
from transformers.utils import logging
logging.set_verbosity_info()
UpperCamelCase__ : Dict = logging.get_logger(__name__)
def __UpperCamelCase( _A : List[Any] ... | 614 | '''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast
from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky... | 614 | 1 |
'''simple docstring'''
from math import sqrt
import numpy as np
from sympy import symbols
# Coefficient
# Speed of light (m/s)
UpperCamelCase__ : str = 299_792_458
# Symbols
UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ : Dict = symbols('ct x ... | 614 | '''simple docstring'''
from __future__ import annotations
import unittest
from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand... | 614 | 1 |
'''simple docstring'''
class _lowercase :
'''simple docstring'''
def __init__( self ,lowerCamelCase_ ) -> None:
'''simple docstring'''
UpperCAmelCase__ : List[Any] = len(lowerCamelCase_ )
UpperCAmelCase__ : Dict ... | 614 | '''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase__ : List[str] = logging.get_logger(__name__)
UpperCamelCase__ : str = {
... | 614 | 1 |
'''simple docstring'''
import baseaa
def __UpperCamelCase( _A : str ):
'''simple docstring'''
return baseaa.baaencode(string.encode('''utf-8''' ) )
def __UpperCamelCase( _A : bytes ):
'''simple docstring'''
return baseaa.baadecode(_A ).decode('''utf-8''... | 614 | '''simple docstring'''
import os
from datetime import datetime as dt
from github import Github
UpperCamelCase__ : str = [
'good first issue',
'good second issue',
'good difficult issue',
'enhancement',
'new pipeline/model',
'new scheduler',
'wip',
]
def __UpperCamel... | 614 | 1 |
'''simple docstring'''
import math
from enum import Enum
from typing import Optional, Union
from torch.optim import Optimizer
from torch.optim.lr_scheduler import LambdaLR
from .utils import logging
UpperCamelCase__ : Optional[Any] = logging.get_logger(__name__)
class _lowercase ( lowe... | 614 | '''simple docstring'''
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError
from transformers import AutoImageProcessor, ViTImageProcessor
from transformers.testing_utils import TOK... | 614 | 1 |
'''simple docstring'''
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTo... | 614 | '''simple docstring'''
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Sequence, Value
from .base import TaskTemplate
@dataclass(frozen=lowerCAmelCase )
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
UpperCAmelCase_ ... | 614 | 1 |
'''simple docstring'''
import argparse
import collections
import os
import re
import tempfile
import pandas as pd
from datasets import Dataset
from huggingface_hub import hf_hub_download, upload_folder
from transformers.utils import direct_transformers_import
# All paths are set with the intent you should run this... | 614 | '''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
UpperCamelCase__ : str = {
'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'],
'processing_git': ['GitProcessor'... | 614 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import _LazyModule
UpperCamelCase__ : List[str] = {'tokenization_byt5': ['ByT5Tokenizer']}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
UpperCamelCase__ : List[str] = _Lazy... | 614 | '''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.ndarray , _A : np.ndarray , _A : float = 1e-12 , _A : int = 1_00 , ):
'''simple docstring'''
assert np.shape(_A )[0] == np.shape(_A )[1]
# Ensure proper dimensiona... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int , _A : int , _A : int ):
'''simple docstring'''
if (direction == 1 and array[indexa] > array[indexa]) or (
direction == 0 and array[in... | 614 | '''simple docstring'''
import math
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin
class _lowercase ( lowerCAmelCase ,low... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : int , _A : Dict ):
'''simple docstring'''
UpperCAmelCase__ : List[str] = [1]
for i in range(2 , _A ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k out of bounds"
... | 614 | '''simple docstring'''
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from tra... | 614 | 1 |
'''simple docstring'''
from typing import List
import numpy as np
def __UpperCamelCase( _A : dict ):
'''simple docstring'''
UpperCAmelCase__ : Dict = {key: len(_A ) for key, value in gen_kwargs.items() if isinstance(_A , _A )}
if len(set(lists_lengths.values() ... | 614 | '''simple docstring'''
import baseaa
def __UpperCamelCase( _A : str ):
'''simple docstring'''
return baseaa.baaencode(string.encode('''utf-8''' ) )
def __UpperCamelCase( _A : bytes ):
'''simple docstring'''
return baseaa.baadecode(_A ).decode('''utf-8''... | 614 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
UpperCamelCase__ : str = {
'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'],
'processing_git': ['GitProcessor'... | 614 | '''simple docstring'''
import logging
import re
import pytorch_quantization
import pytorch_quantization.nn as quant_nn
import torch
from pytorch_quantization import calib
from pytorch_quantization.tensor_quant import QuantDescriptor
UpperCamelCase__ : Optional[Any] = logging.getLogger(__name__)
Uppe... | 614 | 1 |
'''simple docstring'''
import numpy as np
import torch
import tqdm
from ...models.unet_ad import UNetaDModel
from ...pipelines import DiffusionPipeline
from ...utils import randn_tensor
from ...utils.dummy_pt_objects import DDPMScheduler
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
... | 614 | '''simple docstring'''
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ... | 614 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
UpperCamelCase__ : str = {
'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'],
'tokenization_ctrl': ['CTRLToken... | 614 | '''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int , _A : int , _A : int ):
'''simple docstring'''
if (direction == 1 and array[indexa] > array[indexa]) or (
direction == 0 and array[in... | 614 | 1 |
'''simple docstring'''
import fire
from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer
def __UpperCamelCase( _A : str , _A : str , **_A : Union[str, Any] ):
'''simple docstring'''
UpperCAmelCase__ : List[Any] = AutoConfig.from_... | 614 | '''simple docstring'''
def __UpperCamelCase( _A : float , _A : list[float] ):
'''simple docstring'''
if discount_rate < 0:
raise ValueError('''Discount rate cannot be negative''' )
if not cash_flows:
raise ValueError('''Cash flows list cannot be empty''' )
U... | 614 | 1 |
'''simple docstring'''
# Lint as: python3
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... | 614 | '''simple docstring'''
import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelFo... | 614 | 1 |
'''simple docstring'''
from math import factorial, radians
def __UpperCamelCase( _A : float , _A : int = 18 , _A : int = 10 ):
'''simple docstring'''
UpperCAmelCase__ : int = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)
# Converti... | 614 | '''simple docstring'''
import argparse
import logging
import pickle
import random
import time
import numpy as np
from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging... | 614 | 1 |
'''simple docstring'''
import requests
from bsa import BeautifulSoup
def __UpperCamelCase( _A : str , _A : dict ):
'''simple docstring'''
UpperCAmelCase__ : int = BeautifulSoup(requests.get(_A , params=_A ).content , '''html.parser''' )
UpperCA... | 614 | '''simple docstring'''
from math import factorial, radians
def __UpperCamelCase( _A : float , _A : int = 18 , _A : int = 10 ):
'''simple docstring'''
UpperCAmelCase__ : int = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)
# Converti... | 614 | 1 |
'''simple docstring'''
UpperCamelCase__ : Dict = [
999,
800,
799,
600,
599,
500,
400,
399,
377,
355,
333,
311,
288,
266,
244,
222,
200,
199,
177,
155,
133,
111,
88,
66,
44,
22,
0,
]
UpperCamelCas... | 614 | '''simple docstring'''
import gc
import unittest
import torch
from parameterized import parameterized
from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
fro... | 614 | 1 |
'''simple docstring'''
import tempfile
import unittest
from transformers import AutoModelForSeqaSeqLM, AutoTokenizer
from transformers.testing_utils import (
is_torch_available,
require_optimum,
require_torch,
slow,
)
if is_torch_available():
import torch
@require_torch
@require_optimum
@slow
cl... | 614 | '''simple docstring'''
from typing import List, Optional, Union
import torch
from transformers import (
XLMRobertaTokenizer,
)
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDIMS... | 614 | 1 |
'''simple docstring'''
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch
import math
from dataclasses import dataclass
from typing import Optional, Tuple, Union
import torch
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutpu... | 614 | '''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,
)
| 614 | 1 |
'''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int ):
'''simple docstring'''
UpperCAmelCase__ : Dict = 0
UpperCAmelCase__ : Union[str, Any] = len(_A ) - 1
while i < j:
if nums[i] + ... | 614 | '''simple docstring'''
# Note: if you intend to run this script make sure you look under scripts/fsmt/
# to locate the appropriate script to do the work correctly. There is a set of scripts to:
# - download and prepare data and run the conversion script
# - perform eval to get the best hparam into the config
# - gener... | 614 | 1 |
'''simple docstring'''
import argparse
from transformers import (
TapasConfig,
TapasForMaskedLM,
TapasForQuestionAnswering,
TapasForSequenceClassification,
TapasModel,
TapasTokenizer,
load_tf_weights_in_tapas,
)
from transformers.utils import logging
logging.set_verbosity_info()
d... | 614 | '''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast
from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky... | 614 | 1 |
'''simple docstring'''
import os
import unittest
from transformers import BatchEncoding
from transformers.models.bert.tokenization_bert import (
BasicTokenizer,
WordpieceTokenizer,
_is_control,
_is_punctuation,
_is_whitespace,
)
from transformers.models.prophetnet.tokenization_prophetnet import VO... | 614 | '''simple docstring'''
from __future__ import annotations
import unittest
from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand... | 614 | 1 |
'''simple docstring'''
import inspect
import os
import unittest
import torch
import accelerate
from accelerate import Accelerator
from accelerate.test_utils import execute_subprocess_async, require_multi_gpu
from accelerate.utils import patch_environment
class _lowercase ( unittest.TestCase ):
''... | 614 | '''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase__ : List[str] = logging.get_logger(__name__)
UpperCamelCase__ : str = {
... | 614 | 1 |
'''simple docstring'''
import math
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCamelCase__ : int = logging.get_logger(__name__)
UpperCamelCase__ : Dict = {
'facebook/data2vec-base-960h': 'https://huggingface.co/facebook/data2vec-audio-base... | 614 | '''simple docstring'''
import os
from datetime import datetime as dt
from github import Github
UpperCamelCase__ : str = [
'good first issue',
'good second issue',
'good difficult issue',
'enhancement',
'new pipeline/model',
'new scheduler',
'wip',
]
def __UpperCamel... | 614 | 1 |
'''simple docstring'''
import os
import pytest
from attr import dataclass
UpperCamelCase__ : int = 'us-east-1' # defaults region
@dataclass
class _lowercase :
'''simple docstring'''
UpperCAmelCase_ : str
UpperCAmelCase_ : str = '''arn:aws:iam::5581051417... | 614 | '''simple docstring'''
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError
from transformers import AutoImageProcessor, ViTImageProcessor
from transformers.testing_utils import TOK... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
import time
import numpy as np
UpperCamelCase__ : List[Any] = [8, 5, 9, 7]
UpperCamelCase__ : List[str] = [
[2, 0, 1, 1],
[0, 1, 2, 1],
[4, 0, 0, 3],
[0, 2, 1, 0],
[1, 0, 3, 0],
]
UpperCamelCase__ : int... | 614 | '''simple docstring'''
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Sequence, Value
from .base import TaskTemplate
@dataclass(frozen=lowerCAmelCase )
class _lowercase ( lowerCAmelCase ):
'''simple docstring'''
UpperCAmelCase_ ... | 614 | 1 |
'''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase__ : List[str] = logging.get_logger(__name__)
UpperCamelCase__ : str = {
... | 614 | '''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
UpperCamelCase__ : str = {
'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'],
'processing_git': ['GitProcessor'... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
UpperCamelCase__ : Optional[Any] = 10
def __UpperCamelCase( _A : list[int] ):
'''simple docstring'''
UpperCAmelCase__ : Dict = 1
UpperCAmelCase__ : Optional[Any] = max(_A )
while place... | 614 | '''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.ndarray , _A : np.ndarray , _A : float = 1e-12 , _A : int = 1_00 , ):
'''simple docstring'''
assert np.shape(_A )[0] == np.shape(_A )[1]
# Ensure proper dimensiona... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : int ):
'''simple docstring'''
UpperCAmelCase__ : Any = 2
UpperCAmelCase__ : Optional[int] = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
... | 614 | '''simple docstring'''
import math
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin
class _lowercase ( lowerCAmelCase ,low... | 614 | 1 |
'''simple docstring'''
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | 614 | '''simple docstring'''
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from tra... | 614 | 1 |
'''simple docstring'''
import itertools
import os
import random
import tempfile
import unittest
import numpy as np
from datasets import load_dataset
from transformers import is_speech_available
from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio
from transform... | 614 | '''simple docstring'''
import baseaa
def __UpperCamelCase( _A : str ):
'''simple docstring'''
return baseaa.baaencode(string.encode('''utf-8''' ) )
def __UpperCamelCase( _A : bytes ):
'''simple docstring'''
return baseaa.baadecode(_A ).decode('''utf-8''... | 614 | 1 |
'''simple docstring'''
from __future__ import annotations
from decimal import Decimal
from math import * # noqa: F403
from sympy import diff
def __UpperCamelCase( _A : str , _A : float | Decimal , _A : float = 10**-10 ):
'''simple docstring'''
UpperCAmelCase_... | 614 | '''simple docstring'''
import logging
import re
import pytorch_quantization
import pytorch_quantization.nn as quant_nn
import torch
from pytorch_quantization import calib
from pytorch_quantization.tensor_quant import QuantDescriptor
UpperCamelCase__ : Optional[Any] = logging.getLogger(__name__)
Uppe... | 614 | 1 |
'''simple docstring'''
from collections import UserDict
from typing import List, Union
from ..utils import (
add_end_docstrings,
is_tf_available,
is_torch_available,
is_vision_available,
logging,
requires_backends,
)
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_vision_available():
... | 614 | '''simple docstring'''
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def __UpperCamelCase( _A : Any , _A : List[str]=() , _A : List[str]=None ... | 614 | 1 |
'''simple docstring'''
import warnings
warnings.warn(
'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: '
'`from accelerate import find_executable_batch_size` to avoid this warning.',
FutureWarning,
)
| 614 | '''simple docstring'''
from __future__ import annotations
def __UpperCamelCase( _A : list[int] , _A : int , _A : int , _A : int ):
'''simple docstring'''
if (direction == 1 and array[indexa] > array[indexa]) or (
direction == 0 and array[in... | 614 | 1 |
'''simple docstring'''
def __UpperCamelCase( _A : int = 10_00 ):
'''simple docstring'''
UpperCAmelCase__ : Tuple = 3
UpperCAmelCase__ : List[str] = 0
while a < n:
if a % 3 == 0 or a % 5 == 0:
result += a
elif a % 15 == 0:
result -= a
... | 614 | '''simple docstring'''
def __UpperCamelCase( _A : float , _A : list[float] ):
'''simple docstring'''
if discount_rate < 0:
raise ValueError('''Discount rate cannot be negative''' )
if not cash_flows:
raise ValueError('''Cash flows list cannot be empty''' )
U... | 614 | 1 |
'''simple docstring'''
import numpy as np
def __UpperCamelCase( _A : np.array ):
'''simple docstring'''
return 1 / (1 + np.exp(-vector ))
if __name__ == "__main__":
import doctest
doctest.testmod()
| 614 | '''simple docstring'''
import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelFo... | 614 | 1 |
'''simple docstring'''
from collections.abc import Sequence
def __UpperCamelCase( _A : Sequence[int] | None = None ):
'''simple docstring'''
if nums is None or not nums:
raise ValueError('''Input sequence should not be empty''' )
UpperCAmelCase__ : Dict = nums[0]
... | 614 | '''simple docstring'''
import argparse
import logging
import pickle
import random
import time
import numpy as np
from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging... | 614 | 1 |
'''simple docstring'''
import os
import re
import sys
import traceback
import warnings
from pathlib import Path
from typing import Dict, Optional, Union
from uuid import uuida
from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami
from huggingface_hub.file_download import REGEX_COMMIT... | 614 | '''simple docstring'''
from math import factorial, radians
def __UpperCamelCase( _A : float , _A : int = 18 , _A : int = 10 ):
'''simple docstring'''
UpperCAmelCase__ : int = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)
# Converti... | 614 | 1 |
'''simple docstring'''
from maths.prime_factors import prime_factors
def __UpperCamelCase( _A : int ):
'''simple docstring'''
if not isinstance(_A , _A ):
UpperCAmelCase__ : Dict = F'''Input value of [number={number}] must be an integer'''
raise TypeError(_A ... | 614 | '''simple docstring'''
import gc
import unittest
import torch
from parameterized import parameterized
from diffusers import AutoencoderKL
from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device
from diffusers.utils.import_utils import is_xformers_available
fro... | 614 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.