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 collections.abc import Iterable from typing import Any class snake_case__ : def __init__( self : Dict , A__ : int | None = None ) -> List[str]: '''simple docstring''' snake_case_ : Optional[int] = value sna...
666
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimensio...
666
1
import math def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = 0 ): snake_case_ : Any = end or len(lowerCAmelCase_ ) for i in range(lowerCAmelCase_ , lowerCAmelCase_ ): sna...
666
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = { "configuration_blenderbot": [ "BLENDERBOT_PRETRA...
666
1
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder UpperCAmelCase = datasets.utils.logging.get_logger(__name__) class snake_case__ ( folder_based_builder.FolderBasedBuilderConf...
666
from ...configuration_utils import PretrainedConfig UpperCAmelCase = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas...
666
1
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def SCREAMING_SNAKE_CASE_ ( *lowerCAmelCase_: Union[str, Any] , lowerCAmelCase_: Optional[Union[Dict, Any]] = None , lowerCAmelCase_: str=True , lowerCAmel...
666
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class snake_case__ ( datasets.BeamBasedBuilder ): def UpperCAmelCase__ ...
666
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 UpperCAmelCase = "▁" UpperCAmelCase = {"vocab_file": "spiece.model"} ...
666
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture de...
666
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
666
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int] , lowerCAmelCase_: int , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = -1 ): if hi < 0: snake_case_ : Any = len(lowerCA...
666
1
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor UpperCAmelCase = logging.get_logger(__name__) class snake_case__ ( _UpperCamelCase ): def __init__( self : List[str] , *A__ : Any ...
666
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case__ ( _Upp...
666
1
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") UpperCAmelCase = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) UpperCAmelCase = reque...
666
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
666
1
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docst...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int = 1_0_0_0 ): snake_case_ ,snake_case_ : List[str] = 1, 1 snake_case_ : List[str] = 2 while True: snake_case_ : Tuple = 0 snake_case_ : Union[str, Any] = ...
666
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_available, is_vision_availa...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int | float] , lowerCAmelCase_: int , lowerCAmelCase_: int ): if len(lowerCAmelCase_ ) == 0: raise ValueError("find_max() arg is an empty sequence" ) if ( ...
666
1
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import...
666
import json from typing import 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_roberta import RobertaTokenizer...
666
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import torch if is_vi...
666
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRo...
666
1
import argparse import json from tqdm import tqdm def SCREAMING_SNAKE_CASE_ ( ): snake_case_ : Union[str, Any] = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=lowerCAmelCase_ , default=...
666
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_ch...
666
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "facebook/nllb-moe-54B": "https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json", } class snake_c...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: tuple[int, int] , lowerCAmelCase_: int ): snake_case_ ,snake_case_ : Dict = position snake_case_ : int = [ (y + 1, x + 2), (y - 1, x + 2),...
666
1
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int , lowerCAmelCase_: list ): _enforce_args(lowerCAmelCase_ , lowerCAmelCase_ ) if n == 0: return 0 snake_case_ : List[str] = float("-inf" ) for i in range(1 , n + 1 ): ...
666
from ...configuration_utils import PretrainedConfig class snake_case__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : Union[str, Any] = "bert-generation" def __init__( self : Optional[int] , A__ : List[Any]=5_03_58 , A__ : Any=10_24 , ...
666
1
import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, is_staging_test clas...
666
import math def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Any = [] snake_case_ : List[str] = 2 snake_case_ : Optional[int] = int(math.sqrt(lowerCAmelCase_ ) ) # Size of every segment snake_case_ : ...
666
1
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import BertConfig...
666
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 ...
666
1
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) class snake_case__ ( _UpperCamelCase ): _SCREAMIN...
666
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 ...tokenizat...
666
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 impor...
666
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/mai...
666
1
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( "kwargs, expected" , [ ({"num_shards": 0, "max_num_jobs": 1}, []), ({"num_shards": 1_0, "max_num_jobs": 1}, [range(1_0 )]), ...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str , lowerCAmelCase_: str ): def get_matched_characters(lowerCAmelCase_: str , lowerCAmelCase_: str ) -> str: snake_case_ : Tuple = [] snake_case_ : Tuple = min(len(_stra ) ...
666
1
import math def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Any = [] snake_case_ : List[str] = 2 snake_case_ : Optional[int] = int(math.sqrt(lowerCAmelCase_ ) ) # Size of every segment snake_case_ : ...
666
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfi...
666
1
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str , lowerCAmelCase_: str ): snake_case_ : Optional[Any] = get_failure_array(lowerCAmelCase_ ) # 2) Step through text searching for pattern snake_case_ ,snake_case...
666
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Option...
666
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], "tokenization_roc_bert": ["RoCBertTok...
666
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimensio...
666
1
import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging UpperCAmelCase = logging.get_logger(__name__) ...
666
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = { "configuration_blenderbot": [ "BLENDERBOT_PRETRA...
666
1
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( ...
666
from ...configuration_utils import PretrainedConfig UpperCAmelCase = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas...
666
1
import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC UpperCAmelCase = parse(importlib.metadata.version("torch")) def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: Union[str, Version...
666
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class snake_case__ ( datasets.BeamBasedBuilder ): def UpperCAmelCase__ ...
666
1
import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes from unilm.wavlm.W...
666
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture de...
666
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 ...
666
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int] , lowerCAmelCase_: int , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = -1 ): if hi < 0: snake_case_ : Any = len(lowerCA...
666
1
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor UpperCAmelCase = logging.get_logger(__name__) class snake_case__ ( _UpperCamelCase ): def __init__( self : Tuple , *A__ : List[str] ...
666
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case__ ( _Upp...
666
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=_UpperCamelCase ) class snake_case__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : str...
666
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
666
1
import math class snake_case__ : def __init__( self : Optional[int] , A__ : int=0 ) -> int: # a graph with Node 0,1,...,N-1 '''simple docstring''' snake_case_ : List[str] = n snake_case_ : Dict = [...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int = 1_0_0_0 ): snake_case_ ,snake_case_ : List[str] = 1, 1 snake_case_ : List[str] = 2 while True: snake_case_ : Tuple = 0 snake_case_ : Union[str, Any] = ...
666
1
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record UpperCAmelCase = "\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n author={Wang, A...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int | float] , lowerCAmelCase_: int , lowerCAmelCase_: int ): if len(lowerCAmelCase_ ) == 0: raise ValueError("find_max() arg is an empty sequence" ) if ( ...
666
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_ch...
666
import json from typing import 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_roberta import RobertaTokenizer...
666
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def SCR...
666
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRo...
666
1
from math import isqrt def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Union[str, Any] = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , l...
666
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_ch...
666
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Option...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: tuple[int, int] , lowerCAmelCase_: int ): snake_case_ ,snake_case_ : Dict = position snake_case_ : int = [ (y + 1, x + 2), (y - 1, x + 2),...
666
1
from collections import namedtuple import requests from lxml import html # type: ignore UpperCAmelCase = namedtuple("covid_data", "cases deaths recovered") def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str = "https://www.worldometers.info/coronavirus/" ): snake...
666
from ...configuration_utils import PretrainedConfig class snake_case__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : Union[str, Any] = "bert-generation" def __init__( self : Optional[int] , A__ : List[Any]=5_03_58 , A__ : Any=10_24 , ...
666
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = { "configuration_roformer": ["ROFORMER_PRETRAINED_CONFIG_AR...
666
import math def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Any = [] snake_case_ : List[str] = 2 snake_case_ : Optional[int] = int(math.sqrt(lowerCAmelCase_ ) ) # Size of every segment snake_case_ : ...
666
1
UpperCAmelCase = "\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/transformers...
666
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 ...
666
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings UpperCAmelCase = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control the model outputs. R...
666
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 ...tokenizat...
666
1
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int , lowerCAmelCase_: int ): if b == 0: return (1, 0) ((snake_case_) ,(snake_case_)) : int = extended_euclid(lowerCAmelCase_ , a % b ) snake_case...
666
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/mai...
666
1
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMu...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str , lowerCAmelCase_: str ): def get_matched_characters(lowerCAmelCase_: str , lowerCAmelCase_: str ) -> str: snake_case_ : Tuple = [] snake_case_ : Tuple = min(len(_stra ) ...
666
1
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : str = [ "decoder.version", "decoder.outp...
666
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfi...
666
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable UpperCAmelCase = { "configuration_gpt_neox_japanese": ["GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoXJapaneseConfig"], "tokenizat...
666
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Option...
666
1
import argparse import importlib from pathlib import Path # Test all the extensions added in the setup UpperCAmelCase = [ "kernels/rwkv/wkv_cuda.cu", "kernels/rwkv/wkv_op.cpp", "kernels/deformable_detr/ms_deform_attn.h", "kernels/deformable_detr/cuda/ms_deform_im2col_cuda.cuh...
666
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimensio...
666
1
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str ): snake_case_ : Dict = hex_num.strip() if not hex_num: raise ValueError("No value was passed to the function" ) snake_case_ : Optional[Any] = hex_num[0] == "-" if is_negative: ...
666
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = { "configuration_blenderbot": [ "BLENDERBOT_PRETRA...
666
1
import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase = 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 ...
666
from ...configuration_utils import PretrainedConfig UpperCAmelCase = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas...
666
1
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenizati...
666
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class snake_case__ ( datasets.BeamBasedBuilder ): def UpperCAmelCase__ ...
666
1
UpperCAmelCase = {str(digit): digit**5 for digit in range(1_0)} def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): return sum(DIGITS_FIFTH_POWER[digit] for digit in str(lowerCAmelCase_ ) ) def SCREAMING_SNAKE_CASE_ ( ): return sum( ...
666
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture de...
666
1
import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as np from .import_u...
666
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int] , lowerCAmelCase_: int , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = -1 ): if hi < 0: snake_case_ : Any = len(lowerCA...
666
1
import sys UpperCAmelCase = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504452445231617318564030...
666
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case__ ( _Upp...
666
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 ...tokenizat...
666
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
666
1
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Optional[Any] = prime_factors(lowerCAmelCase_ ) if is_square_free(lowerCAmelCase_ ): re...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int = 1_0_0_0 ): snake_case_ ,snake_case_ : List[str] = 1, 1 snake_case_ : List[str] = 2 while True: snake_case_ : Tuple = 0 snake_case_ : Union[str, Any] = ...
666
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 ...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int | float] , lowerCAmelCase_: int , lowerCAmelCase_: int ): if len(lowerCAmelCase_ ) == 0: raise ValueError("find_max() arg is an empty sequence" ) if ( ...
666
1
import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase = lo...
666
import json from typing import 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_roberta import RobertaTokenizer...
666
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_git": ["GIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GitConfig", "GitVisionConfig"], "processing_git": ["GitProcessor"], } try: if n...
666
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRo...
666
1
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: Optional[Any] ): # pickl...
666
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_ch...
666
1
from __future__ import annotations import unittest from transformers import EsmConfig, 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_tensor, random_att...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: tuple[int, int] , lowerCAmelCase_: int ): snake_case_ ,snake_case_ : Dict = position snake_case_ : int = [ (y + 1, x + 2), (y - 1, x + 2),...
666
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageRes...
666
from ...configuration_utils import PretrainedConfig class snake_case__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : Union[str, Any] = "bert-generation" def __init__( self : Optional[int] , A__ : List[Any]=5_03_58 , A__ : Any=10_24 , ...
666
1
from ...configuration_utils import PretrainedConfig UpperCAmelCase = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas...
666
import math def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Any = [] snake_case_ : List[str] = 2 snake_case_ : Optional[int] = int(math.sqrt(lowerCAmelCase_ ) ) # Size of every segment snake_case_ : ...
666
1
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int , lowerCAmelCase_: int , lowerCAmelCase_: int , lowerCAmelCase_: int , lowerCAmelCase_: int , l...
666
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 ...
666
1
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments
666
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 ...tokenizat...
666
1
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
666
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/mai...
666
1
import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForConditionalGeneration as P...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str , lowerCAmelCase_: str ): def get_matched_characters(lowerCAmelCase_: str , lowerCAmelCase_: str ) -> str: snake_case_ : Tuple = [] snake_case_ : Tuple = min(len(_stra ) ...
666
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .t...
666
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfi...
666
1
from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_xpu, requi...
666
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Option...
666
1
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_lza, req...
666
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimensio...
666
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor ...
666
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = { "configuration_blenderbot": [ "BLENDERBOT_PRETRA...
666
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConditionalDetrConfig", ...
666
from ...configuration_utils import PretrainedConfig UpperCAmelCase = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas...
666
1
from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class snake_case__ : _SCREAMING_SNAKE_CASE : List[str] _SCREAMING_S...
666
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class snake_case__ ( datasets.BeamBasedBuilder ): def UpperCAmelCase__ ...
666
1
from ....utils import logging UpperCAmelCase = logging.get_logger(__name__) class snake_case__ ( _UpperCamelCase ): def __init__( self : str , A__ : Optional[Any] , A__ : List[str]=None , A__ : Tuple=20_48 ) -> Tuple: ...
666
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture de...
666
1
import torch from transformers import AutoModel class snake_case__ ( torch.nn.Module ): def __init__( self : Union[str, Any] , A__ : Optional[Any]="sayef/fsner-bert-base-uncased" ) -> List[Any]: '''simple docstring''' super(A_...
666
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int] , lowerCAmelCase_: int , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = -1 ): if hi < 0: snake_case_ : Any = len(lowerCA...
666
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_table_transformer": [ "TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TableTransformerConfig", "TableTransfo...
666
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case__ ( _Upp...
666
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase = { "configuration_ctrl": ["CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CTRLConfig"], "tokenization_ctrl": ["CTRLTokenizer"], } try: ...
666
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
666
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils import Featur...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int = 1_0_0_0 ): snake_case_ ,snake_case_ : List[str] = 1, 1 snake_case_ : List[str] = 2 while True: snake_case_ : Tuple = 0 snake_case_ : Union[str, Any] = ...
666
1
from unittest.mock import Mock, patch from file_transfer.send_file import send_file @patch("socket.socket" ) @patch("builtins.open" ) def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: Tuple , lowerCAmelCase_: List[Any] ): # ===== initialization ===== snake_case_ : ...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int | float] , lowerCAmelCase_: int , lowerCAmelCase_: int ): if len(lowerCAmelCase_ ) == 0: raise ValueError("find_max() arg is an empty sequence" ) if ( ...
666
1
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYP...
666
import json from typing import 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_roberta import RobertaTokenizer...
666
1
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class snake_case__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : Optional[int] = (KDPMaDiscreteScheduler,) _SCREAM...
666
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRo...
666
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } class ...
666
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_ch...
666
1
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataStructureLike, ...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: tuple[int, int] , lowerCAmelCase_: int ): snake_case_ ,snake_case_ : Dict = position snake_case_ : int = [ (y + 1, x + 2), (y - 1, x + 2),...
666
1
from argparse import ArgumentParser from . import BaseTransformersCLICommand def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class snake_case__ ...
666
from ...configuration_utils import PretrainedConfig class snake_case__ ( _UpperCamelCase ): _SCREAMING_SNAKE_CASE : Union[str, Any] = "bert-generation" def __init__( self : Optional[int] , A__ : List[Any]=5_03_58 , A__ : Any=10_24 , ...
666
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 ...
666
import math def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): snake_case_ : Any = [] snake_case_ : List[str] = 2 snake_case_ : Optional[int] = int(math.sqrt(lowerCAmelCase_ ) ) # Size of every segment snake_case_ : ...
666
1
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @requ...
666
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 ...
666
1
import unittest from knapsack import knapsack as k class snake_case__ ( unittest.TestCase ): def UpperCAmelCase__ ( self : str ) -> List[Any]: '''simple docstring''' snake_case_ : Optional[int] = 0 s...
666
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 ...tokenizat...
666
1
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common impor...
666
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/mai...
666
1
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class ...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: str , lowerCAmelCase_: str ): def get_matched_characters(lowerCAmelCase_: str , lowerCAmelCase_: str ) -> str: snake_case_ : Tuple = [] snake_case_ : Tuple = min(len(_stra ) ...
666
1
from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def SCREAMING_SNAKE_CASE_ ( lo...
666
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfi...
666
1
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from .modeling_utils ...
666
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Option...
666
1
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging ...
666
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimensio...
666
1
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: Union[str, Any] ): snake_case_ : Union[str, Any] = [ "encoder.version", "dec...
666
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = { "configuration_blenderbot": [ "BLENDERBOT_PRETRA...
666
1
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[float] ): snake_case_ : Optional[int] = 0.0_0 snake_case_ : Any = 0 for resistor in resistors: if resistor <= 0: snake_case_ ...
666
from ...configuration_utils import PretrainedConfig UpperCAmelCase = { "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas...
666
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
666
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class snake_case__ ( datasets.BeamBasedBuilder ): def UpperCAmelCase__ ...
666
1
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging UpperCAmelCase = logging.get_logger(__name__) ...
666
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture de...
666
1
import inspect import unittest from transformers import ViTMSNConfig 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 ...te...
666
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int] , lowerCAmelCase_: int , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = -1 ): if hi < 0: snake_case_ : Any = len(lowerCA...
666
1
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: dict ): ...
666
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case__ ( _Upp...
666
1
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
666
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int ): if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
666
1
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar UpperCAmelCase = TypeVar("T") class snake_case__ ( Generic[T] ): ...
666
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int = 1_0_0_0 ): snake_case_ ,snake_case_ : List[str] = 1, 1 snake_case_ : List[str] = 2 while True: snake_case_ : Tuple = 0 snake_case_ : Union[str, Any] = ...
666
1
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list ): if len(lowerCAmelCase_ ) <= 1: return [tuple(lowerCAmelCase_ )] snake_case_ : Optional[int] = [] def generate(lowerCAmelCase_: int , lowerCAmelCase_: list ): snake_case_ ...
666
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int | float] , lowerCAmelCase_: int , lowerCAmelCase_: int ): if len(lowerCAmelCase_ ) == 0: raise ValueError("find_max() arg is an empty sequence" ) if ( ...
666
1
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: list[int] , lowerCAmelCase_: int , lowerCAmelCase_: int = 0 , lowerCAmelCase_: int = -1 ): if hi < 0: snake_case_ : Any = len(lowerCA...
666
import json from typing import 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_roberta import RobertaTokenizer...
666
1
def SCREAMING_SNAKE_CASE_ ( lowerCAmelCase_: int , lowerCAmelCase_: Tuple ): snake_case_ : int = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def SCREAMING_SNAKE_C...
666
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRo...
666
1