code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=1_024 , lowerCAmelCase_=1_024 ...
47
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: _snake_case : Union[str, Any] = [0, ...
47
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_avail...
47
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase : Any = TypeVar('T') UpperCAmelCase : str = TypeVar('U') class lowerCamelCase (Generic[T, U] ): def __init__( self ...
47
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def _a ( lowerCAmelCase_ ): ...
47
'''simple docstring''' import os import numpy import onnx def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = a.name _snake_case : List[Any] = b.name _snake_case : Tuple = ...
47
1
'''simple docstring''' import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCAmelCase : List[Any] = logging.get_logger('transformers.models.speecht5') def _a ( lowerCAmelCase_ ,...
47
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
1
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase : Tuple = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'google/umt5-small': 'ht...
47
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImage...
47
1
'''simple docstring''' import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_av...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from...
47
1
'''simple docstring''' # XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path UpperCAmelCase : Dict = Path(__file__).resolve().parents[3] / 'src' sys.path.insert(1, str(git_repo_path)) import dataclasses...
47
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation Up...
47
1
'''simple docstring''' 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 : List[Any] = logging.get_logger(__name__) UpperCAmelCas...
47
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def _a ( lowerCAmelCase_ ): """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(lowerCAmelCase_ , 0 , lowerCAmelCa...
47
1
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) ...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
47
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impor...
47
'''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 # ...
47
1
'''simple docstring''' import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class lowerCamelCase (a__ ): _lowercase : Optional[int] = """MCTCTFeatureExtractor""" _lowercase : str = """AutoTokenizer""" def _...
47
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
47
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available UpperCAmelCase : List[Any] = {'tokenization_herbert': ['HerbertTokenizer']} try: if not is_tokenizers_available(): raise OptionalDependencyNot...
47
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d...
47
1
'''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 Padding...
47
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = 0 if start < end: ...
47
1
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase : str = logging.get_logger(__name__) UpperCAmelCase : List[Any] = [ ...
47
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : int = current_set.copy() for row_index, row in enumerate(lowerCAmelCase_ ): _snake_case : List[Any] = row[0] for column_index, column i...
47
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_t...
47
1
'''simple docstring''' from __future__ import annotations def _a ( lowerCAmelCase_ , lowerCAmelCase_ = None , lowerCAmelCase_ = None ): """simple docstring""" if start is None: _snake_case : Optional[Any] = 0 if end is None: ...
47
'''simple docstring''' from collections.abc import Generator def _a ( ): """simple docstring""" _snake_case , _snake_case : Union[str, Any] = 0, 1 while True: _snake_case , _snake_case : List[str] = b, a + b ...
47
1
'''simple docstring''' from __future__ import annotations import math def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" if depth < 0: raise ValueError('''Depth can...
47
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor UpperCAmelCase : str = logging.getLogger(__name__) UpperCAmelCas...
47
1
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
47
'''simple docstring''' from __future__ import annotations def _a ( lowerCAmelCase_ , lowerCAmelCase_ = None , lowerCAmelCase_ = None ): """simple docstring""" if start is None: _snake_case : Optional[Any] = 0 if end is None: ...
47
1
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, f...
47
'''simple docstring''' 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 i...
47
1
'''simple docstring''' import math from datetime import datetime, timedelta def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : Optional[int] = year % 19 _snake_case : str = year % 4 _snake_case : Any = year % ...
47
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) ...
47
1
'''simple docstring''' UpperCAmelCase : Optional[Any] = 'Tobias Carryer' from time import time class lowerCamelCase : def __init__( self , lowercase__ , lowercase__ , lowercase__ , lowercase__=int(time() ) ) -> Any: # noqa: B008 ...
47
'''simple docstring''' UpperCAmelCase : Union[str, Any] = tuple[float, float, float] UpperCAmelCase : int = tuple[float, float, float] def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : str = end_poin...
47
1
'''simple docstring''' 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 ...
47
'''simple docstring''' import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel UpperCAmelCase : List[st...
47
1
'''simple docstring''' import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase (a__ ): _lowercase : Union[str, Any] = (DDPMParallelScheduler,) def UpperCAmelCase_ ( self , **lowercase_...
47
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: _snake_case : Union[str, Any] = [0, ...
47
1
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) UpperCAmelCase : Union[str, Any] = { 'xlnet-base-cased': 'https://huggingface.co/xlnet-base-cased/resolve/mai...
47
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase : Any = TypeVar('T') UpperCAmelCase : str = TypeVar('U') class lowerCamelCase (Generic[T, U] ): def __init__( self ...
47
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase (metaclass=a__ ): _lowercase : Any = ["""torch""", """transformers""", """onnx"""] def __init__( self , *lowercase__ , **lowercase__ ) -> Dict: ...
47
'''simple docstring''' import os import numpy import onnx def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = a.name _snake_case : List[Any] = b.name _snake_case : Tuple = ...
47
1
'''simple docstring''' from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_av...
47
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) UpperCAmelCase :...
47
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImage...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ = 10 ): """simple docstring""" if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) or n < 0: raise ValueError('''Invalid input''' ) _snake_case : Tuple = 10**n _snake_case : Any ...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from...
47
1
'''simple docstring''' import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp fro...
47
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation Up...
47
1
'''simple docstring''' import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset UpperCAmelCase : Union[str, Any] = {1: (1, 1), 2: (2, 1), 3: (3, ...
47
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def _a ( lowerCAmelCase_ ): """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(lowerCAmelCase_ , 0 , lowerCAmelCa...
47
1
'''simple docstring''' import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, ...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
47
1
'''simple docstring''' class lowerCamelCase : def __init__( self , lowercase__ ) -> None: """simple docstring""" _snake_case : List[str] = size _snake_case : Optional[int] = [0] * size _snake_case : Optional[int...
47
'''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 # ...
47
1
'''simple docstring''' from __future__ import annotations def _a ( lowerCAmelCase_ = 4 ): """simple docstring""" _snake_case : List[Any] = abs(lowerCAmelCase_ ) or 4 return [[1 + x + y * row_size for x in range(lowerCAmelCase_ )] for y in range(lowerCAmelCa...
47
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ = 50 ): """simple docstring""" _snake_case : str = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for bloc...
47
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d...
47
1
'''simple docstring''' from collections import deque class lowerCamelCase : def __init__( self , lowercase__ , lowercase__ , lowercase__ ) -> None: """simple docstring""" _snake_case : int = process_name # process name ...
47
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = 0 if start < end: ...
47
1
'''simple docstring''' import socket def _a ( ): """simple docstring""" _snake_case : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) _snake_case : Dict = socket.gethostname() _snake_case : List[Any] = ...
47
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
47
1
'''simple docstring''' 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, MusicgenForConditionalGenerati...
47
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_t...
47
1
'''simple docstring''' from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VA...
47
'''simple docstring''' from collections.abc import Generator def _a ( ): """simple docstring""" _snake_case , _snake_case : Union[str, Any] = 0, 1 while True: _snake_case , _snake_case : List[str] = b, a + b ...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ = 1_000_000 ): """simple docstring""" _snake_case : Tuple = 1 _snake_case : Any = 1 _snake_case : Union[str, Any] = {1: 1} for inputa in range(2 , lowerCAmelCase_ ):...
47
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor UpperCAmelCase : str = logging.getLogger(__name__) UpperCAmelCas...
47
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging,...
47
'''simple docstring''' from __future__ import annotations def _a ( lowerCAmelCase_ , lowerCAmelCase_ = None , lowerCAmelCase_ = None ): """simple docstring""" if start is None: _snake_case : Optional[Any] = 0 if end is None: ...
47
1
'''simple docstring''' from __future__ import annotations import math import numpy as np from numpy.linalg import norm def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(lowerCAmelCase_ , ...
47
'''simple docstring''' 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 i...
47
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase (metaclass=a__ ): _lowercase : str = ["""note_seq"""] def __init__( self , *lowercase__ , **lowercase__ ) -> Union[str, Any]: """simple docs...
47
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) ...
47
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d...
47
'''simple docstring''' UpperCAmelCase : Union[str, Any] = tuple[float, float, float] UpperCAmelCase : int = tuple[float, float, float] def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : str = end_poin...
47
1
'''simple docstring''' from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance UpperCAmelCase : str = 6_37_81_37.0 UpperCAmelCase : List[Any] = 6_35_67_52.31_42_45 UpperCAmelCase : Union[str, Any] = 6_3_7_8_1_3_7 def _a ( ...
47
'''simple docstring''' import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel UpperCAmelCase : List[st...
47
1
'''simple docstring''' import argparse import os import evaluate 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 accele...
47
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: _snake_case : Union[str, Any] = [0, ...
47
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase : Optional[Any] = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} cla...
47
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase : Any = TypeVar('T') UpperCAmelCase : str = TypeVar('U') class lowerCamelCase (Generic[T, U] ): def __init__( self ...
47
1
'''simple docstring''' import math import flax.linen as nn import jax.numpy as jnp def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ = 1 , lowerCAmelCase_ = 1 , lowerCAmelCase_ = 1.0E4 , lowerCAmelCase_ = False , lowerCAmelCase_ = 1.0 , ...
47
'''simple docstring''' import os import numpy import onnx def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = a.name _snake_case : List[Any] = b.name _snake_case : Tuple = ...
47
1
'''simple docstring''' UpperCAmelCase : Union[str, Any] = tuple[float, float, float] UpperCAmelCase : int = tuple[float, float, float] def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : str = end_poin...
47
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
1
'''simple docstring''' import re import string import numpy as np import datasets UpperCAmelCase : Optional[Any] = '\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n' UpperCAmelCase : i...
47
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImage...
47
1
'''simple docstring''' import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : Union[str, Any] = ...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from...
47
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Tuple = logging.get_logger(__name__) UpperCAmelCase ...
47
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation Up...
47
1
'''simple docstring''' import os from pathlib import Path def _a ( ): """simple docstring""" from torch.utils.cpp_extension import load _snake_case : Tuple = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' ...
47
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def _a ( lowerCAmelCase_ ): """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(lowerCAmelCase_ , 0 , lowerCAmelCa...
47
1
'''simple docstring''' import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer UpperCAmelCase : Optional[Any] = logging.getLogger(__name__) def _a ( ): """simple docstring""" _snake_case : int ...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
47
1
'''simple docstring''' 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 util...
47
'''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 # ...
47
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCAmelCase : List[Any] = {'processing_layoutxlm': ...
47
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
47
1
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_ta...
47
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _snake_case : Optional[Any] = str(bin(lowerCAmelCase_ ) )[2:] #...
47
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = 0 if start < end: ...
47
1
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase : Any = TypeVar('T') UpperCAmelCase : str = TypeVar('U') class lowerCamelCase (Generic[T, U] ): def __init__( self ...
47
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
47
1
'''simple docstring''' import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...t...
47
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_t...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n_term == "": return [] _snake_case : list = [] for temp in range(int(lowerCAmelCase_ ) ): series.append(f'''1/{temp + 1}''' if series else '''1''' ) ...
47
'''simple docstring''' from collections.abc import Generator def _a ( ): """simple docstring""" _snake_case , _snake_case : Union[str, Any] = 0, 1 while True: _snake_case , _snake_case : List[str] = b, a + b ...
47
1
'''simple docstring''' import os UpperCAmelCase : Optional[int] = {'I': 1, 'V': 5, 'X': 1_0, 'L': 5_0, 'C': 1_0_0, 'D': 5_0_0, 'M': 1_0_0_0} def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : Optional[Any] = 0 _snake_case : Tupl...
47
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor UpperCAmelCase : str = logging.getLogger(__name__) UpperCAmelCas...
47
1
'''simple docstring''' from datetime import datetime import requests def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : str = '''https://downloadgram.net/wp-json/wppress/video-downloader/video?url=''' _snake_case : Optional[Any] = ...
47
'''simple docstring''' from __future__ import annotations def _a ( lowerCAmelCase_ , lowerCAmelCase_ = None , lowerCAmelCase_ = None ): """simple docstring""" if start is None: _snake_case : Optional[Any] = 0 if end is None: ...
47
1
'''simple docstring''' import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) -> Tuple:...
47
'''simple docstring''' 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 i...
47
1
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cache...
47
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) ...
47
1
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) -> None: """simple docstring""...
47
'''simple docstring''' UpperCAmelCase : Union[str, Any] = tuple[float, float, float] UpperCAmelCase : int = tuple[float, float, float] def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : str = end_poin...
47
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase (metaclass=a__ ): _lowercase : Any = ["""flax"""] def __init__( self , *lowercase__ , **lowercase__ ) -> Optional[int]: """simple docstring"...
47
'''simple docstring''' import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel UpperCAmelCase : List[st...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : int = [1] _snake_case , _snake_case , _snake_case : Union[str, Any] = 0, 0, 0 _snake_case : List[Any] = ugly_nums[ia] ...
47
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: _snake_case : Union[str, Any] = [0, ...
47
1
'''simple docstring''' UpperCAmelCase : Dict = [0, 2, 4, 6, 8] UpperCAmelCase : List[str] = [1, 3, 5, 7, 9] def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" if remaining_length...
47
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase : Any = TypeVar('T') UpperCAmelCase : str = TypeVar('U') class lowerCamelCase (Generic[T, U] ): def __init__( self ...
47
1
'''simple docstring''' 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 im...
47
'''simple docstring''' import os import numpy import onnx def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = a.name _snake_case : List[Any] = b.name _snake_case : Tuple = ...
47
1
'''simple docstring''' import argparse import collections import json import os import re import string import sys import numpy as np UpperCAmelCase : List[str] = re.compile(R'\b(a|an|the)\b', re.UNICODE) UpperCAmelCase : Dict = None def _a ( ): """simple do...
47
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
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, logging, ) logging.se...
47
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImage...
47
1
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAv...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ = 1 , lowerCAmelCase_ = 1_000 ): """simple docstring""" _snake_case : int = 1 _snake_case : List[str] = 0 for divide_by_number in range(lowerCAmelCase_ , digit + 1 ): ...
47
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation Up...
47
1
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar UpperCAmelCase : List[str] = TypeVar('T') class lowerCamelCase (Generic[T] ): def __init__( self , lowercase__ , lowercase_...
47
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def _a ( lowerCAmelCase_ ): """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(lowerCAmelCase_ , 0 , lowerCAmelCa...
47
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=False ): """simple docstring""" if isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): _snake_case : Union[st...
47
'''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 # ...
47
1
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def _a ( lowerCAmelCase_ ): """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(lowerCAmelCase_ , 0 , lowerCAmelCa...
47
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
47
1
'''simple docstring''' import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm m...
47
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d...
47
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImage...
47
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = 0 if start < end: ...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : Optional[int] = [] _snake_case : Optional[int] = set({'''(''', '''[''', '''{'''} ) _snake_case : List[Any] = set({''')''', ''']''', '''}'''...
47
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
47
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase : str = {'configuration_yolos': ['YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'YolosConfig', 'YolosOnnxConfig']} try: if no...
47
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_t...
47
1
'''simple docstring''' import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_logg...
47
'''simple docstring''' from collections.abc import Generator def _a ( ): """simple docstring""" _snake_case , _snake_case : Union[str, Any] = 0, 1 while True: _snake_case , _snake_case : List[str] = b, a + b ...
47
1
'''simple docstring''' from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowerCamelCase (yaml.SafeLoader ): def UpperCAmelCase_ ( self , lowercase__ ) -> Any: """simple docstring""" ...
47
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor UpperCAmelCase : str = logging.getLogger(__name__) UpperCAmelCas...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: _snake_case : Union[str, Any] = [0, ...
47
'''simple docstring''' from __future__ import annotations def _a ( lowerCAmelCase_ , lowerCAmelCase_ = None , lowerCAmelCase_ = None ): """simple docstring""" if start is None: _snake_case : Optional[Any] = 0 if end is None: ...
47
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase : int = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolv...
47
'''simple docstring''' 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 i...
47
1
'''simple docstring''' def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : Optional[int] = len(lowerCAmelCase_ ) _snake_case : List[Any] = len(lowerCAmelCase_ ) _snake_case : Any = [[False ...
47
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCamelCase (unittest.TestCase ): def UpperCAmelCase_ ( self ) ...
47
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
'''simple docstring''' UpperCAmelCase : Union[str, Any] = tuple[float, float, float] UpperCAmelCase : int = tuple[float, float, float] def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : str = end_poin...
47
1
'''simple docstring''' import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impo...
47
'''simple docstring''' import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel UpperCAmelCase : List[st...
47
1
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller UpperCAmelCase : List[str] = 3 def _a ( lowerCAmelCase_ ): """simple docstring""" print('''Generating primitive root of p''' ) ...
47
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: _snake_case : Union[str, Any] = [0, ...
47
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) UpperCAmelCase : Optional[Any] = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHI...
47
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase : Any = TypeVar('T') UpperCAmelCase : str = TypeVar('U') class lowerCamelCase (Generic[T, U] ): def __init__( self ...
47
1
'''simple docstring''' from __future__ import annotations import typing from collections import Counter def _a ( lowerCAmelCase_ ): """simple docstring""" _snake_case : typing.Counter[int] = Counter() for base in range(1 , max_perimeter + 1 ): ...
47
'''simple docstring''' import os import numpy import onnx def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : List[Any] = a.name _snake_case : List[Any] = b.name _snake_case : Tuple = ...
47
1
'''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-2...
47
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
1
'''simple docstring''' # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's ea...
47
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImage...
47
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py UpperCAmelCase : str = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n ti...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from...
47
1
'''simple docstring''' import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _a ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" _snake_case : Any = ...
47
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation Up...
47
1
'''simple docstring''' import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sq...
47
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def _a ( lowerCAmelCase_ ): """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(lowerCAmelCase_ , 0 , lowerCAmelCa...
47
1
'''simple docstring''' import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_avail...
47
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
47
1
'''simple docstring''' 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, log...
47
'''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 # ...
47
1
'''simple docstring''' from __future__ import annotations from fractions import Fraction def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) d...
47
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
47
1
'''simple docstring''' import math def _a ( lowerCAmelCase_ , lowerCAmelCase_ ): """simple docstring""" if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(SCREAMING_SNAKE_CASE_ ) else: ...
700
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d...
47
0