code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A__ = {'configuration_speech_encoder_decoder': ['SpeechEncoderDecoderConfig']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except O...
82
'''simple docstring''' import os from datetime import datetime as dt from github import Github snake_case_ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def A__ ( ): ...
83
0
import math def lowerCamelCase__ ( A__ : list , A__ : int ): '''simple docstring''' __lowerCamelCase = len(A__ ) __lowerCamelCase = int(math.floor(math.sqrt(A__ ) ) ) __lowerCamelCase = 0 while arr[min(...
361
from math import ceil, sqrt def lowerCamelCase__ ( A__ : int = 1000000 ): '''simple docstring''' __lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __lowerCamelCase ...
29
0
def A_ ( snake_case : int = 4000000 ) -> int: '''simple docstring''' __UpperCamelCase = [] __UpperCamelCase , __UpperCamelCase = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(snake_case ) ...
328
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda from a...
328
1
"""simple docstring""" import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_availabl...
365
"""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 __SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) __SC...
73
0
def __SCREAMING_SNAKE_CASE ( ) -> Dict: return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] SCREAMING_SNAKE_CASE__ = generate_large_matrix() SCREAMING_SNAKE_CASE__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, ...
325
'''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_bert import BertTokenizer lowerCamelCase__ = logging.get_logger(__n...
234
0
import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxruntime as ort A...
350
def UpperCamelCase ( __magic_name__ : str ) -> List[str]: # noqa: E741 """simple docstring""" lowercase__ = len(__magic_name__ ) lowercase__ = 0 lowercase__ = [0] * n lowercase__ = [False] * n lowercase__ ...
146
0
def _a ( SCREAMING_SNAKE_CASE : str ) -> bool: """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __lowerCAmelCase: Tuple = sorted(string.lower() ) return len(SCREAMING_SNAKE_CA...
322
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 jnp ...
322
1
'''simple docstring''' import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cas...
366
'''simple docstring''' import unittest import numpy as np import requests 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 ImageProcessingSavingTestMixin, prepare_image_inputs ...
17
0
"""simple docstring""" from math import pi, sqrt def lowercase_ ( _snake_case ): if num <= 0: raise ValueError("""math domain error""" ) if num > 171.5: raise OverflowError("""math range error""" ) elif num - int(_snake_case ) no...
25
"""simple docstring""" import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py UpperCAmelCase__ : List[str...
25
1
import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, ...
269
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( ...
269
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class A__ : def __init__( self , __magic_name__ = None ): if components is None: lowerCamelCase : Optional[Any] = [] lowerC...
287
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging _lowerCamelCase =logging.get_logger(__name_...
287
1
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @r...
330
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ : Optional[int] = logging.get_logger(__name__) UpperCamelCase__ : Dict = { """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.js...
330
1
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class __lowerCamelCase (_a ): def snake_case_ ( self: Optional[Any],A_: str ): '''simple docstring''' ...
310
import torch from transformers import AutoModel class __lowerCamelCase (torch.nn.Module ): def __init__( self: Union[str, Any],A_: Tuple="sayef/fsner-bert-base-uncased" ): '''simple docstring''' super(A_,self...
310
1
"""simple docstring""" from __future__ import annotations import math _a = '2020.9.26' _a = 'xcodz-dot, cclaus, dhruvmanila' def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if not all(isinstance(_lowerCAmelCase, (flo...
370
"""simple docstring""" import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef _a = ( 'This metric will be removed from the library soon, met...
23
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _a : Optional[Any] = TypeVar('T') class __A ( Generic[T] ): def __init__( self , a__ ): _lowerCAmelCase : Optional...
44
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def A ( _lowercase ): if not is_accelerate_available(): return method SCREAMING_SNAKE_CASE : int = version.parse(ac...
182
0
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version UpperCamelCase__ ={ '<': operator.lt, '<=': operator.le, '==': operator.eq, '!=': operator.ne, '>=': operator.ge, '>': operator.gt, } def lowerCame...
325
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
325
1
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowerCAmelCase : Union[str, Any] = (3, 9, -11, 0, 7, 5, 1, -1) lowerCAmelCase : str = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class __lowercase : """simple d...
13
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
0
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParse...
207
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean _snake_case : Dict = 0 _snake_case : Dict = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, ...
207
1
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoToke...
284
from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ..utils.dummy_pt_...
284
1
from math import factorial lowerCamelCase__ = {str(digit): factorial(digit) for digit in range(10)} def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> int: if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): raise TypeError('Parameter number must be int' ) ...
361
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) -> list[list[int]]: lowerCAmelCase__ : list[list[int]] = [] create_all_state(1 , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , [] , SCREA...
307
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __lowerCamelCase : List[str] = (DDIMParallelScheduler,) __lowerCamelCase : int ...
116
def __UpperCamelCase ( _lowerCAmelCase = 100_0000 ) -> int: """simple docstring""" A : str = limit + 1 A : Tuple = [0] * limit for first_term in range(1 , _lowerCAmelCase ): for n in range(_lowerCAmelCase , _lowerCAmelCa...
116
1
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( '''split_dict''' , [ SplitDict(), SplitDict({'''train''': SplitInfo(name='''train''' , num_bytes=13_37 , num_examples=42 , ...
93
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowerCAmelCase = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul A...
93
1
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__=5 ) -> Optional[Any]: '''simple docstring''' assert masked_input.count('''<mask>''' ) ...
273
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscrete...
22
0
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = '▁' __UpperCAmelCase ...
28
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class __a ( unittest.TestCase ): def A ( self : List[Any] ): lowerCAmelCase_ : Dict = Vector([1, 2, 3] )...
28
1
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__UpperCAmelCase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''').testmo...
138
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase__ : str = { 'configuration_mask2former': [ 'MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Mask2FormerConfig', ], } try: ...
225
0
"""simple docstring""" import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() lowerCAmelCase_ : List[Any] ...
248
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(lowerCAmelCase ) ) if txt[a].isalpha() ] if __name__ == "__main__": _...
248
1
"""simple docstring""" import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase ( __lowerCamelCase ): SCREAMING_SNAKE_CASE_ = (CMStochasticIterativeScheduler,) SCREAMING_SNAKE_CASE_ = 1_0 ...
69
import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax import jit from transfo...
244
0
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=__lowercase ) class lowerCAmelCase__ ( __lowercase ): a__ : str = field(default="""audio-...
364
from __future__ import annotations def __magic_name__ ( __lowerCAmelCase : list , __lowerCAmelCase : int | None = None , __lowerCAmelCase : int | None = None ) -> None: if start is None: __lowerCamelCase = 0 if end is None: ...
339
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json''', } class lowerCa...
5
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" __UpperCamelCase = (DDPMScheduler,) def SCREAMING_SNAKE_CASE ( self :Union[s...
300
0
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder UpperCAmelCase : Optional[Any] = datasets.utils.logging.get_logger(__name__) class __lowercase ( folder_based_builder.FolderBasedBuilderConfig ...
353
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging UpperCAmelCase : Optional[Any] = logging.get_logger(...
66
0
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() SCREAMING_SNAKE_CASE__ : Optional[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : List[Any] = {name: ...
270
from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar SCREAMING_SNAKE_CASE__ : List[Any] = TypeVar("T") def __magic_name__ ( __lowerCAmelCase : int ) -> int: return (position - 1) // 2 def __magic_name__ ( __lowerCAmelCase : ...
270
1
from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline _lowerCamelCase : List[Any] = logging.get_logger(__name__) class __...
99
# 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 # # Unless required by applica...
99
1
from __future__ import annotations def UpperCAmelCase__ ( lowerCamelCase, lowerCamelCase = None, lowerCamelCase = None ): if start is None: lowercase :Any = 0 if end is None: lowercase :Any = len(lowerCamelCase ) - 1 if start >= end: return lowercase...
236
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase : List[str] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
236
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self : List[str] , *UpperCAmelCase_ ...
273
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 __A = "src/transformers" # This is to make sure the transformers module...
273
1
def a ( snake_case__: int = 600_851_475_143 ): '''simple docstring''' try: lowercase_ = int(snake_case__ ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castable to int.''' ) if n <= 0: raise ...
30
from math import factorial class __a : def __init__( self : Union[str, Any] , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ): '''simple docstring''' UpperCamelCase__ : Tuple ...
189
0
def _snake_case( SCREAMING_SNAKE_CASE__ : int = 4000000 ) -> Tuple: '''simple docstring''' A__ = [0, 1] A__ = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: brea...
351
import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import floats_tensor, is_xform...
282
0
def _a ( SCREAMING_SNAKE_CASE_ : int = 1_00_00_00 ): __lowerCAmelCase = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , SCREAMING_S...
92
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( _UpperCAmelCase ): """simple docstring""" __a : Optional[Any] = (KDPMaDiscreteScheduler,) __a : Dict ...
210
0
'''simple docstring''' import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class lowercase__ ( lowercase , lowercase ...
367
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case_ : Optional[int] = logging.get_logger(__name__) snake_case_ : List[Any] = { 'face...
236
0
'''simple docstring''' import numpy as np def UpperCAmelCase_ (__a : np.ndarray , __a : np.ndarray , __a : float = 1e-12 , __a : int = 1_0_0 , ): """simple docstring""" assert np.shape(__a )[0] == np.shape(__a )[1] # Ensure proper dimensionality. ass...
271
'''simple docstring''' import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class UpperCAmelCase__ ( unittest.TestCase ): """simple docstri...
271
1
'''simple docstring''' from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class a : """simple docstring""" SCREAMING_SNAKE_CASE : torch.Tensor # [batch_size x 3] SCREAMING_SNAKE_CASE : torch.Tenso...
240
'''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/LI...
240
1
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class A__ ( __UpperCAmelCase ): """simple docstring""" __A : str = (EulerDiscreteScheduler,) __A : Optional[Any] ...
99
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils imp...
99
1
"""simple docstring""" import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class _a ( _a ): _l...
370
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
0
'''simple docstring''' from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi...
134
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def _...
134
1
"""simple docstring""" UpperCAmelCase: List[str] = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, )...
336
"""simple docstring""" import argparse from collections import defaultdict def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ): _lowercase : str = F"""{file}_{class_name}_{test_n...
336
1
"""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 lowerCamelCase__ = """src/diffusers""" # Matches is_xxx_available() lowerCamelCase__ = re.compil...
86
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @requ...
86
1
from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('3.8'): import importlib_metadata else: import importlib.metadata as importlib_metadata __UpperCAmelCase = '' if...
28
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Co...
28
1
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=lowercase_ ) class a__ ( lowercase_ ): __lowerCAmelCase =...
202
"""simple docstring""" import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models....
213
0
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class lowerCAmelCase__ ( __lowercase...
364
from __future__ import annotations def __magic_name__ ( __lowerCAmelCase : list , __lowerCAmelCase : int | None = None , __lowerCAmelCase : int | None = None ) -> None: if start is None: __lowerCamelCase = 0 if end is None: ...
339
0
'''simple docstring''' import unittest from transformers import DonutProcessor lowerCamelCase : Tuple = 'naver-clova-ix/donut-base' class __lowerCAmelCase (unittest.TestCase ): '''simple docstring''' def UpperCamelCase__ (self : int ): '...
2
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path _snake_case : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) _snake_case : list[int] = [ord(letter) for letter in string.ascii_l...
284
0
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : list[str] | None = None ,lowerCamelCase_ : dict[str, float] | None = None ,lowerCamelCase_ : bool = False ,): '''simple docstring''' lowerCAmelCase__ : str = c...
361
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : List[Any]=1024 ,lowerCamelCase_ : in...
94
0
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = SwinConfig(image_size=192 ...
57
'''simple docstring''' def snake_case_ ( __SCREAMING_SNAKE_CASE : int ): """simple docstring""" lowercase_ : Optional[int] = int(__SCREAMING_SNAKE_CASE ) if decimal in (0, 1): # Exit cases for the recursion ...
93
0
"""simple docstring""" from __future__ import annotations __lowercase = 8.988e9 # units = N * m^s * C^-2 def lowerCAmelCase (__UpperCamelCase : float , __UpperCamelCase : float , __UpperCamelCase : float , __UpperCamelCase : float ): """simple docstring""...
351
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowercase = { '''configuration_conditional_detr''': [ '''CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''C...
85
0
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowerCamelCase = { '''tiny.en''': '''https://openaipublic.azureedge.net/main/whisper/mo...
131
def _A ( SCREAMING_SNAKE_CASE__ : list[int] , SCREAMING_SNAKE_CASE__ : list[int] ): UpperCamelCase :Tuple = len(SCREAMING_SNAKE_CASE__ ) print('''The following activities are selected:''' ) # The first activity is always selected UpperCamelCase ...
259
0
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType ...
289
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : List[str] = { """s-JoL/Open-Llama-V1""": """https://huggingface.co/s-JoL/Open-Llam...
289
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _lowerCamelCase : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Op...
28
'''simple docstring''' import inspect import unittest from transformers import ConvNextConfig 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_backbone_commo...
28
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { 'microsoft/unispeech-sat-base-100h-libri-ft': ( 'https://huggi...
355
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorch...
11
0
'''simple docstring''' import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () lowerCamelCase__ = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining an...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def lowerCamelCase__ ( a , a=() , a=None , a="no" , a="29500" ) -> int: _A: Dict = False _A: D...
301
import os from pathlib import Path def lowerCamelCase__ ( ) -> Optional[Any]: from torch.utils.cpp_extension import load _A: str = Path(a ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _A: Tuple = [ root / filename for filename...
301
1
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 UpperCAmelCase__ : List[str] = logging.get_logger(__name__) UpperCAme...
121
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase__ : Any = logging.get_logger(__name__) class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ...
121
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''...
217
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { '''abeja/gpt-neox-japanese-2.7b''': '''https://huggingface.co/abeja/gpt-neox-japanese-2.7b...
217
1
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from t...
66
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class _lowerCAmelCase ( unittest.TestCase ): """simple docstring""" def snake_case ( ...
293
0
# 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 # # Unless...
125
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase = { '''configuration_layoutlmv3''': [ '''L...
125
1
"""simple docstring""" from math import ceil def _lowerCAmelCase ( UpperCamelCase_ = 1001 ): __SCREAMING_SNAKE_CASE = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): __SCREAMING_SNAKE_CASE = 2 * i + 1 __SCREAMING_SNAKE_CASE = 2 * i __SC...
100
from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class __UpperCAmelCase : def __magic_name__ ( self : int, __A : Dict ): raise NotImplementedError() def ...
336
0
'''simple docstring''' import fire from utils import calculate_rouge, save_json def __UpperCamelCase ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase=None, **_UpperCAmelCase ): __UpperCAmelCase : Optional[Any] = [x.strip() for x in open(_UpperCAmelCase ).readlines(...
37
'''simple docstring''' from __future__ import annotations import collections import pprint from pathlib import Path def __UpperCamelCase ( _UpperCAmelCase ): return "".join(sorted(_UpperCAmelCase ) ) def __UpperCamelCase ( _UpperCAmelCase ): return word_by_signature[signatu...
37
1
import string import numpy def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): """simple docstring""" return b if a == 0 else greatest_common_divisor(b % a , UpperCAmelCase_ ) class _snake_case : SCREAMING_SNAKE_CASE__ = ...
94
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
11
0
from ..utils import DummyObject, requires_backends class lowerCAmelCase_ ( metaclass=a__ ): UpperCAmelCase__ : Union[str, Any] = ["onnx"] def __init__( self, *SCREAMING_SNAKE_CASE_, **SCREAMING_SNAKE_CASE_ ) -> List[Any]: requires_backends(se...
103
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import numpy as np import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor import transformers from trans...
103
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowerCAmelCase__ = loggin...
104
def lowercase__ ( __snake_case : list ): '''simple docstring''' for i in range(len(__snake_case ) - 1 , 0 , -1 ): UpperCAmelCase_ : Dict = False for j in range(__snake_case , 0 ,...
29
0
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 import MAX_SHARD_SIZE from dataset...
358
import unittest import numpy as np from transformers import DistilBertConfig, 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 jnp ...
342
0
'''simple docstring''' import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToke...
31
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCamelCase_ ( _UpperCAmelCase : di...
31
1
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeling...
358
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger A: List[Any] = get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( enum.Enum ): __lowerCAmelCase : Dict = 'all_...
76
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : float ) -> float: '''simple docstring''' return 10 - x * x def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float ) -> float: '''simple docstring''' ...
1
"""simple docstring""" from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class _A : def A__ ( self , __lowerCAmelCase ): """simple docstri...
197
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase_ ( metaclass=lowercase_ ): lowerCamelCase : Dict = ["flax"] def __init__( self : List[Any] , *UpperCAmelCase__ : str , **UpperCAmelCase__ : str ) -> ...
353
'''simple docstring''' def a_ ( ): lowerCAmelCase = [] lowerCAmelCase = 1 while len(lowerCamelCase ) < 1e6: constant.append(str(lowerCamelCase ) ) i += 1 lowerCAmelCase = ''.join(lowerCamelCase ) return ( int(co...
55
0
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[str] , lowerCAmelCase__ : flo...
13
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import Tensor...
157
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCamelCase : Any = {"configuration_vit_mae": ["VIT_MAE_PRETRAINED_CONF...
249
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from trans...
249
1
import pprint import requests UpperCamelCase__ = 'https://zenquotes.io/api' def lowerCAmelCase_ ( ) -> list: '''simple docstring''' return requests.get(API_ENDPOINT_URL + "/today" ).json() def lowerCAmelCase_ ( ) -> ...
65
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
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 = { '''andreasmadsen/...
312
"""simple docstring""" __UpperCamelCase = 256 # Modulus to hash a string __UpperCamelCase = 100_0003 def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> bool: snake_case_ = len(UpperCAmelCase ) snake_case_ = len(UpperCAmelCase ) if p_len > t_len: ...
312
1
def UpperCamelCase ( __lowercase : Dict ,__lowercase : int ): '''simple docstring''' return x if y == 0 else greatest_common_divisor(lowercase__ ,x % y ) def UpperCamelCase ( __lowercase : Union[str, Any] ,__lowercase : List[Any] ):...
140
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def _lowerCamelCase( lowercase__=None ...
295
0
"""simple docstring""" def __lowercase ( _a ): return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(_a ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''').testmod()
358
"""simple docstring""" import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/r...
155
0
from math import factorial __UpperCamelCase : dict[str, int] = {str(digit): factorial(digit) for digit in range(10)} def a_ ( _A ) -> int: """simple docstring""" if not isinstance(_A , _A ): raise TypeError('Parameter number...
307
import random from typing import Any def a_ ( _A ) -> list[Any]: """simple docstring""" for _ in range(len(_A ) ): snake_case__ = random.randint(0 , len(_A ) - 1 ) snake_case__ = random.randin...
307
1
"""simple docstring""" import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef UpperCAmelCase : Optional[Any] = ( """...
359
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators ...
313
0
'''simple docstring''' import numpy as np def lowerCamelCase (_SCREAMING_SNAKE_CASE : np.array ): return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
27
"""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, PreTrainedTokenizer from ...utils import logging A_ : List[Any] = logging.get_logger(__na...
165
0
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channe...
347
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class __lowerCAmelCase ( __magic_name__ ): UpperCamelCase__ = (IPNDMScheduler,) UpperCamelCase__ = (('''num_inference_steps''', 50),) d...
347
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black _lowercase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # Th...
74
'''simple docstring''' # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase): __lowerCAmelCase = { '''en''': '''Machine learning is great, isn\'t it?''', '''ru''': '''...
174
0
"""simple docstring""" import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCa...
359
"""simple docstring""" import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutpu...
163
0
"""simple docstring""" import re def lowercase (_lowerCAmelCase ): if len(re.findall("""[ATCG]""" , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError("""Invalid Strand""" ) return dna.translate(dna.maketrans("""ATCG""" , """TAGC""" ) ) if...
301
"""simple docstring""" from __future__ import annotations from statistics import mean def lowercase (_lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ): __lowerCAmelCase = [0] * no_of_processes __lowerCAmelCase = [0] * no_of_processes # Initializ...
301
1
"""simple docstring""" import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python uti...
369
"""simple docstring""" import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mod...
289
0
'''simple docstring''' import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase ( __snake_case ): '''simple docstring''' lowerCAmelCase_ = (EulerDiscre...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase = { 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], ...
341
1
"""simple docstring""" import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): """simple docstring""" def snake_case_ ( self): __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = [0] __SCREAMING_SNAKE...
255
"""simple docstring""" import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTes...
255
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 import ( ...
316
"""simple docstring""" def A ( snake_case :int , snake_case :int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
316
1
'''simple docstring''' import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import Confi...
25
'''simple docstring''' def lowercase (_A = 1_0_0_0_0_0_0 ): """simple docstring""" _lowerCAmelCase : Any = set(range(3 , _A , 2 ) ) primes.add(2 ) for p in range(3 , _A , 2 ): ...
25
1
"""simple docstring""" from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def _lowerCamelCase ( _UpperCamelCase = True , *_UpperCamelCase , **_UpperCamelCase ): '''simple docstring''' if not is_tqdm_availa...
57
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 _snake_case : List[Any] = logging.get_logger(__name__) _snake_case : List[Any] ...
284
0
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes __magic_name__ = [(''...
357
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @req...
186
0
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def lowerCAmelCase_ ( __a ) -> Dict: ...
10
'''simple docstring''' from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_availabl...
265
0
def __a ( lowerCAmelCase_ : str ,lowerCAmelCase_ : int ) -> str: '''simple docstring''' UpperCAmelCase_= [[] for _ in range(lowerCAmelCase_ )] UpperCAmelCase_= key - 1 if key <= 0: raise ValueError("""Height of grid can't b...
277
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, ...
277
1
"""simple docstring""" class __A : def __init__( self , a__ , a__ , a__ ): _lowerCAmelCase : Optional[Any] = name _lowerCAmelCase : List[str] = value _lowerCAmelCase : int = weight ...
44
"""simple docstring""" import requests from bsa import BeautifulSoup def a_ ( lowerCamelCase , lowerCamelCase ): UpperCAmelCase__ = BeautifulSoup(requests.get(lowerCamelCase , params=lowerCamelCase ).content , 'html.parser' ) UpperCAmelCa...
98
0
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput f...
249
'''simple docstring''' import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration _lowerCamelCase : Dict = [ # tf -> hf ("/", "."), ("la...
249
1
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( A_ ): A__ : Dict = (DDIMParallelScheduler,) A__ : Tuple = (("eta", 0.0), ("num_inference_steps", 50)) def ...
59
def UpperCamelCase ( __lowerCamelCase : str , __lowerCamelCase : int ): snake_case : list[list[str]] = [[] for _ in range(__lowerCamelCase )] snake_case : int = key - 1 if key <= 0: raise ValueError("Height o...
59
1
"""simple docstring""" from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import T...
271
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a = ...
271
1
def __UpperCAmelCase ( __a : int ) -> "list[int]": """simple docstring""" if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) _a : Optional[Any] = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 _a ...
235
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ = logging.get_logger(__name__) a__ = { '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/...
235
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[Any] = logging.get_logger(__name__) A_ : Any = { "google/pegasus-large": "https://huggingface.co/google/pegasus-large/resolve/main/config.json", # See all...
358
"""simple docstring""" # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position A_ : Union[str, Any] = "2.13.1" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < ve...
316
0