code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
def lowerCAmelCase_ ( _snake_case : int ) -> list[int]: '''simple docstring''' if length <= 0 or not isinstance(_snake_case , _snake_case ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(_snake_case )] if _...
41
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[Any] = { "junnyu/roformer_chin...
41
1
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup snake_case : int = logging.get_logger(__name__) class _snake_cas...
41
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
41
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalDetrForSegmentation, ...
41
def lowerCAmelCase_ ( _snake_case : int ) -> bool: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : Union[str, Any] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) ...
41
1
import os from math import logaa def lowerCAmelCase_ ( _snake_case : str = "base_exp.txt" ) -> int: '''simple docstring''' __magic_name__ : float = 0 __magic_name__ : Tuple = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(_snake_ca...
41
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that eac...
41
1
from functools import lru_cache def lowerCAmelCase_ ( _snake_case : int ) -> set: '''simple docstring''' __magic_name__ : List[str] = 2 __magic_name__ : List[str] = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(...
41
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) snake_case : List[str] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}...
41
1
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow snake_case : str = False class _snake_case ( unittest.TestCase ): def SCREAMING_SNA...
41
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : Dict = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_case ( data...
41
1
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
41
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
41
1
from __future__ import annotations def lowerCAmelCase_ ( _snake_case : list[int] , _snake_case : int , _snake_case : int , _snake_case : int ) -> None: '''simple docstring''' if (direction == 1 and array[indexa] > array[indexa]) or ( dir...
41
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' assert isinstance(_snake_case , _snake_case ), F'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __magic_name__ : Dict = F'''T...
41
1
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils ...
41
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 _snake_case ( snake_case ): UpperCamelCase__ = ...
41
1
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() snake_case : int = logging.get_logger(__name__) snake_case : Optional[Any] = {name: getattr(transformers, name + "Fast") f...
41
def lowerCAmelCase_ ( _snake_case : int , _snake_case : Optional[int] ) -> List[Any]: '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCAmelCase_ ( _snake_case : List[Any] , _snake_case : Option...
41
1
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger snake_case : Union[str, Any] = "<<<<<<< This should probably be modified because it mentions: " snake_case : List[str]...
41
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils ...
41
1
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging snake_case : List[Any] = logging.get_logger(__name__) class _snake_case ( snake_case ): UpperCamelCase__ = C...
41
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ) ...
41
1
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( C...
41
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Union[str, Any] = data __magic_name__ : str = None class _snake_case : def __init__( self ): __magic_name__ : List[str] ...
41
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case : Union[str, Any] = { "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"], "configuration_data2v...
41
from __future__ import annotations snake_case : Optional[int] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class _snake_case : def __init__( self , _a , ...
41
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Dict = logging.get_logger(__name__) snake_case : Optional[int] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json", # See all Don...
41
import numpy class _snake_case : def __init__( self , _a , _a ): __magic_name__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is the #...
41
1
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : Dict = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_case ( data...
41
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 ...test_pipeline_mixin impor...
41
1
from __future__ import annotations def lowerCAmelCase_ ( _snake_case : float , _snake_case : float , _snake_case : float , ) -> tuple[str, float]: '''simple docstring''' if (stress, tangential_force, area).count(0 ) != 1: raise ValueError("You ...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Dict = logging.get_logger(__name__) snake_case : Optional[int] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json", # See all Don...
41
1
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMixin class _snake_cas...
41
import re import string import numpy as np import datasets snake_case : 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" snake_case : Optional[Any] = "\nArgs:\n predict...
41
1
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 _snake_case ( snake_case ): UpperCamelCase__ = ...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Union[str, Any] = { "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json", } class _snake_...
41
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[int] = logging.get_logger(__name__) snake_case : Optional[Any] = { "google/vivit-b-16x2-kinetics400": ( "https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/...
41
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
41
1
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available from ...
41
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available from ...
41
1
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_common import Tok...
41
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
41
1
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _snake_case ( snake_case ): UpperCamelCase__ = CustomTokenizer pass
41
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[Any] = { "junnyu/roformer_chin...
41
1
def lowerCAmelCase_ ( _snake_case : int = 1000 ) -> int: '''simple docstring''' __magic_name__ : Dict = -1 __magic_name__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c __...
41
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
41
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Any = logging.get_logger(__name__) snake_case : Any = { "edbeeching/decision-transformer-gym-hopper-medium": ( "https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medi...
41
def lowerCAmelCase_ ( _snake_case : int ) -> bool: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : Union[str, Any] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) ...
41
1
import os def lowerCAmelCase_ ( ) -> Union[str, Any]: '''simple docstring''' with open(os.path.dirname(_snake_case ) + "/grid.txt" ) as f: __magic_name__ : str = [] # noqa: E741 for _ in range(20 ): l.append([int(_snake_case ) for x in f.read...
41
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that eac...
41
1
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parametri...
41
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) snake_case : List[str] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}...
41
1
import os import string import sys snake_case : List[Any] = 1 << 8 snake_case : Union[str, Any] = { "tab": ord("\t"), "newline": ord("\r"), "esc": 27, "up": 65 + ARROW_KEY_FLAG, "down": 66 + ARROW_KEY_FLAG, "right": 67 + ARROW_KEY_FLAG, "left": 68 + ARROW_KEY_...
41
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : Dict = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_case ( data...
41
1
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached_file, get_file_...
41
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
41
1
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer snake_case : int = logging.get_logger(__name__) snake_case ...
41
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' assert isinstance(_snake_case , _snake_case ), F'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __magic_name__ : Dict = F'''T...
41
1
import copy import random from transformers import CLIPTokenizer class _snake_case ( snake_case ): def __init__( self , *_a , **_a ): super().__init__(*_a , **_a ) __magic_name__ : Union[str, Any] = {} def SCREAMI...
41
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 _snake_case ( snake_case ): UpperCamelCase__ = ...
41
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : List[Any] = logging.get_logger(__name__) snake_case : Optional[Any] =...
41
def lowerCAmelCase_ ( _snake_case : int , _snake_case : Optional[int] ) -> List[Any]: '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCAmelCase_ ( _snake_case : List[Any] , _snake_case : Option...
41
1
from __future__ import annotations def lowerCAmelCase_ ( _snake_case : int | float | str , _snake_case : int | float | str ) -> list[str]: '''simple docstring''' if nth_term == "": return [""] __magic_name__ : Any = int(_snake_case ) __magic...
41
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils ...
41
1
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMixi...
41
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ) ...
41
1
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : List[str] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if nu...
41
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Union[str, Any] = data __magic_name__ : str = None class _snake_case : def __init__( self ): __magic_name__ : List[str] ...
41
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : str = logging.get_logger(__name__) snake_case : Any = { "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json", "google/fnet-large": "https://huggingface....
41
from __future__ import annotations snake_case : Optional[int] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class _snake_case : def __init__( self , _a , ...
41
1
import random from typing import Any def lowerCAmelCase_ ( _snake_case : list ) -> list[Any]: '''simple docstring''' for _ in range(len(_snake_case ) ): __magic_name__ : Any = random.randint(0 , len(_snake_case ) - 1 ) __magic_...
41
import numpy class _snake_case : def __init__( self , _a , _a ): __magic_name__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is the #...
41
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) snake_case : List[str] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}...
41
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 ...test_pipeline_mixin impor...
41
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[Any] = { "junnyu/roformer_chin...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Dict = logging.get_logger(__name__) snake_case : Optional[int] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json", # See all Don...
41
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import ConfigTester from...
41
import re import string import numpy as np import datasets snake_case : 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" snake_case : Optional[Any] = "\nArgs:\n predict...
41
1
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _snake_case ( unittest.TestCase , snake_case ): def SCREAMING_SNAKE_CASE ( self ): __magic_name__ : List[str] = load_tool("text-classification" )...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Union[str, Any] = { "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json", } class _snake_...
41
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available snake_case : List[Any] = { "configuration_mvp": ["MVP_PRETRAINED_CONFIG_ARCHIVE_MAP", "MvpConfig", "MvpOnnxConfig"], "tokenization_mvp": ["MvpTokenizer...
41
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
41
1
import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from trans...
41
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available from ...
41
1
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): raise ValueError("multiplicative_persistence() only accepts integral values" ) if num < 0: raise ValueError("multiplicative_persistence() doe...
41
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
41
1
snake_case : List[str] = "Alexander Joslin" import operator as op from .stack import Stack def lowerCAmelCase_ ( _snake_case : str ) -> int: '''simple docstring''' __magic_name__ : Any = {"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub} __...
41
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[Any] = { "junnyu/roformer_chin...
41
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor snake_case : Tuple = logging.get_logger(__name__) class _snake_case ( snake_case ): def __init__( self , *_a , **_a ): warnings.warn( "The ...
41
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
41
1
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, ) snake_case : int = { "configuration_clip": [ "CLIP_PRETRA...
41
def lowerCAmelCase_ ( _snake_case : int ) -> bool: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : Union[str, Any] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) ...
41
1
from collections.abc import Sequence def lowerCAmelCase_ ( _snake_case : Sequence[float] , _snake_case : float ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_snake_case ) ) def lowerCAmelCase_ ( _snake_case ...
41
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that eac...
41
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltForQ...
41
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) snake_case : List[str] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}...
41
1
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 snake_case : str = "▁" snake_case : int = {"vocab_file": "spiece.model"} snake_case ...
41
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : Dict = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_case ( data...
41
1
import operator as op snake_case : Union[str, Any] = "scaler.pt" snake_case : Any = "pytorch_model" snake_case : str = "random_states" snake_case : Optional[Any] = "optimizer" snake_case : Optional[int] = "scheduler" snake_case : Tuple ...
41
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
41
1
import unittest import numpy as np def lowerCAmelCase_ ( _snake_case : np.ndarray , _snake_case : np.ndarray , _snake_case : np.ndarray , _snake_case : np.ndarray | None = None , ) -> np.ndarray: '''simple docstring''' __magic_name__ : ...
41
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' assert isinstance(_snake_case , _snake_case ), F'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __magic_name__ : Dict = F'''T...
41
1
def lowerCAmelCase_ ( _snake_case : str ) -> int: '''simple docstring''' assert column_title.isupper() __magic_name__ : List[Any] = 0 __magic_name__ : Optional[int] = len(_snake_case ) - 1 __magic_name__ : Optional[Any] = 0 w...
41
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 _snake_case ( snake_case ): UpperCamelCase__ = ...
41
1
from __future__ import annotations def lowerCAmelCase_ ( _snake_case : list[int] , _snake_case : int ) -> list[list[int]]: '''simple docstring''' __magic_name__ : list[list[int]] = [] __magic_name__ : list[int] = [] __magic_name__ ...
41
def lowerCAmelCase_ ( _snake_case : int , _snake_case : Optional[int] ) -> List[Any]: '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCAmelCase_ ( _snake_case : List[Any] , _snake_case : Option...
41
1
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that eac...
41
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils ...
41
1
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean snake_case : Tuple = 0 snake_case : str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, ...
41
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ) ...
41
1
def lowerCAmelCase_ ( _snake_case : List[Any] ) -> Optional[Any]: '''simple docstring''' __magic_name__ , __magic_name__ : List[str] = [], [] while len(_snake_case ) > 1: __magic_name__ , __magic_name__ : List[Any] = min(_snake_...
41
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Union[str, Any] = data __magic_name__ : str = None class _snake_case : def __init__( self ): __magic_name__ : List[str] ...
41
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case : Tuple = { "configuration_mobilebert": [ "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
41
from __future__ import annotations snake_case : Optional[int] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class _snake_case : def __init__( self , _a , ...
41
1
import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _snake_case ( snake_case , unittest.TestCase ): UpperCamelCase__ = PhobertTokenizer Upper...
41
import numpy class _snake_case : def __init__( self , _a , _a ): __magic_name__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is the #...
41
1
import pytest import datasets # Import fixture modules as plugins snake_case : Union[str, Any] = ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def lowerCAmelCase_ ( _snake_case : Optional[int] , _snake_case : List[str] ) -> Optional[Any...
41
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 ...test_pipeline_mixin impor...
41
1
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ) ...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Dict = logging.get_logger(__name__) snake_case : Optional[int] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json", # See all Don...
41
1
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available f...
41
import re import string import numpy as np import datasets snake_case : 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" snake_case : Optional[Any] = "\nArgs:\n predict...
41
1
import heapq as hq import math from collections.abc import Iterator class _snake_case : def __init__( self , _a ): __magic_name__ : Any = str(id_ ) __magic_name__ : Any = None __magic_name__ : List[str] = None __magic...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Union[str, Any] = { "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json", } class _snake_...
41
1
# Function to print upper half of diamond (pyramid) def lowerCAmelCase_ ( _snake_case : Tuple ) -> Optional[Any]: '''simple docstring''' for i in range(0 , _snake_case ): for _ in range(0 , n - i - 1 ): # printing spaces print(" " , end...
41
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
41
1
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def lowerCAmelCase_ ( _snake_case : List[str] ) -> Tuple: '''simple docstring''' __magic_name__ : Dict = [ "encoder.version", ...
41
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available from ...
41
1
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _snake_case ( snake_case ): UpperCamelCase__ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE ( self , **_a ): __magic_name__ : List[Any...
41
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
41
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_configur...
41
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[Any] = { "junnyu/roformer_chin...
41
1
from __future__ import annotations import requests snake_case : Any = set( "approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categories created_utc d...
41
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
41
1
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging snake_case : int = logging.get_logger(__name__) snake_case : List[Any] = { "t5-small": "https://huggingface.co/t5-small/resolve/m...
41
def lowerCAmelCase_ ( _snake_case : int ) -> bool: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : Union[str, Any] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) ...
41
1
from manim import * class _snake_case ( snake_case ): def SCREAMING_SNAKE_CASE ( self ): __magic_name__ : Any = Rectangle(height=0.5 , width=0.5 ) __magic_name__ : Dict = Rectangle(height=0.25 , width=0.25 ) __m...
41
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that eac...
41
1
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def lowerCAmelCase_ ( _snake_case : Union[str, Any] ) -> Dict: '''simple docstring''' __magic_name__ : Tuple = S...
41
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) snake_case : List[str] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}...
41
1
from __future__ import annotations from statistics import mean def lowerCAmelCase_ ( _snake_case : list[int] , _snake_case : list[int] , _snake_case : int ) -> list[int]: '''simple docstring''' __magic_name__ : Dict = [0] * no_of_process...
41
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : Dict = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_case ( data...
41
1
def lowerCAmelCase_ ( _snake_case : list ) -> float: '''simple docstring''' __magic_name__ : Any = 0 while len(_snake_case ) > 1: __magic_name__ : List[Any] = 0 # Consider two files with minimum cost to be merged for _ in range(2 ): ...
41
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
41
1
snake_case : Optional[int] = "\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingface/t...
41
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' assert isinstance(_snake_case , _snake_case ), F'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __magic_name__ : Dict = F'''T...
41
1
snake_case : Optional[int] = {str(digit): digit**5 for digit in range(10)} def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_snake_case ) ) def lowerCAmelCase_ ( ) ...
41
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 _snake_case ( snake_case ): UpperCamelCase__ = ...
41
1
from typing import List import numpy as np def lowerCAmelCase_ ( _snake_case : dict ) -> int: '''simple docstring''' __magic_name__ : Any = {key: len(_snake_case ) for key, value in gen_kwargs.items() if isinstance(_snake_case , _snake_case )...
41
def lowerCAmelCase_ ( _snake_case : int , _snake_case : Optional[int] ) -> List[Any]: '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCAmelCase_ ( _snake_case : List[Any] , _snake_case : Option...
41
1
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device snake_case : str = False class _snake_case ( unittest.TestCase ): pass @...
41
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils ...
41
1
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> int: '''simple docstring''' if len(_snake_case ) != len(_snake_case ): raise ValueError("String lengths must match!" ) __magic_name__ : Dict = 0 for chara, chara in zip...
41
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ) ...
41
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices snake_case : Optional[int] = logging.get_logger(__name__) snake_case : int = { "microsoft/focalnet-tiny...
41
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Union[str, Any] = data __magic_name__ : str = None class _snake_case : def __init__( self ): __magic_name__ : List[str] ...
41
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : Optional[Any] = {"configuration_unispeech": ["UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP", "UniSpeechConfig"]} t...
41
from __future__ import annotations snake_case : Optional[int] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class _snake_case : def __init__( self , _a , ...
41
1
snake_case : Optional[int] = range(2, 20 + 1) snake_case : Any = [10**k for k in range(ks[-1] + 1)] snake_case : dict[int, dict[int, list[list[int]]]] = {} def lowerCAmelCase_ ( _snake_case : List[Any] , _snake_case : Tuple , _snake_case ...
41
import numpy class _snake_case : def __init__( self , _a , _a ): __magic_name__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is the #...
41
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Any = logging.get_logger(__name__) snake_case : Any = { "hustvl/...
41
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 ...test_pipeline_mixin impor...
41
1
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar snake_case : Union[str, Any] = TypeVar("KEY") snake_case : Optional[Any] = TypeVar("VAL") @dataclass(frozen=snake_case , slots=snake_case ) class _...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Dict = logging.get_logger(__name__) snake_case : Optional[int] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json", # See all Don...
41
1
def lowerCAmelCase_ ( _snake_case : float , _snake_case : int ) -> float: '''simple docstring''' if digit_amount > 0: return round(number - int(_snake_case ) , _snake_case ) return number - int(_snake_case ) if __name__ == "__main__": pri...
41
import re import string import numpy as np import datasets snake_case : 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" snake_case : Optional[Any] = "\nArgs:\n predict...
41
1
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( A...
41
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Union[str, Any] = { "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json", } class _snake_...
41
1
import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import...
41
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
41
1
def lowerCAmelCase_ ( _snake_case : int ) -> str: '''simple docstring''' __magic_name__ : Any = int(_snake_case ) if decimal in (0, 1): # Exit cases for the recursion return str(_snake_case ) __magic_name__ , __magic_name__ : List[Any] ...
41
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available from ...
41
1
from __future__ import annotations snake_case : List[str] = "Muhammad Umer Farooq" snake_case : List[str] = "MIT" snake_case : Optional[int] = "1.0.0" snake_case : Union[str, Any] = "Muhammad Umer Farooq" snake_case : str = "contact@muhammadumerfar...
41
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
41
1
from __future__ import annotations import unittest from transformers import 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, random_attention_mask from ...test_pipeline...
41
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[Any] = { "junnyu/roformer_chin...
41
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot import Blend...
41
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
41
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_tor...
41
def lowerCAmelCase_ ( _snake_case : int ) -> bool: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : Union[str, Any] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) ...
41
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
41
from scipy.stats import pearsonr import datasets snake_case : Tuple = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that eac...
41
1
def lowerCAmelCase_ ( _snake_case : int , _snake_case : int ) -> int: '''simple docstring''' return abs(_snake_case ) if a == 0 else greatest_common_divisor(b % a , _snake_case ) def lowerCAmelCase_ ( _snake_case : int , _snake...
41
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) snake_case : List[str] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]}...
41
1
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import require_tensorflow_text, require_...
41
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : Dict = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_case ( data...
41
1
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipe...
41
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
41
1
class _snake_case : def __init__( self , _a ): __magic_name__ : Optional[Any] = val __magic_name__ : List[Any] = None __magic_name__ : str = None def SCREAMING_SNAKE_CASE ( self , _a ): if s...
41
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' assert isinstance(_snake_case , _snake_case ), F'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: __magic_name__ : Dict = F'''T...
41
1
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _snake_case ( snake_case , snake_case ): @register_to_config def __init__( self , *, _a = 4 , _a = 768 ,...
41
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 _snake_case ( snake_case ): UpperCamelCase__ = ...
41
1
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Union[str, Any] = data __magic_name__ : str = None class _snake_case : def __init__( self ): __magic_name__ : List[str] ...
41
def lowerCAmelCase_ ( _snake_case : int , _snake_case : Optional[int] ) -> List[Any]: '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCAmelCase_ ( _snake_case : List[Any] , _snake_case : Option...
41
1
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_...
41
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils ...
41
1
import qiskit def lowerCAmelCase_ ( _snake_case : int , _snake_case : int ) -> qiskit.result.counts.Counts: '''simple docstring''' __magic_name__ : List[str] = qiskit.Aer.get_backend("aer_simulator" ) # Create a Quantum Circuit acting on the q...
41
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ) ...
41
1