code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, ...
573
"""simple docstring""" from __future__ import annotations class lowercase__ : '''simple docstring''' def __init__( self , snake_case ) -> None: _UpperCAmelCase = order # a_{0} ... a_{k} _Upp...
573
1
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIFICATIO...
704
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, ne...
622
0
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_comm...
90
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING snake_case__ : str = logging.get_logger(__name__) snake_case__ : Union[str, Any] = { '''SenseTime/deformable-detr''': '''https://hu...
392
0
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def lowerCamelCase__ ( a , a=1000 ): if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __snake_case = n - 1 __snake_case ...
427
'''simple docstring''' import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
427
1
'''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, TrainingJ...
675
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer i...
675
1
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available():...
446
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : Dict = logging.get_logger(__name__) UpperCAmelCase__ : int = { """abeja/gpt-neox-japanese-2.7b""": """https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config....
446
1
"""simple docstring""" A_ : List[Any] =8.31_4462 # Unit - J mol-1 K-1 def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float , snake_case : float )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('Invalid inputs. ...
650
"""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(): ...
650
1
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available...
114
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase : Union[str, Any] = {'''configuration_xglm''':...
114
1
"""simple docstring""" from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar _lowerCAmelCase : List[str] = TypeVar('''T''') class A_ ( Generic[T] ): lowerCAmelCase__ = 42 # Cache store of keys lowerCA...
46
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GENER...
298
0
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_safe...
718
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 from torch.utils.data impor...
219
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase ) class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE_CASE : ...
605
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not postfix_notation: return 0 _SCREAMING_SNAKE_CASE = {'+', '-', '*', '/'} _SCREAMING_SNAKE_CASE = [] f...
605
1
import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import is_soundf...
704
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging snake_case...
535
0
from ....configuration_utils import PretrainedConfig from ....utils import logging __snake_case : Dict =logging.get_logger(__name__) __snake_case : Optional[Any] ={ 'Visual-Attention-Network/van-base': ( 'https://huggingface.co/Visual-Attention-Network/van-base/blob/ma...
647
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE_ = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """tokenization_ctrl...
237
0
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __lowercase( __snake_case : str ,__snake_case : Union[str, Any] ,__snake_case : Union[str, Any]=10_24 ,__sna...
700
from ..utils import DummyObject, requires_backends class _lowerCamelCase (metaclass=lowerCamelCase ): lowercase__ = ["""flax"""] def __init__( self , *SCREAMING_SNAKE_CASE_ , **SCREAMING_SNAKE_CASE_ ): requires_backends(self , ['flax...
345
0
# Copyright 2022 The HuggingFace Team and The OpenBMB 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 # # U...
243
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase =logging.get_logger(__name__) lowerCamelCase ={ "abeja/gpt-neox-japanese-2.7b": "https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json", } class _lowerCamelCase ( UpperCamelCase_...
285
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusi...
579
"""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 a ( unittest.TestCase ): """simple docs...
579
1
import random def _A ( lowerCAmelCase_ : Dict , lowerCAmelCase_ : int , lowerCAmelCase_ : Any ): """simple docstring""" lowerCAmelCase__ = a[left_index] lowerCAmelCase__ = left_index + 1 for j in range(left_index + 1 ...
61
"""simple docstring""" import argparse import os 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_task_guides.py lowercase__ : Optional[int] = '''src/tr...
123
0
# Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version snake_ca...
705
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from .modeling_utils ...
638
0
import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig, AutoModelForMaskedLM...
53
def a_ ( lowerCAmelCase_ : int = 200_0000 ): __lowerCAmelCase = [0 for i in range(n + 1 )] __lowerCAmelCase = 1 __lowerCAmelCase = 1 for i in range(2, int(n**0.5 ) + 1 ): if primality_list[i] == 0: for...
53
1
def _UpperCamelCase ( lowercase__=28123 ): __SCREAMING_SNAKE_CASE : Tuple = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1 ): sum_divs[k * i] += k + i ...
260
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase : Optional[Any] ={'configuration_focalnet': ['FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FocalNetConfig']} try: if not...
260
1
import unittest 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 ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import torc...
6
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 Conf...
622
0
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available...
715
from collections.abc import Generator def A ( ) -> Generator[int, None, None]: UpperCamelCase__ , UpperCamelCase__ :str = 0, 1 while True: UpperCamelCase__ , UpperCamelCase__ :Tuple = b, a + b yield b def A ( lowercase__ : int =...
383
0
from __future__ import annotations def _a ( lowercase__ : list[float] ): '''simple docstring''' if len(lowercase__ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise Value...
85
import copy import random from transformers import CLIPTokenizer class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): """simple docstring""" super().__init__(*a__ , **a__) ...
114
0
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class __A: def __init__( self, A=2, A=3, A=64, A=None ): """simple docstring""" _UpperCamelCase = ...
105
from math import factorial def SCREAMING_SNAKE_CASE ( lowerCAmelCase = 20 ): _UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _UpperCamelCase = n // 2 return int(factorial(l...
105
1
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def snake_case (UpperCamelCase : str , UpperCamelCase : Any , UpperCamelCase : List[str] ): '''si...
165
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @req...
165
1
'''simple docstring''' import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def a__ ( _SCREAMING_SNAKE_CASE : Any , _SCREAMING_SNAKE_CASE : Union[str, Any] , _SCREAMING_SNAKE_CASE : Tuple , _SCREAMI...
708
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { """andreasmad...
323
0
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accelera...
113
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_a...
113
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = { 'configuration_albert': ['ALBERT_PRETRAINE...
713
from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configur...
142
0
import re from filelock import FileLock try: import nltk a : Optional[int] = True except (ImportError, ModuleNotFoundError): a : Union[str, Any] = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.down...
63
"""simple docstring""" from math import sqrt def UpperCAmelCase ( A : int = 100_0000 ): '''simple docstring''' _UpperCAmelCase = 0 _UpperCAmelCase = 0 _UpperCAmelCase = 42 while num_cuboids <= limit: max_cuboid_size += 1 ...
573
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
701
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
689
0
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def _A ( lowerCAmelCase_ : Optional[int] ): """simple d...
61
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : str = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['GitProcessor'...
614
0
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device a_ = False class snake_case ( ...
621
"""simple docstring""" 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 BatchFe...
621
1
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def _snake_case (__lowercase , __lowercase=() , __lowercase=None , __lowercase="no"...
23
"""simple docstring""" import argparse import gc import json import os import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acc...
506
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 _snak...
413
from __future__ import annotations from collections.abc import Iterator class UpperCamelCase_ : '''simple docstring''' def __init__( self , _UpperCAmelCase): lowerCAmelCase_ = value lowerCAmelCase_ = None lowerCAme...
413
1
'''simple docstring''' import heapq def _lowercase ( lowerCamelCase__ ) -> set[int]: """simple docstring""" __UpperCAmelCase : list[list] = [] # for each node and his adjacency list add them and the rank of the node to queue ...
168
'''simple docstring''' import unittest 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 ImageProcessingSavingTestMixin, prepare_image_inputs i...
168
1
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, ...
94
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": lowercase : List[str] = argparse.ArgumentParser() parser.add_argument('--dump_path', default=Non...
94
1
'''simple docstring''' from collections.abc import Sequence def __UpperCAmelCase ( a_: Sequence[float], a_: bool = False ): if not arr: return 0 _UpperCAmelCase : Any = 0 if allow_empty_subarrays else float("-inf" ) _UpperCAmelCase : str = 0.0 ...
494
'''simple docstring''' 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 __a ...
494
1
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class _a ( __a ): """simple docstring""" A = (DDPMScheduler,) def __a ( self ,**__SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_C...
719
'''simple docstring''' 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, flip_channel_order, get_resize_output_image_size, rescale, ...
220
0
"""simple docstring""" def __lowerCamelCase ( lowerCAmelCase__ ,lowerCAmelCase__ ): A__ = len(lowerCAmelCase__ ) A__ = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) c...
260
"""simple docstring""" 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 SCREAMING_SNAKE_CASE : Tuple ...
260
1
"""simple docstring""" from __future__ import annotations def A_ ( UpperCAmelCase__ ) -> Any: a : Union[str, Any] = 2 a : Optional[int] = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append...
714
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar SCREAMING_SNAKE_CASE__ : Tuple = TypeVar("T") class A_ ( Generic[T] ): """simple docstring""" def __init__( self , __UpperCAmel...
509
0
"""simple docstring""" import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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...
200
"""simple docstring""" import argparse import collections import os 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_table.py __snake_case = 'src/transfor...
200
1
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 _lowerCamelCase( _a ): lowercase_ : Optional[int] = """Salesforce/blip-image-capti...
707
import logging import os import sys from pathlib import Path from unittest.mock import patch from parameterized import parameterized from run_eval import run_generate from run_eval_search import run_search from transformers.testing_utils import CaptureStdout, TestCasePlus, slow from utils import ROUGE_KEYS loggi...
354
0
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
9
'''simple docstring''' import math def __snake_case ( lowercase : Optional[Any] , lowercase : List[str] ): if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(lowercase ) else: if x == 0...
508
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''', '''CLIPSegTextConfig''', '''CLI...
189
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": _A : str = argparse.ArgumentParser() parser.add_argument('''--dump_path''', default=None, type=str, req...
189
1
"""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 = logging.get_logger(__name__) _snake_case = { "kssteven/ibe...
510
"""simple docstring""" def snake_case ( _a: list )-> bool: '''simple docstring''' if not isinstance(_a , _a ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(_a ) == 0: raise ValueError('Input list must...
510
1
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_de...
715
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. 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...
124
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _a : Tuple = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', 'EncodecConfig', ], 'feat...
598
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import requ...
598
1
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from...
527
from itertools import count def lowercase_ ( _UpperCamelCase = 50 ): '''simple docstring''' __lowercase = [1] * min_block_length for n in count(_UpperCamelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCamelCase , n + 1 ): ...
527
1
lowerCamelCase__ = {str(digit): digit**5 for digit in range(10)} def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : int ): """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_SCREAMING_SNAKE_CASE ) ) def lowerCAmelCase__ ( ): """...
225
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging lowerCamelCase__ = logging.get_logger(__name__) def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : Tuple=None , _SCREAMING_S...
225
1
# 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 # # Unless required ...
707
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRobertaModel ...
31
from __future__ import annotations def a_ ( UpperCamelCase_ : int | str ) -> bool: """simple docstring""" lowerCamelCase = str(UpperCamelCase_ ) return n == n[::-1] def a_ ( UpperCamelCase_ : int = 1_0_0_0_0_0_0 ) -> Optional[in...
246
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { "configuration_clip": [ "CLIP_PRETRAINED_CONFIG_...
705
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
0
def __lowerCAmelCase ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): lowercase__ = [1] for i in range(2 , SCREAMING_SNAKE_CASE_ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" lowercase__ = [] lowercase__ ...
413
'''simple docstring''' def lowerCamelCase__ ( SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : int ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(SCREAMING_SNAKE_CASE ) ) ...
447
0
'''simple docstring''' import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): ...
716
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class a ( __SCREAMING_SNAKE_CASE ): """simple docstring""" def UpperCAmelCase_ ( self : List[str] , lowerCamelCase__ : float ...
362
0
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
152
'''simple docstring''' import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated __a: Tuple = collections.namedtuple("""_Datasets""", [...
152
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) lowercase...
276
'''simple docstring''' import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def __UpperCamelCase ( __lowerCamelCase : BertModel , __lowerCamelCase : str , __lowerCamelCase : str ) -> List[str]: '''simp...
276
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) _a : str = { "xlm-robe...
168
'''simple docstring''' from __future__ import annotations def _lowercase ( lowerCamelCase__ ) -> float: """simple docstring""" __UpperCAmelCase : Any = 0.00 __UpperCAmelCase : Union[str, Any] = 0 for resistor...
168
1
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 ( IMAGENET_ST...
684
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.auto.modeling_tf_auto imp...
684
1
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available...
70
'''simple docstring''' __A : List[Any] = { 0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f', } def UpperCAmelCase ( lowerCamelCase_ :float ...
334
0
'''simple docstring''' from __future__ import annotations from collections import deque class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self : List[str] , UpperCamelCase__ : Optional[int] ): """simple doc...
717
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _lowerCamelCase : List[str] = datasets.load_iris() _lowerCamelCase : Optional[Any] = np.array(data["data"]) _lowerCamelCa...
324
0
def _snake_case ( __snake_case ): _UpperCamelCase = int(__snake_case ) if decimal in (0, 1): # Exit cases for the recursion return str(__snake_case ) _UpperCamelCase , _UpperCamelCase = divmod(__snake_case , 2 ) return binary_rec...
10
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a : Optional[Any] = logging.get_logger(__name__) a : Dict = { """caidas/swin2sr-classicalsr-x2-64""": ( """https://huggingface.c...
218
0
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStra...
595
"""simple docstring""" import unittest 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 ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_avail...
595
1
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def lowerCamelCase_ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase = None , ...
141
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers.models.wavaveca imp...
576
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """bert-base-uncased""": """https://huggin...
702
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """roberta-base""": """https://huggingface...
669
0
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=__a) class _UpperCAmelCase ( __a): # `task` is not a Class...
238
"""simple docstring""" from ...processing_utils import ProcessorMixin class _UpperCAmelCase ( __a): __a : Optional[Any] = """SpeechT5FeatureExtractor""" __a : Dict = """SpeechT5Tokenizer""" def __init__( self , _A , ...
238
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase__ = { 'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'], 'tokenization_canine': ['CanineTokeni...
217
"""simple docstring""" from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = 10**-10 ) ->float: a__: int = a while True: a__: ...
217
1
'''simple docstring''' # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tes...
92
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. UpperCamelCase_ = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of ...
92
1
'''simple docstring''' from manim import * class UpperCAmelCase ( lowercase_): """simple docstring""" def UpperCamelCase__ ( self : List[str] ) -> str: _UpperCamelCase =Rectangle(height=0.5 , width=0.5 ) _UpperCamelCase =...
271
'''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...
271
1
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
41
import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( '''The conver...
279
0
'''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_...
716
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFea...
697
0
"""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__": _UpperCamelCase = pd.read_csv('sample_d...
179
"""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_sentencepiec...
179
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=1337 , num_examples=42 , dataset...
365
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/resolve/main/compressi...
365
1
"""simple docstring""" import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_fla...
76
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ : Optional[int] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], }...
105
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} try: if not is_torch_...
447
from math import sqrt def _lowerCAmelCase ( __lowerCamelCase : int ): """simple docstring""" 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, all even numbers, all multiples of 3 are not primes r...
447
1
'''simple docstring''' import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py __a = """.""" # Internal TensorFlow ...
374
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class __SCREAMING_SNAKE_CASE( a_...
328
0
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dat...
714
"""simple docstring""" from __future__ import annotations def snake_case (A_ :float , A_ :float , A_ :float ): '''simple docstring''' if (voltage, current, resistance).count(0 ) != 1: raise ValueError('One and only one argument must be 0' ) if resistance < 0...
118
0
'''simple docstring''' def a ( lowerCamelCase__ ): '''simple docstring''' if p < 2: raise ValueError("""p should not be less than 2!""" ) elif p == 2: return True A_ : Dict = 4 A_ : List[str] = (1 << p) - 1 for _ in range(p - 2 ...
667
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor lowerCamelCase :int = logging.getLogger(__name__) lowerCa...
667
1
import re def _a ( UpperCamelCase_ : str ) -> list: """simple docstring""" return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def _a ( UpperCamelCase_ : str ) -> str: """simple docstring""" lower...
115
import random def _a ( UpperCamelCase_ : int ) -> bool: """simple docstring""" lowerCAmelCase__ = num - 1 lowerCAmelCase__ = 0 while s % 2 == 0: lowerCAmelCase__ = s // 2 t += 1 for _ in range...
115
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase : Tuple = { 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } tr...
50
from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__: List[str] = logging.get_logger(__name__) __magic_name__: str = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } class snake_case__ ...
324
0
import numpy class lowerCamelCase_ : def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): a_ = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument i...
403
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
403
1
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase=5 ) -> Tuple: '''simple docstring''' assert masked_input.count("<mask...
46
'''simple docstring''' def _UpperCAmelCase ( __A : int ): a_ : Optional[Any] = [] a_ : Optional[Any] = [] a_ : List[str] = { '''^''': 3, '''*''': 2, '''/''': 2, '''%''': 2, '''+''': 1, ...
466
0
# This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def __SCREAMING_SNAKE_CASE ( lowerCAmel...
717
import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput SCREAMING_SNAKE_CASE_ = 'scheduler_config.json' class a ( UpperCAmelCase ): ...
467
0
import numpy as np import qiskit def lowerCAmelCase( __lowerCamelCase = 8 , __lowerCamelCase = None ): __a = np.random.default_rng(seed=__lowerCamelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. __a = 6 * key_...
559
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowerCamelCase_ : Optional[int] = argparse.ArgumentParser() parser.add_argument( """--checkpoint_path""", default=None, type=str, requ...
559
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) UpperCAmelCase = {'''configuration_beit''': ['''BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BeitConfig''', '''BeitOnnxConfig'''...
565
from math import factorial UpperCAmelCase = {str(d): factorial(d) for d in range(10)} def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ): return sum(DIGIT_FACTORIAL[d] for d in str(__SCREAMING_SNAKE_CASE ) ) def UpperCAmelCase_ ( ): lowercase = ...
565
1
"""simple docstring""" import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) ...
260
"""simple docstring""" class snake_case_ : """simple docstring""" def __init__( self , __a ): """simple docstring""" A__ = len(__a ) A__ = [0] * len_array if len_array > 0: A__ = a...
260
1
"""simple docstring""" from collections.abc import Callable import numpy as np def lowerCAmelCase_ ( UpperCamelCase__ : Callable , UpperCamelCase__ : float , UpperCamelCase__ : float , UpperCamelCase__ : float , UpperCamelCase__ : float ): """simple docstr...
718
"""simple docstring""" import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, ...
442
0
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeature...
303
"""simple docstring""" import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __magic_name__ : O...
281
0
'''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: pass else:...
715
'''simple docstring''' def _a( UpperCamelCase__ : str, UpperCamelCase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] =len(UpperCamelCase__ ) SCREAMING_SNAKE_CASE__ : Optional[Any] ...
665
0
"""simple docstring""" 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 OptionalDepend...
52
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __SCREAMING_SNAKE_CASE : List[Any] ={'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG...
428
0
def UpperCamelCase_( __magic_name__ : str ): """simple docstring""" return credit_card_number.startswith(('34', '35', '37', '4', '5', '6') ) def UpperCamelCase_( __magic_name__ : str ): """simple docstring""" _lower...
709
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a = { """configuration_data2vec_audio""": ["""DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Data2VecAudioConfig"""], """configuration_data2v...
382
0
import random def lowerCAmelCase_ (lowercase__ : list , lowercase__ : int ) -> tuple: '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ = [], [], [] for element in data: if element < pivot...
668
from collections import deque class lowerCAmelCase_ : def __init__( self : Optional[Any] , SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ): lowerCAmelCase__ = process_name # process name lowerC...
668
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCAmelCase : List[Any] = {"""tokenization_wav2vec2_phoneme""": ["""Wav2Vec2PhonemeCTCTokenizer"""]} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else:...
425
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes f...
425
1
"""simple docstring""" import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, ...
83
"""simple docstring""" import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( '''files''', [ ['''full:README.md''', '''dataset_infos.json'''], ['''empty:READM...
83
1
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.routing import...
701
'''simple docstring''' import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_a...
267
0
"""simple docstring""" import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __A = logging.get_logger(__name__) def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CA...
93
# Copyright 2023 The HuggingFace Inc. 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 # # Unl...
304
0
from typing import Dict, Optional import numpy as np import datasets UpperCamelCase__ : List[Any] = "\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and the ground truth. For binary (two classes) or mu...
711
def _UpperCAmelCase ( _SCREAMING_SNAKE_CASE : int = 200 ): """simple docstring""" SCREAMING_SNAKE_CASE_ = [1, 2, 5, 10, 20, 50, 100, 200] SCREAMING_SNAKE_CASE_ = [0] * (pence + 1) SCREAMING_SNAKE_CASE_ = 1 # base case: 1 way to make...
620
0
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_availab...
215
"""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 FlaxX...
103
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCamelCase : Any = logging.get_logger(__name__) _lowerCamelCase : str = { """SenseTime/deformable-...
512
'''simple docstring''' import colorsys from PIL import Image # type: ignore def _lowerCAmelCase ( __a , __a , __a ) -> float: '''simple docstring''' _UpperCamelCase :Dict =x _UpperCamelCase :Any =y for step in range(__a ): ...
512
1
"""simple docstring""" import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size ...
224
"""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/LICENS...
224
1
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowercase__ ( _UpperCamelCase) -> List[Any]: """simple docstring""" UpperCamelCase = [ 'encoder.version', 'decod...
714
from manim import * class A__ ( __snake_case ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Any ): """simple docstring""" UpperCamelCase = Rectangle(height=0.5 , w...
410
0