code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : complex , lowerCamelCase_ : str = "x" , lowerCamelCase_ : float = 10**-10 , lowerCamelCase_ : ...
105
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCamelCase__ : Dict = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**s...
105
1
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[int] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : Optional[int] = len(lowerCamelCase_ ) // 2 # choose the middle 3 elements SCREAMING_SNAKE_CASE_ ...
105
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[float] ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0.0_0 SCREAMING_SNAKE_CASE_ : Tuple = 0 for resistor in resistors: if...
105
1
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def __UpperCAmelCase ( lowerCamelCase_ : dict ) -> tu...
105
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
1
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class lowerCAmelCase_ : def __init__( self ,snake_case__ ,snake_case__=sys....
105
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
105
1
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor UpperCamelCase__ : List[Any] = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake_case_...
105
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Optional[Any] = { '''configuration_whisper''': ['''WHISPER_PRETRAINE...
105
1
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) UpperCamelCase__ : str =...
105
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __UpperCAmelCase ( lowerCamelCase_ : np.ndarray , lowerCamelCase_ : np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , ...
105
1
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 __UpperCAmelCase ( lowerCamelCa...
105
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase__ : str = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> bool: """simple docstring""" return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number ...
105
def __UpperCAmelCase ( lowerCamelCase_ : List[str] , lowerCamelCase_ : Optional[Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = [0 for i in range(r + 1 )] # nc0 = 1 SCREAMING_SNAKE_CASE_ : Dict = 1...
105
1
import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql import sql # noqa F401...
105
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Optional[int] = list_of_points # Degree determines the flexibility of the curve. ...
105
1
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): import torch ...
105
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(): from .tokenization_barthez im...
105
1
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, 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_tenso...
105
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ : Optional[int] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], }...
105
1
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Any , lowerCamelCase_ : Any ...
105
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) UpperCamelCase__ : List[Any] = pytest.mark.integration @pytest.mark.parametrize('path' , ...
105
1
import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase__ : Any = logging.get_logg...
105
import os import numpy import onnx def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : Optional[Any] ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = a.name SCREAMING_SNAKE_CASE_ : Dict = ...
105
1
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin UpperCamelCase__ : List[Any] = get_tests_...
105
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : Option...
105
1
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
105
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tenso...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> int: """simple docstring""" if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): SCREAMING_SNAKE_CASE_ : List[str] = F'Input value of [number={number}] must be an integer' raise Type...
105
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], ['d...
105
1
from typing import Any import numpy as np def __UpperCAmelCase ( lowerCamelCase_ : np.ndarray ) -> bool: """simple docstring""" return np.array_equal(lowerCamelCase_ , matrix.conjugate().T ) def __UpperCAmelCase ( lowerCamelCase_ ...
105
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__ : Any = logging.get_logger(__name__) UpperCamelCase__ : Any = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/van-base/blob/ma...
105
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : List[Any] = { '''roberta-base''...
105
import os import sys import unittest UpperCamelCase__ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dumm...
105
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCAmelCase_ ( lowerCamelCase_ ): __a : Any = ["image_processor", "tokenizer"] __a : Tuple = "ChineseCLIPImageProces...
105
def __UpperCAmelCase ( lowerCamelCase_ : str ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 0 for ch in input_str: SCREAMING_SNAKE_CASE_ : Union[str, Any] = ord(lowerCamelCase_ ) SCREAMING_SNAKE_CASE_ : Tup...
105
1
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py UpperCamelCase__ : List[str] = '''src/diffusers''' # Matches is_xxx_available() UpperCamelCase__ : Optional[int] = ...
105
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
105
1
import math import qiskit def __UpperCAmelCase ( lowerCamelCase_ : int = 1 , lowerCamelCase_ : int = 1 , lowerCamelCase_ : int = 1 ) -> qiskit.result.counts.Counts: """simple docstring""" if ( isinstance(lowerCamelCase_ , low...
105
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, ...
105
1
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Optional[int] = list_of_points # Degree determines the flexibility of the curve. ...
105
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.mo...
105
1
from __future__ import annotations class lowerCAmelCase_ : def __init__( self ,snake_case__ = 0 ): SCREAMING_SNAKE_CASE_ : Optional[int] = key def snake_case ( self ,snake_case__ ,snake_case__ ): assert isinstance(snake_case__ ...
105
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCamelCase__ : Dict = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**s...
105
1
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import torch.nn as...
105
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[float] ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0.0_0 SCREAMING_SNAKE_CASE_ : Tuple = 0 for resistor in resistors: if...
105
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : Any = { '''configuration_instructblip''': [ '''INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InstructBlipConfig''', '''InstructBli...
105
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
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_ut...
105
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
105
1
from math import factorial, pi def __UpperCAmelCase ( lowerCamelCase_ : float , lowerCamelCase_ : int = 30 ) -> float: """simple docstring""" if not isinstance(lowerCamelCase_ , (int, float) ): raise ValueError('maclaurin_sin() requires ...
105
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Optional[Any] = { '''configuration_whisper''': ['''WHISPER_PRETRAINE...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> str: """simple docstring""" if isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(lowerCamelCase_ , lowerCam...
105
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __UpperCAmelCase ( lowerCamelCase_ : np.ndarray , lowerCamelCase_ : np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , ...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : str ) -> list: """simple docstring""" if n_term == "": return [] SCREAMING_SNAKE_CASE_ : list = [] for temp in range(int(lowerCamelCase_ ) ): series.append(F'1/{temp + 1}' if series else '1' )...
105
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase__ : str = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake...
105
1
import os import sys import unittest UpperCamelCase__ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dumm...
105
def __UpperCAmelCase ( lowerCamelCase_ : List[str] , lowerCamelCase_ : Optional[Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = [0 for i in range(r + 1 )] # nc0 = 1 SCREAMING_SNAKE_CASE_ : Dict = 1...
105
1
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], ['d...
105
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Optional[int] = list_of_points # Degree determines the flexibility of the curve. ...
105
1
from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCamelCase__ : List[Any] = {'''tokenization_bertweet''': ['''BertweetTokenizer''']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys UpperCamelCase__ : List[str] ...
105
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(): from .tokenization_barthez im...
105
1
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class lowerCAmelCase_ : def __init__( self ,snake_case__=2 ,snake_case__=3 ,snake_case__=64 ,snake_case__=None ): SCREAMING_SNAKE...
105
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ : Optional[int] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], }...
105
1
import os import re import shutil import sys import tempfile import unittest import black UpperCamelCase__ : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is th...
105
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) UpperCamelCase__ : List[Any] = pytest.mark.integration @pytest.mark.parametrize('path' , ...
105
1
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from . import Bas...
105
import os import numpy import onnx def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : Optional[Any] ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = a.name SCREAMING_SNAKE_CASE_ : Dict = ...
105
1
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging UpperCamelCase__ : Any = logging.get_logger(__name__) def __UpperCAmelCase ( lowerCamelCase_ : Tup...
105
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : Option...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int = 10_00 ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 3 SCREAMING_SNAKE_CASE_ : List[str] = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif...
105
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tenso...
105
1
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : Optional[int] , lowerCamelCase_ : ...
105
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], ['d...
105
1
import os import re 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 UpperCamelCase__ : Union[str, Any] = logging.get_logger(__name__) UpperCam...
105
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__ : Any = logging.get_logger(__name__) UpperCamelCase__ : Any = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/van-base/blob/ma...
105
1
import unittest from transformers import BigBirdConfig, 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 from transformers.models.big_bird....
105
import os import sys import unittest UpperCamelCase__ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dumm...
105
1
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn f...
105
def __UpperCAmelCase ( lowerCamelCase_ : str ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 0 for ch in input_str: SCREAMING_SNAKE_CASE_ : Union[str, Any] = ord(lowerCamelCase_ ) SCREAMING_SNAKE_CASE_ : Tup...
105
1
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 ( MaxLengthCriteria, ...
105
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
105
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 lowerCAmelCase_ ( lowerCamelCase_ ): ...
105
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, ...
105
1
import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def __UpperCAmelCase ( ) ...
105
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.mo...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> int: """simple docstring""" assert isinstance(lowerCamelCase_ , lowerCamelCase_ ), F'The input value of [n={number}] is not an integer' if number == 1: return 2 elif number < 1: SCREAMING_SN...
105
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCamelCase__ : Dict = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**s...
105
1
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[float] ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0.0_0 SCREAMING_SNAKE_CASE_ : Tuple = 0 for resistor in resistors: if...
105
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[float] ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0.0_0 SCREAMING_SNAKE_CASE_ : Tuple = 0 for resistor in resistors: if...
105
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase__ : str = logging.get_logger(__name__) UpperCamelCase__ : str = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json...
105
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
1
print((lambda quine: quine % quine)('''print((lambda quine: quine %% quine)(%r))'''))
105
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
105
1
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel UpperCamelCase__ : str = False UpperCamelCase__ : List[str] = True UpperCamelCase__ : Optional[Any] = False if __name_...
105
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Optional[Any] = { '''configuration_whisper''': ['''WHISPER_PRETRAINE...
105
1
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) UpperCamelCase__ : Optional[int] = logging.getLogger() def __UpperCAmelC...
105
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __UpperCAmelCase ( lowerCamelCase_ : np.ndarray , lowerCamelCase_ : np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , ...
105
1
from manim import * class lowerCAmelCase_ ( lowerCamelCase_ ): def snake_case ( self ): SCREAMING_SNAKE_CASE_ : List[Any] = Rectangle(height=0.5 ,width=0.5 ) SCREAMING_SNAKE_CASE_ : Optional[Any] = Rectangle(height=0.46 ,wid...
105
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase__ : str = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int = 1_00_00_00 ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = 1 SCREAMING_SNAKE_CASE_ : str = 1 SCREAMING_SNAKE_CASE_ : Tuple = {1: 1} for inputa in rang...
105
def __UpperCAmelCase ( lowerCamelCase_ : List[str] , lowerCamelCase_ : Optional[Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = [0 for i in range(r + 1 )] # nc0 = 1 SCREAMING_SNAKE_CASE_ : Dict = 1...
105
1
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Optional[int] = list_of_points # Degree determines the flexibility of the curve. ...
105
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__ : Optional[int] = logging.get_logger(__name__) UpperCamelCase__ : Union[str, Any] = { '''...
105
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(): from .tokenization_barthez im...
105
1
import math def __UpperCAmelCase ( lowerCamelCase_ : float , lowerCamelCase_ : float ) -> float: """simple docstring""" if initial_intensity < 0: raise ValueError('The value of intensity cannot be negative' ) # handling of negative values...
105
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ : Optional[int] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], }...
105
1
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import ...
105
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) UpperCamelCase__ : List[Any] = pytest.mark.integration @pytest.mark.parametrize('path' , ...
105
1
from math import pow def __UpperCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int , lowerCamelCase_ : int , lowerCamelCase_ : int , lowerCamelCase_ : int , ) -> tuple[int, int]: """simple docstring""" if ...
105
import os import numpy import onnx def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : Optional[Any] ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = a.name SCREAMING_SNAKE_CASE_ : Dict = ...
105
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : Union[str, Any] = {'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_available(): raise...
105
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : Option...
105
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable UpperCamelCase__ : Union[str, Any] = {'''configuration_dpt''': ['''DPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DP...
105
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tenso...
105
1
import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import req...
105
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], ['d...
105
1
import argparse import json import subprocess def __UpperCAmelCase ( lowerCamelCase_ : Optional[Any] , lowerCamelCase_ : Optional[int] ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = [] SCREAMING_SNAKE_CASE_ ...
105
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__ : Any = logging.get_logger(__name__) UpperCamelCase__ : Any = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/van-base/blob/ma...
105
1
from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from transformers.models.fsmt.configu...
105
import os import sys import unittest UpperCamelCase__ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dumm...
105
1
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from .test_pipeline...
105
def __UpperCAmelCase ( lowerCamelCase_ : str ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 0 for ch in input_str: SCREAMING_SNAKE_CASE_ : Union[str, Any] = ord(lowerCamelCase_ ) SCREAMING_SNAKE_CASE_ : Tup...
105
1
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, U...
105
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
105
1
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class lowerCAm...
105
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, ...
105
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...
105
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.mo...
105
1
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class lowerCAmelCase_ ( lowerC...
105
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCamelCase__ : Dict = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**s...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int , lowerCamelCase_ : int ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_d...
105
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[float] ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0.0_0 SCREAMING_SNAKE_CASE_ : Tuple = 0 for resistor in resistors: if...
105
1
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(): from .tokenization_barthez im...
105
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
1
from typing import Any def __UpperCAmelCase ( lowerCamelCase_ : list ) -> list[Any]: """simple docstring""" if not input_list: return [] SCREAMING_SNAKE_CASE_ : Any = [input_list.count(lowerCamelCase_ ) for value in input_list] SCREAMIN...
105
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
105
1
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ : str = logging.get_logger(__name__) # TODO Update this UpperCamelCase__ : Any = { '''facebook/esm-1b''': '''http...
105
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Optional[Any] = { '''configuration_whisper''': ['''WHISPER_PRETRAINE...
105
1
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : Option...
105
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __UpperCAmelCase ( lowerCamelCase_ : np.ndarray , lowerCamelCase_ : np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , ...
105
1
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. UpperCamelCase__ : Tuple = 10 def __UpperCAmelCase ( lowerCamelCase_ : int , lowerCamelCa...
105
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase__ : str = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake...
105
1
from argparse import ArgumentParser from .env import EnvironmentCommand def __UpperCAmelCase ( ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : Dict = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) SC...
105
def __UpperCAmelCase ( lowerCamelCase_ : List[str] , lowerCamelCase_ : Optional[Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = [0 for i in range(r + 1 )] # nc0 = 1 SCREAMING_SNAKE_CASE_ : Dict = 1...
105
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): raise OptionalDependencyNotAva...
105
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Optional[int] = list_of_points # Degree determines the flexibility of the curve. ...
105
1
UpperCamelCase__ : Optional[Any] = [ [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 __UpperCAmelCase ( lowerCamelCase_ : Union[str, Any] , lowerCamelCase_ : ...
105
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(): from .tokenization_barthez im...
105
1
from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch @require_to...
105
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ : Optional[int] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], }...
105
1
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(): from .tokenization_big_bird i...
105
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) UpperCamelCase__ : List[Any] = pytest.mark.integration @pytest.mark.parametrize('path' , ...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int = 10 , lowerCamelCase_ : int = 10_00 , lowerCamelCase_ : bool = True ) -> int: """simple docstring""" assert ( isinstance(lowerCamelCase_ , lowerCamelCase_ ) and isinstance(lower...
105
import os import numpy import onnx def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : Optional[Any] ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = a.name SCREAMING_SNAKE_CASE_ : Dict = ...
105
1
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('''.''') def __UpperCAmelCase ( lowerCamelCase_ : int ) -> Tuple: """simple docstring""" SCR...
105
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : Option...
105
1
from __future__ import annotations from collections.abc import Iterator class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Union[str, Any] = value SCREAMING_SNAKE_CASE_ : Node | None = None SCREAMING_...
105
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tenso...
105
1
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : str , **lowerCamelCase_ : List[str] ) -> List[Any]: """simple docstring""" SCREAMING_SNA...
105
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], ['d...
105
1
import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEmbeddings, BertLay...
105
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__ : Any = logging.get_logger(__name__) UpperCamelCase__ : Any = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/van-base/blob/ma...
105
1
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class lowerCAmelCase_ ( nn.Module ): __a : int __a : int __a : float ...
105
import os import sys import unittest UpperCamelCase__ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dumm...
105
1
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say that...
105
def __UpperCAmelCase ( lowerCamelCase_ : str ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 0 for ch in input_str: SCREAMING_SNAKE_CASE_ : Union[str, Any] = ord(lowerCamelCase_ ) SCREAMING_SNAKE_CASE_ : Tup...
105
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...
105
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
105
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_availabl...
105
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, ...
105
1
import math def __UpperCAmelCase ( lowerCamelCase_ : int ) -> list: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = [True] * n SCREAMING_SNAKE_CASE_ : Any = False SCREAMING_SNAKE_CASE_ : List[Any] = False SCRE...
105
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.mo...
105
1
import os import numpy import onnx def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : Optional[Any] ) -> Optional[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = a.name SCREAMING_SNAKE_CASE_ : Dict = ...
105
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCamelCase__ : Dict = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**s...
105
1
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask UpperCamelCase__ : Dict = logging.getLogger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def ...
105
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : list[float] ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0.0_0 SCREAMING_SNAKE_CASE_ : Tuple = 0 for resistor in resistors: if...
105
1
from maths.prime_check import is_prime def __UpperCAmelCase ( lowerCamelCase_ : int ) -> int: """simple docstring""" if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): SCREAMING_SNAKE_CASE_ : Dict = F'Input value of [number={number...
105
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
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...
105
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
105
1
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem UpperCamelCase__ : List[Any] = importlib.util.find_spec('''s3fs''') is not None if _has_safs: from .safil...
105
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Optional[Any] = { '''configuration_whisper''': ['''WHISPER_PRETRAINE...
105
1
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer, AutoTokeniz...
105
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __UpperCAmelCase ( lowerCamelCase_ : np.ndarray , lowerCamelCase_ : np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , ...
105
1
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __UpperCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int , lowerCamelCase_ : float = 1 / sqrt(2 ) ) -> IIRFilter: """simple docstring""" SCREA...
105
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase__ : str = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake...
105
1
from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : list[str] | None = None , lowerCamelCase_ : dict[str, float] | None = None , lowerCamelCase_ : bool = False , ) -> tuple[int, float, str]: ...
105
def __UpperCAmelCase ( lowerCamelCase_ : List[str] , lowerCamelCase_ : Optional[Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = [0 for i in range(r + 1 )] # nc0 = 1 SCREAMING_SNAKE_CASE_ : Dict = 1...
105
1
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 lowerCAmelCase_ ( lowerCamelCas...
105
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCAmelCase_ : def __init__( self ,snake_case__ ): SCREAMING_SNAKE_CASE_ : Optional[int] = list_of_points # Degree determines the flexibility of the curve. ...
105
1
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> list[int]: """simple docstring""" if length <= 0 or not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(...
105
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(): from .tokenization_barthez im...
105
1
from __future__ import annotations import typing from collections import Counter def __UpperCAmelCase ( lowerCamelCase_ : int ) -> typing.Counter[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : typing.Counter[int] = Counter() for base in ra...
105
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ : Optional[int] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], }...
105
1
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tenso...
105
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) UpperCamelCase__ : List[Any] = pytest.mark.integration @pytest.mark.parametrize('path' , ...
105
1