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
'''simple docstring''' import math import sys import cva import numpy as np def __UpperCAmelCase ( _UpperCAmelCase : np.ndarray , _UpperCAmelCase : float ) -> np.ndarray: # For applying gaussian function for each element in matrix. __snake_case = math.sqrt(_Up...
717
'''simple docstring''' import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __UpperCAmelCase ( _UpperCAmelCase : Dict ...
680
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE__ ( metaclass=_UpperCamelCase ): __SCREAMING_SNAKE_CASE = ["""sentencepiece"""] def __init__( self : Optional[Any] , *a_ : Union[str, Any] , **a_ : Optional[Any] ...
718
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) ...
680
0
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink ...
719
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : List[Any] = { ...
680
0
def __UpperCAmelCase ( _UpperCAmelCase : list[list] ) -> list[list]: __snake_case = current_set.copy() for row_index, row in enumerate(_UpperCAmelCase ): __snake_case = row[0] for column_index, column in enumerate(_UpperCAmelCase ): if magnitude == 0: ...
720
'''simple docstring''' import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, ...
680
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffus...
721
'''simple docstring''' import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
680
0
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable a : List[str] = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
700
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class SCREAMING_SNAKE_CASE__ : __SCREAMING_SNAKE_CASE = None __SCREAMING_SNAKE_CASE = False __SCREAMING_SNAKE_CASE = ...
680
0
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __UpperCAmelCase ( _UpperCAmelCase : int ) -> int: __snake_case = [ "encoder.version", "decoder.version", ...
701
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device a : Optional[Any] = False class ...
680
0
'''simple docstring''' import numpy as np import qiskit def __UpperCAmelCase ( _UpperCAmelCase : int = 8 , _UpperCAmelCase : int | None = None ) -> str: __snake_case = np.random.default_rng(seed=_UpperCAmelCase ) # Roughly 25% of the qubits will contribu...
702
'''simple docstring''' import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('''>=''', FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_...
680
0
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transfor...
703
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : int , _UpperCAmelCase : int ) -> str: if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise ValueError("iterations must be defined as integers" ) if not isinstance(_UpperCAmelCase , ...
680
0
'''simple docstring''' from PIL import Image def __UpperCAmelCase ( _UpperCAmelCase : Image , _UpperCAmelCase : int ) -> Image: __snake_case = (2_59 * (level + 2_55)) / (2_55 * (2_59 - level)) def contrast(_UpperCAmelCase : int ) -> int: return int(1_28 + fact...
704
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : int ) -> str: if number > 0: raise ValueError("input must be a negative integer" ) __snake_case = len(bin(_UpperCAmelCase )[3:] ) __snake_case = bin(abs(_UpperCAmelCase ) - (1 << binary_number_length)...
680
0
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( _UpperCAmelCase : list[float] , _UpperCAmelCase : list[float] ) -> float: __snake_case = sorted(numsa + numsa ) __snake_case , __snake_case = divmod(len(_UpperCAmelCase ) ...
705
'''simple docstring''' from timeit import timeit def __UpperCAmelCase ( _UpperCAmelCase : int ) -> int: if number < 0: raise ValueError("the value of input must not be negative" ) __snake_case = 0 while number: number &= number - 1 result += 1 r...
680
0
'''simple docstring''' from math import asin, atan, cos, radians, sin, sqrt, tan a : Dict = 6_378_137.0 a : Union[str, Any] = 6_356_752.314_245 a : Any = 6_378_137 def __UpperCAmelCase ( _UpperCAmelCase : float , _UpperCAmelCase : float ...
706
'''simple docstring''' import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch a : Dict = '''...
680
0
'''simple docstring''' from math import sqrt def __UpperCAmelCase ( _UpperCAmelCase : int ) -> bool: assert isinstance(_UpperCAmelCase , _UpperCAmelCase ) and ( number >= 0 ), "'number' must been an int and positive" __snake_case = True # 0 and 1 ...
707
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transf...
680
0
'''simple docstring''' from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, query_ta...
708
'''simple docstring''' import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize("dataset_size" , [None, 4_00 * 2**20, 6_00 * 2**20] ) @pytest.mark.parametrize("input_in_memory_max_size" , ["default", 0, 1_00 * 2**20, 9_00 *...
680
0
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig a : List[str] = logging.get_logger(__name__) a : Union[str, An...
709
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : float ) -> float: if edge <= 0 or not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise ValueError("Length must be a positive." ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) d...
680
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json''', } ...
710
'''simple docstring''' from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance a : Any = 6_378_137.0 a : List[Any] = 6_356_752.314_245 a : Dict = 6_378_137 def __UpperCAmelCase ( _UpperCAmelCase : float...
680
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available a : List[str] = { '''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConfig''', ''...
711
'''simple docstring''' import math import sys import cva import numpy as np def __UpperCAmelCase ( _UpperCAmelCase : np.ndarray , _UpperCAmelCase : float ) -> np.ndarray: # For applying gaussian function for each element in matrix. __snake_case = math.sqrt...
680
0
'''simple docstring''' import numpy as np def __UpperCAmelCase ( _UpperCAmelCase : np.ndarray ) -> np.ndarray: return 1 / (1 + np.exp(-vector )) def __UpperCAmelCase ( _UpperCAmelCase : np.ndarray ) -> np.ndarray: return vector * sigmoid(_UpperCAmelCase ) ...
712
'''simple docstring''' class SCREAMING_SNAKE_CASE__ : def __init__( self : Any , a_ : Dict , a_ : Union[str, Any] , a_ : Tuple ): """simple docstring""" __snake_case = name __snake_case = value __snak...
680
0
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm impor...
713
'''simple docstring''' import os from math import logaa def __UpperCAmelCase ( _UpperCAmelCase : str = "base_exp.txt" ) -> int: __snake_case = 0 __snake_case = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(_UpperCAmelCase ) , _UpperCAmelCase )...
680
0
'''simple docstring''' import os from math import logaa def __UpperCAmelCase ( _UpperCAmelCase = "base_exp.txt" ) -> int: __snake_case = 0 __snake_case = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(_UpperCAmelCase ) , _UpperCAmelCase ) ) ): ...
714
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer a : List[Any] = log...
680
0
'''simple docstring''' import math import os import sys def __UpperCAmelCase ( _UpperCAmelCase : str ) -> str: __snake_case = "" try: with open(_UpperCAmelCase , "rb" ) as binary_file: __snake_case = binary_file.read() for dat in data: __snake_c...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a : str = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''],...
680
0
'''simple docstring''' import warnings from typing import List from unittest.mock import Mock import torch from torch.utils.data import DataLoader, IterableDataset, TensorDataset from accelerate.accelerator import Accelerator from accelerate.utils.dataclasses import DistributedType class ...
716
'''simple docstring''' # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format,...
680
0
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : Dict , _UpperCAmelCase : Optional[Any] ) -> int: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __UpperCAmelCase ( _UpperCAmelCase : List[str] , _UpperCAmelCase : ...
717
'''simple docstring''' import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __UpperCAmelCase ( _UpperCAmelCase : Dict ...
680
0
'''simple docstring''' import math import sys def __UpperCAmelCase ( _UpperCAmelCase : str ) -> str: __snake_case = "" try: with open(_UpperCAmelCase , "rb" ) as binary_file: __snake_case = binary_file.read() for dat in data: __snake_case = ...
718
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) ...
680
0
'''simple docstring''' import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem a : Any = importlib.util.find_spec('''s3fs''') is not None if _ha...
719
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : List[Any] = { ...
680
0
from string import ascii_uppercase a : List[str] = {char: i for i, char in enumerate(ascii_uppercase)} a : str = dict(enumerate(ascii_uppercase)) def __UpperCAmelCase ( _UpperCAmelCase : str , _UpperCAmelCase : str ) -> str: __snake_case =...
720
'''simple docstring''' import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, ...
680
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, lo...
721
'''simple docstring''' import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
680
0
"""simple docstring""" from unittest.mock import Mock, patch from file_transfer.send_file import send_file @patch("socket.socket" ) @patch("builtins.open" ) def a__ ( SCREAMING_SNAKE_CASE : Union[str, Any] , SCREAMING_SNAKE_CASE : Any ): '''simple ...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" from math import factorial, pi def a__ ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : int = 3_0 ): '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE , (int, float) ): raise ValueError("macla...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" from __future__ import annotations import math import numpy as np from numpy.linalg import norm def a__ ( SCREAMING_SNAKE_CASE : np.ndarray , SCREAMING_SNAKE_CASE : np.ndarray ): '''simple docstring''' return math.sqrt(sum(pow(...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" import pytest lowerCAmelCase__ = '''__dummy_dataset1__''' lowerCAmelCase__ = ''' import json import os import datasets REPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/" URLS = {"train": REPO_URL + "wikiann-bn-train...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' lowerCAmelCase : Union[str, Any] = 2**power lowerCAmelCase : Dict = str(SCREAMING_SNAKE_CASE ) lowerCAmelCase : Optional[int] = list...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings ...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) from diffusers...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebook/...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDif...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def a__ ( SCREAMING_SNAKE_CASE : int = 3 ): '''simple docstring''' if isinstance(SCREAMING_SNAKE_CASE , SCR...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_swinv2''': ['''SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Swinv2Config'''], } try: if not is_torch_avai...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" # flake8: noqa # Lint as: python3 lowerCAmelCase__ = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import VerificationMode from ....
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARC...
681
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_convnext''': ['''CONVNEXT_PRETRAINED_CONFIG_ARCH...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def a__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' lowerCAmelCase : List[str] = [ ...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''andrea...
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mod...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence lowerCAmelCase : Optional[int] = gray_code_sequen...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common ...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record lowerCAmelCase__ = '''\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Sys...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer lowerCAmelCase__ = logging.get_lo...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""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 lowerCAmelCase__ = logging.getLogger(__name__) lowerCAmelCas...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" lowerCAmelCase__ = tuple[float, float, float] lowerCAmelCase__ = tuple[float, float, float] def a__ ( SCREAMING_SNAKE_CASE : Pointad , SCREAMING_SNAKE_CASE : Pointad ): '''simple docstring''' lowerCAmelC...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps,...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if partitions <= 0: raise ValueError("partitions must be a positive number!" ) if partitio...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Tok...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" import pickle import numpy as np from matplotlib import pyplot as plt class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__=0.2 , snake_case__...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" import numpy as np def a__ ( SCREAMING_SNAKE_CASE : np.array ): '''simple docstring''' return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def a__ ( ): '''simple docstring''' lowerCAmelCase : int = ArgumentParser( description...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ = 10 def a__ ( SCREAMING_SNAKE_CASE : list[int] ): '''simple docstring''' lowerCAmelCase : Tuple = 1 lowerCAmelCase : Union[str, Any] = max(SCREAMING_SNAKE_C...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( lowercase ...
681
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : bool = False ): '''simple docstring''' if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 1_0 not in (1, 3, 7, 9): # can quickly ...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" from collections import deque from .hash_table import HashTable class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" def __init__( self , *snake_case__ , **snake_case__ ): """simple docstring""" super().__i...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPh...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" from __future__ import annotations import math class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : int = size # approximate the o...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : int | str ): '''simple docstring''' lowerCAmelCase : Optional[Any] = str(SCREAMING_SNAKE_CASE ) return n == n[::-1] def a__ ( SCREAMING_SNAKE_CA...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline lowerCAmelCase__ = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.ad...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" import re def a__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' lowerCAmelCase : List[str] = re.compile(r"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$" ) if match := re.search(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import (...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( '''The `inpainting.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionInpaintPipeline` instead.''' )
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''SenseTime/deformable-detr''': '''https://huggingface.c...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , ): '''simple docstring''' if (electron_conc, hole_conc, intrinsic_conc).c...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_v...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] lowerCAmelCase__ = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def a__ ( SCREAMING_SNAKE_CASE : list[float] ...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" import string import numpy def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a , SCREAMING_SNAKE_CASE ) class SCREA...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for ...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): """simple docstring""" a : str =JukeboxTokenizer a : str ...
681
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : List[Any] ="bert-generation" def __init__( self , snake_case__=50_358 , snake_case__=1_024 , snake_case_...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def a__ ( SCREAMING_SNAKE_CASE : str = "laptop" ): '''simple docstring''' lowerCAmelCase : Optional[Any] = f"""https://www.am...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( lowercase ...
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. 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/LICENS...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" from __future__ import annotations import queue class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase :...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE , str(factorial(SCREAMING_SNAKE_CASE ) ) ) ) if __name__ == "__main__": ...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' if n_term == "": return [] lowerCAmelCase : list = [] for temp in range(int(SCREAMING_SNAKE_CASE ) ): series.append(f"""1/{temp + 1}""" if series el...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenizatio...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/edbeeching/...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_C...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1