code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" from __future__ import annotations import math def _lowerCAmelCase ( lowercase_ ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, a...
78
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() snake_cas...
60
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __snake_case = { '''configuration_ctrl''': ['''CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CTRLConfig'''], '''tokenization_ctrl''': ['''CTR...
203
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case_...
60
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code...
308
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def _snake_case ( _snake_case : int ): for param in module.parameters(): lowerCAmelCase : Optional[int] = False def _snake_case ( ): lowerCAmelCase : List[str]...
60
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
251
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import (...
60
0
import itertools import string from collections.abc import Generator, Iterable def __a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> Optional[Any]: '''simple docstring''' __UpperCAmelCase = iter(_snake_case ) while True: __UpperC...
333
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformer...
60
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import DPRCo...
300
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _snake_case ( _snake_case : list[list[float]] ): lowerCAmelCase : str = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implement...
60
0
from typing import TYPE_CHECKING from ..models.auto import AutoModelForVisionaSeq from ..utils import requires_backends from .base import PipelineTool if TYPE_CHECKING: from PIL import Image class A_ ( a__ ): '''simple docstring''' _UpperCamelCase : Union[str, Any] = ...
195
"""simple docstring""" import numpy as np def _snake_case ( _snake_case : np.array ): return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
60
0
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch fro...
174
"""simple docstring""" from __future__ import annotations import math import numpy as np from numpy.linalg import norm def _snake_case ( _snake_case : np.ndarray , _snake_case : np.ndarray ): return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(_snake_case , _snak...
60
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils impo...
194
"""simple docstring""" import math def _snake_case ( ): lowerCAmelCase : Union[str, Any] = input('''Enter message: ''' ) lowerCAmelCase : Optional[int] = int(input(f'''Enter key [2-{len(_snake_case ) - 1}]: ''' ) ) lowerCAmelCase : str = input('''Encr...
60
0
"""simple docstring""" from typing import TYPE_CHECKING import torch from ..models.auto import AutoModelForVisualQuestionAnswering, AutoProcessor from ..utils import requires_backends from .base import PipelineTool if TYPE_CHECKING: from PIL import Image class lowerC...
96
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import trans...
60
0
"""simple docstring""" def lowercase () -> Union[str, Any]: '''simple docstring''' return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] a = generate_large_matrix() a = ( [[4, 3, 2, -...
155
"""simple docstring""" import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
60
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _lowerCAmelCase ( lowercase_ ): UpperCAmelCase = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementa...
78
"""simple docstring""" snake_case__ : str = [ 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, ] snake_case__ ...
60
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _lowerCAmelCase ( a__ ): def __init__( self , Uppe...
203
"""simple docstring""" def _snake_case ( _snake_case : list ): def merge(_snake_case : list , _snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) y...
60
0
def snake_case( __magic_name__ ) -> List[Any]: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError('''List is empty''' ) lowercase : Tuple = sum(_snake_case ) / len(_snake_case ) # Ca...
308
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice...
60
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { ...
251
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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_fla...
60
0
import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jn...
333
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavin...
60
0
import numpy as np import datasets _lowerCAmelCase : Dict = ''' Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance. It was introduce...
300
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from fla...
60
0
import argparse import os import re import packaging.version UpperCAmelCase = '''examples/''' UpperCAmelCase = { '''examples''': (re.compile(R'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), '''init''': (re.compile(R'''^__version__\s+=\s+"([^"]+)"\s*...
195
"""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 .to...
60
0
'''simple docstring''' def __magic_name__( lowerCamelCase): if not isinstance(_snake_case, _snake_case): raise TypeError('''only integers accepted as input''') else: __lowerCAmelCase = str(abs(_snake_case)) __lowerCAmelCase = [l...
174
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py snake_case__ : Optional[Any] = '''src/transfo...
60
0
"""simple docstring""" import sys _a = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' ...
194
"""simple docstring""" import mpmath # for roots of unity import numpy as np class snake_case_: def __init__( self : str , UpperCamelCase_ : int=None , UpperCamelCase_ : List[str]=None ): # Input as list lowerCAmelCase : str = li...
60
0
"""simple docstring""" import fcntl import os import socket import torch import torch.distributed as dist def _snake_case ( *lowercase__ ): with open(_snake_case , 'r' ) as fh: fcntl.flock(_snake_case , fcntl.LOCK_EX ) try...
96
"""simple docstring""" import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_f...
60
0
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowercase (snake_case__ : str , snake_case__ : str , snake_case__ : Optional[str] = None ) ...
155
"""simple docstring""" def _snake_case ( _snake_case : int ): if not isinstance(_snake_case , _snake_case ): raise TypeError('''only integers accepted as input''' ) else: lowerCAmelCase : List[str] = str(abs(_snake_case ) ) lowerCAmelC...
60
0
"""simple docstring""" import comet # From: unbabel-comet import torch import datasets snake_case_ = datasets.logging.get_logger(__name__) snake_case_ = '''\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C an...
78
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() snake_cas...
60
0
"""simple docstring""" import argparse import os import re import zipfile import torch from transformers import AutoTokenizer, GPTaConfig def __lowerCAmelCase ( lowercase : Optional[Any] , lowercase : int , lowercase : Dict=0 ) -> Any: """simple docstrin...
203
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case_...
60
0
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 BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin, SchedulerOutput @dataclass class _...
308
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def _snake_case ( _snake_case : int ): for param in module.parameters(): lowerCAmelCase : Optional[int] = False def _snake_case ( ): lowerCAmelCase : List[str]...
60
0
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def lowercase__( __UpperCamelCase: Sequence[float] ,__UpperCamelCase: int ,__UpperCamelCase: int ): ...
251
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import (...
60
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A_ : int = { '''configuration_canine''': ['''CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CanineConfig'''], '''tokenization_canine''': ['''Canin...
333
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformer...
60
0
def __snake_case ( _lowerCAmelCase : list[list[int | float]] ) -> int: A_ : Union[str, Any] = len(_snake_case ) A_ : List[Any] = len(matrix[0] ) A_ : str = min(_snake_case , _snake_case ) for row in range(_snake_case ): # Check if dia...
300
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _snake_case ( _snake_case : list[list[float]] ): lowerCAmelCase : str = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implement...
60
0
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import BnbQu...
195
"""simple docstring""" import numpy as np def _snake_case ( _snake_case : np.array ): return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
60
0
'''simple docstring''' _UpperCAmelCase : str = [ 9_9_9, 8_0_0, 7_9_9, 6_0_0, 5_9_9, 5_0_0, 4_0_0, 3_9_9, 3_7_7, 3_5_5, 3_3_3, 3_1_1, 2_8_8, 2_6_6, 2_4_4, 2_2_2, 2_0_0, 1_9_9, 1_7_7, 1_5_5, 1_...
174
"""simple docstring""" from __future__ import annotations import math import numpy as np from numpy.linalg import norm def _snake_case ( _snake_case : np.ndarray , _snake_case : np.ndarray ): return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(_snake_case , _snak...
60
0
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( """The `image_to_image.py` script is outdated. Please use directly `from diffusers import""" """ StableDiffusionImg2ImgPipeline` instead.""" )
194
"""simple docstring""" import math def _snake_case ( ): lowerCAmelCase : Union[str, Any] = input('''Enter message: ''' ) lowerCAmelCase : Optional[int] = int(input(f'''Enter key [2-{len(_snake_case ) - 1}]: ''' ) ) lowerCAmelCase : str = input('''Encr...
60
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...im...
96
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import trans...
60
0
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
155
"""simple docstring""" import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
60
0
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch ...
78
"""simple docstring""" snake_case__ : str = [ 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, ] snake_case__ ...
60
0
"""simple docstring""" import mpmath # for roots of unity import numpy as np class _lowerCAmelCase : def __init__( self , UpperCamelCase__=None , UpperCamelCase__=None ) -> Union[str, Any]: '''simple docstring''' snake_case : str = list(...
203
"""simple docstring""" def _snake_case ( _snake_case : list ): def merge(_snake_case : list , _snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) y...
60
0
import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from trans...
308
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice...
60
0
'''simple docstring''' from __future__ import annotations import math def lowercase__( __UpperCamelCase: int ,__UpperCamelCase: int ,__UpperCamelCase: bool ,__UpperCamelCase: list[int] ,__UpperCamelCase: float ): """simple docstring""" if depth < 0: ...
251
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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_fla...
60
0
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, requ...
333
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavin...
60
0
def __snake_case ( _lowerCAmelCase : str , _lowerCAmelCase : int , _lowerCAmelCase : str , _lowerCAmelCase : Dict ) -> List[str]: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: A_ : Union[str, Any]...
300
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from fla...
60
0
def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ): if len(_snake_case ) != len(_snake_case ): raise ValueError('The length of profit and weight must be same.' ) if max_weight <= 0: raise ValueError('max_weight must g...
195
"""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 .to...
60
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fro...
61
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
1
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
"""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...
61
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _a = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_torch_available(): ...
61
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_c...
61
1
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _a = logging.get_logger('transformers.models.speecht5') def __a ( __lowerCamelCase, __lowerCamelCase, __lowe...
61
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
1
"""simple docstring""" import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is_f...
61
"""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 .t...
61
1
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureExtractor'], 'p...
61
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
1
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _a = logging.getLogger(__name__) if __name__ == "__main__":...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
1
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Conditio...
61
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
1
"""simple docstring""" import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def __a ( __lowerC...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def __a ( ): UpperCAmelCase_ : str = ArgumentParser("Diffusers CLI tool", usage="diffusers-cli <command> [<args>]" ) UpperCAmelCase_ : Optional[int] = parser.add...
61
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _a = logging.get_logger(__name__) _a ...
61
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
1
"""simple docstring""" import requests _a = '' # <-- Put your OpenWeatherMap appid here! _a = 'https://api.openweathermap.org/data/2.5/' def __a ( __lowerCamelCase = "Chicago", __lowerCamelCase = APPID ): return requests.get(URL_BASE + "weather", params=locals() )...
61
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
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 Config...
61
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
1
"""simple docstring""" import enum import shutil import sys _a , _a = shutil.get_terminal_size() _a = {'UP': 'A', 'DOWN': 'B', 'RIGHT': 'C', 'LEFT': 'D'} class A_ (enum.Enum ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Any = 0 SCREAMI...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""simple docstring""" import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch...
61
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase = False ): if not isinstance(__lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : str = f"""Expected string as input, found {type(__lowerCamelCase )}""" raise ValueError(__lowerCamelCase ) if no...
61
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
1
"""simple docstring""" from __future__ import annotations class A_ : '''simple docstring''' def __init__( self , lowercase_ ): """simple docstring""" UpperCAmelCase_ : Optional[Any] = order # a_{0} ... a_{k} UpperCAmelCase_ : Tuple = ...
61
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE__ : Option...
61
1
"""simple docstring""" from __future__ import annotations class A_ : '''simple docstring''' def __init__( self , lowercase_ = 0 ): """simple docstring""" UpperCAmelCase_ : List[str] = key def UpperCamelCase__ ( self , lowercase_ , ...
61
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
61
1
"""simple docstring""" # Imports import numpy as np class A_ : '''simple docstring''' def __init__( self , lowercase_=None , lowercase_=None , lowercase_=None , lowercase_=None , lowercase_=None ): """simple docstring""" self.set_matricies(red=lowercase_ ,...
61
"""simple docstring""" from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
61
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 .t...
61
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
1
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _a = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pas...
61
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
1
"""simple docstring""" import os from datetime import datetime as dt from github import Github _a = [ 'good first issue', 'feature request', 'wip', ] def __a ( ): UpperCAmelCase_ : int = Github(os.environ["GITHUB_TOKEN"] ) UpperCAmelCase_ : ...
61
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
1
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impor...
61
"""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...
61
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule _a = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys _a = ...
61
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_c...
61
1
"""simple docstring""" import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets _a = datasets.logging.get_logger(__name__) _a = '\\n@InProceedings{moosavi2019minimum,\n a...
61
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
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 # #...
61
"""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 .t...
61
1
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a = {'configuration_focalnet': ['FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FocalNetConfig']} try: if not is_torc...
61
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase ): return price * (1 + tax_rate) if __name__ == "__main__": print(f"""{price_plus_tax(100, 0.25) = }""") print(f"""{price_plus_tax(125.50, 0.05) = }""")
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
1
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _a = logging.get_logger(__name__) _a = '▁' _a = ...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" _a = '\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' _a = [{'type': 'code', 'content': INSTALL_CONTENT}] _a = ...
61
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
1
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors imp...
61
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
1
"""simple docstring""" def __a ( __lowerCamelCase ): if not all(x.isalpha() for x in string ): raise ValueError("String must only contain alphabetic characters." ) UpperCAmelCase_ : str = sorted(string.lower() ) return len(__lowerCamelCase ) == len(set(__lowerCamelCase...
61
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
1
"""simple docstring""" import string from math import logaa def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Optional[Any] = document.translate( str.maketrans("", "", string.punctuation ) ).replace("\n", "" ) UpperCAmelCase_ : str ...
61
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""simple docstring""" import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from trans...
61
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
1
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class A_ : '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[s...
61
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
1
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached...
61
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class A_ (lowercase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE__ : Option...
61
1
"""simple docstring""" _a = [ 'Audio', 'Array2D', 'Array3D', 'Array4D', 'Array5D', 'ClassLabel', 'Features', 'Sequence', 'Value', 'Image', 'Translation', 'TranslationVariableLanguages', ] from .audio import Audio from .features import ArrayaD, ArrayaD,...
61
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
61
1
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : str = "" for word_or_phrase in separated: if not isinstance(__lowerCamelCase, __lowerCamelCase ): raise Exception("join() accepts only strings to be joined" ) joined += ...
61
"""simple docstring""" from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
61
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'alibaba-damo/mgp-str-base': 'https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json', } class A_ (lowercase__ ...
61
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
1
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): fro...
61
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
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, prep...
61
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : List[str] = int(__lowerCamelCase ) if n_element < 1: UpperCAmelCase_ : List[Any] = ValueError("a should be a positive number" ) raise my_error UpperCAmelCase_ : List[An...
61
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json', # ...
61
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase = 1 / sqrt(2 ) ): UpperCAmelCase_ : int = tau * frequency / samplerate UpperCAmelCase_ : List[...
61
1
"""simple docstring""" import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) _a = logging.getLogger(_...
61
"""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...
61
1
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers impor...
61
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_c...
61
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = { 'configuration_roformer': ['ROFORMER_PRETRAINED_CONFIG_...
61
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fr...
61
1
"""simple docstring""" from __future__ import annotations _a = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class A_ : '''simple docstring''' def __init__( self , lo...
61
"""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 .t...
61
1
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : str = [] UpperCAmelCase_ , UpperCAmelCase_ : Tuple = input_list[low:mid], input_list[mid ...
61
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _a = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://h...
61
1
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_avai...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance < 0: raise ValueError("Resistance...
61
1
"""simple docstring""" def __a ( ): UpperCAmelCase_ : List[Any] = [] UpperCAmelCase_ : Any = 1 while len(__lowerCamelCase ) < 1E6: constant.append(str(__lowerCamelCase ) ) i += 1 UpperCAmelCase_ : List[str] = "".join(__lowerC...
61
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
1
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class A_ (lowercase__ ): '''simple docstring''' def __init__( self , lowercase_ , lowercase_ , lowercase_ ): """simple ...
61
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
1
"""simple docstring""" import numpy as np class A_ : '''simple docstring''' def __init__( self ): """simple docstring""" UpperCAmelCase_ : List[str] = (0, 0) UpperCAmelCase_ : int = None UpperCAmelCase_ : Tuple = 0 ...
61
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
1
"""simple docstring""" import os import numpy import onnx def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = a.name UpperCAmelCase_ : Optional[Any] = b.name UpperCAmelCase_ : str = "" UpperCAmelCase_ : ...
61
"""simple docstring""" import os _a = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000} def __a ( __lowerCamelCase ): UpperCAmelCase_ : Union[str, Any] = 0 UpperCAmelCase_ : List[str] = 0 while index < len(__lowerCamelCase...
61
1
"""simple docstring""" import argparse from collections import defaultdict def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : int = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with ope...
61
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
1
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) _a ...
61
"""simple docstring""" from collections import namedtuple _a = namedtuple('from_to', 'from_ to') _a = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.001, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0454, 264.172), 'cubicyard': from_to(0.7_6455, 1....
61
1
"""simple docstring""" import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging _a ...
61
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ , UpperCAmelCase_ : str = set(__lowerCamelCase ), [start] while stack: UpperCAmelCase_ : Any = stack.pop() explored...
61
1
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": _a = pd.read_csv('sample_data.csv', header=None) _a ...
61
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
1
"""simple docstring""" import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib _a = { ...
61
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
1