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 os def _lowercase ( ) -> Optional[Any]: """simple docstring""" __UpperCAmelCase : Tuple = os.path.join(os.path.dirname(lowerCamelCase__ ) , "num.txt" ) with open(lowerCamelCase__ ) as fi...
10
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _a : str = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_A...
10
1
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : int = str(id_ ) __UpperCAmelCase : ...
10
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a : ...
10
1
'''simple docstring''' import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _a : List[Any] = "__DUMMY_TRANSFORMERS_USER__" _a : str = "Dummy User" _a : str = "hf...
10
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( ...
10
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" return number | (1 << position) def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: ...
10
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
10
1
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import t...
10
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) ...
10
1
'''simple docstring''' import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def _lowercase ( ...
10
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : int = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main...
10
1
'''simple docstring''' import math class __A : def _snake_case ( self , UpperCamelCase_ , UpperCamelCase_ ): __UpperCAmelCase : Dict = 0.0 __UpperCAmelCase : List[str] = 0.0 ...
10
'''simple docstring''' def _lowercase ( lowerCamelCase__ = 100 ) -> int: """simple docstring""" __UpperCAmelCase : Optional[Any] = (n * (n + 1) // 2) ** 2 __UpperCAmelCase : Any = n * (n + 1) * (2 * n + 1) // 6 retu...
10
1
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __A (unittest.TestCase ): ...
10
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: rai...
10
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _a : str = logging.get_logger(__name__) _a : Optional[int] = { "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/reso...
10
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _a : Union[str, Any] = HfApi() _a : int = {} # fmt: off _a : Optional[int] = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347,...
10
1
'''simple docstring''' from __future__ import annotations import math import numpy as np from numpy.linalg import norm def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b ...
10
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See all Cvt model...
10
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 __A (unittest.TestCase ): def _snake_case ...
10
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , ) -> list[float]: ...
10
1
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
10
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Any = prime_factors(lowerCamelCase__ ...
10
1
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_visio...
10
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _a : Dict = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG...
10
1
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _lowercase ( ) -> Dict: """simple docstring""" __UpperCAmelCase : str = HfArgumentParser(lowerCamelCase__ ) __Upper...
10
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : List[str] = logging.get_logger(__name__) _a : Any = { "kssteven/ibe...
10
1
'''simple docstring''' from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def _lowercase ( ) -> Union[str, Any]: """simple docstring""" __UpperCAmelCase : List[Any] ...
10
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _lowercase ( ) -> Dict: """simple docstring""" __UpperCAmelCase : str = HfArgumentParser(lowerCamelCase__ ) __Upper...
10
1
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMu...
10
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, ...
10
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See all Cvt model...
10
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import t...
10
1
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e ...
10
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumer...
10
1
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class __A (__magic_name__ , __magic_name__ ): @re...
10
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" return number | (1 << position) def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: ...
10
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : List[Any] = logging.get_logger(__name__) _a : List[Any] = { "facebook/timesformer": "https://huggingface.co/facebook/timesformer/resolve/main/config.json", } ...
700
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _a : str = datasets.load_iris() _a : List[Any] = np.array(data["data"]) _a : Optional[Any] = np.array(data["ta...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ = 10**9 ) -> Optional[int]: """simple docstring""" __UpperCAmelCase : Tuple = 1 __UpperCAmelCase : List[Any] = 2 __UpperCAmelCase : int = 0 ...
701
'''simple docstring''' class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : Any = set_counts __UpperCAmelCase : int = max(UpperCamelCase_ ) __UpperCAmelCase : List[...
10
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _a : List[str] = logging.get_logger(__name__) _a : int = { 'micros...
702
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> List[str]: """simple docstring""" __UpperCAmelCase : Dict = (boundary[1] - boundary[0]) / steps __UpperCAmelCase : Tuple = boundary[0...
10
0
'''simple docstring''' import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow fro...
703
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _a : str = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_A...
10
0
'''simple docstring''' _a : List[Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git ''' _a ...
704
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a : ...
10
0
'''simple docstring''' import json import logging import os import sys from time import time from unittest.mock import patch from transformers.testing_utils import TestCasePlus, require_torch_tpu logging.basicConfig(level=logging.DEBUG) _a : List[Any] = logging.getLogger() def _lo...
705
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( ...
10
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : Tuple = logging.get_logger(__name__) _a : List[str] = { "distilbert-base-uncased": "https://hugging...
706
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
10
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _a : Tuple = logging.get_lo...
707
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) ...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Dict = len(__A ), len(grid[0] ) if ...
708
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : int = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main...
10
0
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaV...
709
'''simple docstring''' def _lowercase ( lowerCamelCase__ = 100 ) -> int: """simple docstring""" __UpperCAmelCase : Optional[Any] = (n * (n + 1) // 2) ** 2 __UpperCAmelCase : Any = n * (n + 1) * (2 * n + 1) // 6 retu...
10
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : Optional[Any] = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ] } try: if not is_torch_available():...
710
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: rai...
10
0
'''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_inp...
711
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _a : Union[str, Any] = HfApi() _a : int = {} # fmt: off _a : Optional[int] = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347,...
10
0
'''simple docstring''' from __future__ import annotations def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> list[str]: """simple docstring""" if nth_term == "": return [""] __UpperCAmelCase : str = int(_...
712
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See all Cvt model...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> Optional[int]: """simple docstring""" if not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): raise ValueError("iterations must be defined as...
713
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , ) -> list[float]: ...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ ) -> Union[str, Any]: """simple docstring""" assert isinstance(__A , __A ), f"""The input value of [n={number}] is not an integer""" if number == 1: return 2 ...
714
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Any = prime_factors(lowerCamelCase__ ...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ ) -> List[Any]: """simple docstring""" __UpperCAmelCase : list[list[float]] = [] for data in source_data: for i, el in enumerate(_lowerCamelCase ): ...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _a : Dict = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG...
10
0
'''simple docstring''' _a : int = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ,...
716
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : List[str] = logging.get_logger(__name__) _a : Any = { "kssteven/ibe...
10
0
'''simple docstring''' 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 ( i...
717
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _lowercase ( ) -> Dict: """simple docstring""" __UpperCAmelCase : str = HfArgumentParser(lowerCamelCase__ ) __Upper...
10
0
'''simple docstring''' import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torc...
718
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, ...
10
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _a : int = { """configuration_swiftformer""": [ """SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SwiftFo...
719
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import t...
10
0
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def _lowercase ( lowerCamelCase_...
720
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumer...
10
0
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_...
721
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" return number | (1 << position) def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: ...
10
0
'''simple docstring''' import numpy as np def _lowercase ( lowerCamelCase__ ) -> np.ndarray: """simple docstring""" return 1 / (1 + np.exp(-vector )) def _lowercase ( lowerCamelCase__ ) -> np.ndarray: """simple d...
700
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _a : str = datasets.load_iris() _a : List[Any] = np.array(data["data"]) _a : Optional[Any] = np.array(data["ta...
10
0
'''simple docstring''' import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand _a : Optional[Any] = ( "4S 3H 2C 7S 5H", "9D 8H 2C 6S 7H", "2D 6D 9D TH 7D", "TC 8C 2S JH 6C", "JH 8S TH AH QH", "TS K...
701
'''simple docstring''' class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : Any = set_counts __UpperCAmelCase : int = max(UpperCamelCase_ ) __UpperCAmelCase : List[...
10
0
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformer...
702
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> List[str]: """simple docstring""" __UpperCAmelCase : Dict = (boundary[1] - boundary[0]) / steps __UpperCAmelCase : Tuple = boundary[0...
10
0
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowercase ( lowerCamelCase__="ro" , lowerCamelCase__="en" , lowerCamelCase__="wmt16" , lowerCamelCase__=None ) -> Optional[int]: """simple docstring""" ...
703
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _a : str = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_A...
10
0
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_visio...
704
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a : ...
10
0
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
705
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( ...
10
0
import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() _a : List[Any] = logging.get_logger(__name__) def _lo...
706
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
10
0
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class __A (_UpperCAmelCase ): snake_case :int = (CMStochasticIterativeScheduler,) snake_case :int ...
707
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) ...
10
0
'''simple docstring''' import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accele...
708
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : int = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main...
10
0
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" if ( (c...
709
'''simple docstring''' def _lowercase ( lowerCamelCase__ = 100 ) -> int: """simple docstring""" __UpperCAmelCase : Optional[Any] = (n * (n + 1) // 2) ** 2 __UpperCAmelCase : Any = n * (n + 1) * (2 * n + 1) // 6 retu...
10
0
import collections import importlib.util import os import re from pathlib import Path _a : Tuple = "src/transformers" # Matches is_xxx_available() _a : Tuple = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} _a : List[str] = re.compi...
710
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: rai...
10
0
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransforme...
711
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _a : Union[str, Any] = HfApi() _a : int = {} # fmt: off _a : Optional[int] = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347,...
10
0
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _lowercase ( ) -> List[str]: """simple docstring""" __UpperCAmelCase : ...
712
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See all Cvt model...
10
0
'''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 _lowercase ( lowerCamelCase__ ...
713
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , ) -> list[float]: ...
10
0
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torch...
714
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Any = prime_factors(lowerCamelCase__ ...
10
0
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class ...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _a : Dict = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG...
10
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _a : Dict = { '''configuration_mobilenet_v2''': [ '''MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Mobi...
716
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : List[str] = logging.get_logger(__name__) _a : Any = { "kssteven/ibe...
10
0
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers im...
717
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _lowercase ( ) -> Dict: """simple docstring""" __UpperCAmelCase : str = HfArgumentParser(lowerCamelCase__ ) __Upper...
10
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule _a : Optional[int] = {"processing_wav2vec2_with_lm": ["Wav2Vec2ProcessorWithLM"]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys _...
718
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, ...
10
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available():...
719
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import t...
10
0
'''simple docstring''' import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem _a : Optional[Any] = importlib.util.find_spec("s3fs") is not Non...
720
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumer...
10
0
'''simple docstring''' import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex _a : Optional[int] = logging.getLogger(__name__) class __A : ...
721
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" return number | (1 << position) def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: ...
10
0
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
700
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _a : str = datasets.load_iris() _a : List[Any] = np.array(data["data"]) _a : Optional[Any] = np.array(data["ta...
10
0
'''simple docstring''' import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configura...
701
'''simple docstring''' class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : Any = set_counts __UpperCAmelCase : int = max(UpperCamelCase_ ) __UpperCAmelCase : List[...
10
0
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar _a : List[str] = TypeVar("T") class __A (Generic[T] ): def __init__( self , UpperCamelCase_ , ...
702
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> List[str]: """simple docstring""" __UpperCAmelCase : Dict = (boundary[1] - boundary[0]) / steps __UpperCAmelCase : Tuple = boundary[0...
10
0
'''simple docstring''' import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download i...
703
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _a : str = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_A...
10
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from tr...
704
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a : ...
10
0
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __A ...
705
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( ...
10
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, ) _a : Any = { "configuration_owlvit": [ "OWLVIT...
706
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
10
0
'''simple docstring''' import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_par...
707
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) ...
10
0
'''simple docstring''' from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class __A : def _snake_case ( self , UpperCamelCase_ ): raise NotImpleme...
708
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : int = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> Union[str, Any]: """simple docstring""" __UpperCAmelCase : Union[str, Any] = len(snake_case_ ) print("The following activities are selected:" ...
709
'''simple docstring''' def _lowercase ( lowerCamelCase__ = 100 ) -> int: """simple docstring""" __UpperCAmelCase : Optional[Any] = (n * (n + 1) // 2) ** 2 __UpperCAmelCase : Any = n * (n + 1) * (2 * n + 1) // 6 retu...
10
0
import collections import importlib.util import os import re from pathlib import Path _a : List[str] = 'src/transformers' # Matches is_xxx_available() _a : Union[str, Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} _a : Tuple = ...
710
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: rai...
10
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _a : Union[str, An...
711
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _a : Union[str, Any] = HfApi() _a : int = {} # fmt: off _a : Optional[int] = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347,...
10
0
'''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/L...
712
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See all Cvt model...
10
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : int = logging.get_logger(__name__) _a : Tuple = { "facebook/data2ve...
713
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , ) -> list[float]: ...
10
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _a : List[str] = logging.get_logger(__name__) _a : Dict = { "microsoft/focalnet-tiny...
714
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Any = prime_factors(lowerCamelCase__ ...
10
0
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _a : Dict = get_tests_dir("fixtures/test_sent...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _a : Dict = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG...
10
0
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTes...
716
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : List[str] = logging.get_logger(__name__) _a : Any = { "kssteven/ibe...
10
0
'''simple docstring''' from __future__ import annotations class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : List[Any] = TypeError( "Matrices must be formed from a list of zero or more lists con...
717
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _lowercase ( ) -> Dict: """simple docstring""" __UpperCAmelCase : str = HfArgumentParser(lowerCamelCase__ ) __Upper...
10
0
'''simple docstring''' import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand _a : Tuple = ( "4S 3H 2C 7S 5H", "9D 8H 2C 6S 7H", "2D 6D 9D TH 7D", "TC 8C 2S JH 6C", "JH 8S TH AH QH", "TS KS 5S 9S ...
718
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, ...
10
0
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_avail...
719
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import t...
10
0
'''simple docstring''' import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef _a : List[Any] = ( "This metric will ...
720
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumer...
10
0
'''simple docstring''' import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef _a : List[str] = ( """This metric will be remov...
721
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" return number | (1 << position) def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: ...
10
0
'''simple docstring''' import math def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Union[str, Any] = [] __UpperCAmelCase : Tuple = 2 __UpperCAmelCase : int = i...
700
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _a : str = datasets.load_iris() _a : List[Any] = np.array(data["data"]) _a : Optional[Any] = np.array(data["ta...
10
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...
701
'''simple docstring''' class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : Any = set_counts __UpperCAmelCase : int = max(UpperCamelCase_ ) __UpperCAmelCase : List[...
10
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> int: """simple docstring""" if len(SCREAMING_SNAKE_CASE_ ) != len(SCREAMING_SNAKE_CASE_ ): raise ValueError("String lengths must match!" ) ...
702
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> List[str]: """simple docstring""" __UpperCAmelCase : Dict = (boundary[1] - boundary[0]) / steps __UpperCAmelCase : Tuple = boundary[0...
10
0
'''simple docstring''' import importlib.metadata import operator import re import sys from typing import Optional from packaging import version _a : Optional[Any] = { "<": operator.lt, "<=": operator.le, "==": operator.eq, "!=": operator.ne, ">=": operator.ge, ...
703
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _a : str = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_A...
10
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _a : int = { "configuration_ctrl": ["CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CTRLConfig"], "tokenization_ctrl": ["CTRLTokenize...
704
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a : ...
10
0
'''simple docstring''' from __future__ import annotations _a : Optional[Any] = '''Muhammad Umer Farooq''' _a : List[Any] = '''MIT''' _a : List[str] = '''1.0.0''' _a : Union[str, Any] = '''Muhammad Umer Farooq''' _a : Any = '''contact@muhammadumerfar...
705
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( ...
10
0
def _lowercase ( lowerCamelCase__ = 5000_0000 ) -> Tuple: """simple docstring""" __UpperCAmelCase : int = set() __UpperCAmelCase : List[str] = int((limit - 24) ** (1 / 2) ) __UpperCAmelCase : Any = set(...
706
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): impor...
10
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : List[Any] = logging.get_logger(__name__) _a : Dict = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } clas...
707
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) ...
10
0
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ....
708
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : int = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main...
10
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __A (metaclass=_A ): snake_case :Union[str, Any] = ["torch", "transformers", "onnx"] def __init__( self , *UpperCamelCase_ , **UpperCamelCase_ ...
709
'''simple docstring''' def _lowercase ( lowerCamelCase__ = 100 ) -> int: """simple docstring""" __UpperCAmelCase : Optional[Any] = (n * (n + 1) // 2) ** 2 __UpperCAmelCase : Any = n * (n + 1) * (2 * n + 1) // 6 retu...
10
0
import json import logging import os import sys from time import time from unittest.mock import patch from transformers.testing_utils import TestCasePlus, require_torch_tpu logging.basicConfig(level=logging.DEBUG) _a : Optional[int] = logging.getLogger() def _lowercase ( lowerCamelCas...
710
'''simple docstring''' def _lowercase ( lowerCamelCase__ , lowerCamelCase__ ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: rai...
10
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_av...
711
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _a : Union[str, Any] = HfApi() _a : int = {} # fmt: off _a : Optional[int] = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347,...
10
0
'''simple docstring''' from importlib import import_module from .logging import get_logger _a : Union[str, Any] = get_logger(__name__) class __A : def __init__( self , UpperCamelCase_ , UpperCamelCase_=None ): __...
712
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See all Cvt model...
10
0
'''simple docstring''' from manim import * class __A (__lowerCamelCase ): '''simple docstring''' def _snake_case ( self ): __UpperCAmelCase : Optional[Any] = Rectangle(height=0.5 , width=0.5 ) ...
713
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , ) -> list[float]: ...
10
0
'''simple docstring''' import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments _a : Optional[int] = logging.getLogger(__name__) @dataclass class __A (_Upper...
714
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowercase ( lowerCamelCase__ ) -> int: """simple docstring""" __UpperCAmelCase : Any = prime_factors(lowerCamelCase__ ...
10
0