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
"""simple docstring""" import requests from bsa import BeautifulSoup def _SCREAMING_SNAKE_CASE ( _lowercase : str , _lowercase : dict ) ->List[Any]: '''simple docstring''' a : List[Any] = BeautifulSoup(...
633
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
0
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...
101
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
0
'''simple docstring''' def snake_case ( a_ : str ) -> Optional[int]: """simple docstring""" UpperCamelCase_ : Dict = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""" ) Upper...
208
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
0
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 ( BarkCoarseConfig, ...
464
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
0
"""simple docstring""" from __future__ import annotations class __magic_name__ : def __init__( self : Union[str, Any] , snake_case_ : int = 0 ): __snake_case = key def lowerCAmelCase ( self : Optional[int] , snake_ca...
163
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
0
"""simple docstring""" 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...
510
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
0
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : str , lowerCamelCase : str): A_ : str = len(lowerCAmelCase_) A_ : Optional[int] = len(lowerCAmelCase_) A_ : Any = [[False for _ in range(m + 1)] for _ in range(n + 1)] ...
665
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
0
'''simple docstring''' from unittest.mock import Mock, patch from file_transfer.send_file import send_file @patch("""socket.socket""" ) @patch("""builtins.open""" ) def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): # ===== initialization ====...
407
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
0
from __future__ import annotations import bisect def __magic_name__ ( __lowerCAmelCase : list[int] , __lowerCAmelCase : int , __lowerCAmelCase : int = 0 , __lowerCAmelCase : int = -1 ) -> Optional[int]: if hi < 0: __lowerCamelCase ...
298
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
0
import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) lowerCamelCase : Optional[int] = logging.getLo...
149
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
0
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_to...
17
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
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVec...
633
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
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ : Optional[Any] =logging.get_logger(__name__) lowerCA...
101
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
0
'''simple docstring''' 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"]...
208
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
0
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': 10, 'max_num_jobs': 1}, [range(10 )]), ({'num...
464
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
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __magic_name__ ( _UpperCamelCase ): def __init__( self : Tuple , *sn...
163
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
0
"""simple docstring""" def snake_case ( _a: int , _a: Tuple )-> Union[str, Any]: '''simple docstring''' lowerCamelCase__ = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res ...
510
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
0
'''simple docstring''' 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 ...
665
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
0
'''simple docstring''' 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 ...
407
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
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart impor...
298
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
0
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 ...
149
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
0
class lowerCamelCase_ : def __init__( self : Dict , __A : str , __A : Tuple , __A : Union[str, Any] ): __A : Union[str, Any] = None __A : Tuple = None __A : Optional[int] = graph self._normalize...
17
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
0
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def _SCREAMING_SNAKE_CASE ( _lowercase : Dict , _lowercase : Dict ) ->Union[str, Any]: '''simple docstring''' a : ...
633
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
0
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 lowerCAmelCase__ : Tuple =logging.get_logg...
101
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
0
'''simple docstring''' # 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 TensorF...
208
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
0
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_bart import BartTokenizer lowerCam...
464
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
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import ...
163
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
0
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compos...
510
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
0
'''simple docstring''' import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def lowerCamelCase ( *lowerCamelCase : Union[str, Any] , lowerCamelCase : Optional[Union[Dict, Any]] = None , lowerCamelCase : str=True , lowerCam...
665
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
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image...
407
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
0
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
298
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
0
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 lowerCAmelCase ( datasets.BeamBasedBuilder ): '''simple docstring''' def lowerCAmelCase ...
149
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
0
from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImageResampling, get_image_si...
17
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
0
"""simple docstring""" 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, T...
633
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
0
import torch from transformers import AutoModel class __lowercase (torch.nn.Module ): """simple docstring""" def __init__( self , lowerCAmelCase__="sayef/fsner-bert-base-uncased" ): """simple docstring""" ...
101
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
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase ={ "configuration_table_transformer": [ "TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TableTransformerConfig", ...
208
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
0
# 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 A ( _Uppe...
464
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
0
"""simple docstring""" from __future__ import annotations import math def __UpperCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> List[str]: """simple docstring""" __snake_case = u for i in range(1 , lowerCAmelCase_ ): ...
163
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
0
"""simple docstring""" def snake_case ( _a: int )-> str: '''simple docstring''' if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise TypeError('Input value must be an \'int\' type' ) lowerCamelCase__ = 0 while number: ...
510
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
0
'''simple docstring''' 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_ba...
665
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
0
'''simple docstring''' 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 __A =logging.get_logger(__name__)...
407
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
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipeline...
298
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
0
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils...
149
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
0
import math def __SCREAMING_SNAKE_CASE ( a__ : int ) -> Optional[int]: __A : Any = [] __A : List[str] = 2 __A : Optional[int] = int(math.sqrt(lowerCAmelCase_ ) ) # Size of every segment __A : str = [True] * (end + 1) __A : Any ...
17
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
0
"""simple docstring""" 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 fro...
633
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
0
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...
101
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
0
'''simple docstring''' 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/...
208
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
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow fro...
464
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
0
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __magic_name__ ( _UpperCamelCase ...
163
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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _snake_case = { "configuration_blenderbot": [ ...
510
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
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __magic_name__ = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['GitProcessor'], } try:...
665
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
0
'''simple docstring''' 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, ...
407
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
0
# 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 applicab...
298
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
0
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowerCamelCase : Tuple = '''\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, Ale...
149
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
0
import warnings warnings.warn( '''memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: ''' '''`from accelerate import find_executable_batch_size` to avoid this warning.''', FutureWarning, )
17
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
0
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __UpperCamelCase : def __init__( self , lowerCAmelCase__=None , lowerCAmelCase__=None ) -> str: a : Optional[Any] = list(poly_a or [0] )[:] ...
633
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
0
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowerCAmelCase__ : Optional[int] =argparse.ArgumentParser() parser.add_argument( '--checkpoint_path', default=None, type=s...
101
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
0
'''simple docstring''' import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase =logging.get_logger("transformers.models.speecht5") def snake_case ( a_ : Tuple , a_ ...
208
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
0
from __future__ import annotations def a_ ( SCREAMING_SNAKE_CASE__ : str , SCREAMING_SNAKE_CASE__ : str ): '''simple docstring''' _lowerCamelCase : Optional[Any] =get_failure_array(lowerCAmelCase_ ) # 2) Step through text searching for pattern...
464
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
0
"""simple docstring""" from math import isqrt def __UpperCamelCase ( SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" __snake_case = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
163
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
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorTy...
510
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
0
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : int , lowerCamelCase : list): _enforce_args(lowerCAmelCase_ , lowerCAmelCase_) if n == 0: return 0 A_ : List[str] = float("""-inf""") for i in range(1 , n + 1): ...
665
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
0
'''simple docstring''' from __future__ import annotations def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): if len(lowerCAmelCase_ ) == 0: raise ValueError("""find_max() arg is an empty sequence""" ) if ( ...
407
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
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
298
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
0
# 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 lowerCamelCase : Dict = TypeVar('''T''') class lowerCAmelCase ( Generic[T] ): '''simpl...
149
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
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer, ...
17
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
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int ) ->str: '''simple docstring''' assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ), F"""The input value of [n={number}] is not an integer""" if number == 1: re...
633
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
0
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 a__ ( A__ ): # picklable for multiprocessing return i + 1...
101
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
0
'''simple docstring''' 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 Nest...
208
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
0
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class A ( _UpperCamelCase , u...
464
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
0
"""simple docstring""" import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def __UpperCamelCase ( SCREAMING_SNAKE_CASE ) -> Tuple: """simple docstring""" monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings...
163
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
0
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def snake_case ( _a: dict )->...
510
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
0
'''simple docstring''' from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder __magic_name__ = datasets.utils.logging.get_logger(__name__) class __lowerCAmelCase ( folder_based_builder.FolderBasedBuild...
665
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
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __A =logging.get_logger(__name__) __A ={ 'transfo-xl-wt103': 'https://huggingface.co/transfo-xl-wt103/resolve/main/config.json', } class _snake_case ( _UpperCamelCa...
407
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
0
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransformer,...
298
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
0
import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, BertTokenizerFast, ...
149
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
0
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( a__ : list[int] ) -> Dict: # This function is recursive __A : int = len(lowerCAmelCase_ ) # If the array contains only one element, we return it (it's the stop condition of # recursion) if array_length <...
17
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
0
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __UpperCamelCase ( _UpperCamelCase ): lowerCamelCase : Optional[int] =(KDPMaDiscreteS...
633
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
0
import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor lowerCAmelCase__ : Dict =logging.get_logger(__name__) class __lowercase (_UpperCamelCase ): """simple docstring""" def __init__( ...
101
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
0
'''simple docstring''' 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", "ConditionalD...
208
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
0
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class _lowerCAmelCase ( tf.keras.optimizers.sch...
667
'''simple docstring''' import math from collections.abc import Callable def a ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' A_ : float = xa A_ : float = xa while True: if x_n == x_na or function(lowerCamel...
667
1
'''simple docstring''' def a ( lowerCamelCase__ ): '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(lowerCamelCase__ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''')...
667
'''simple docstring''' 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, ...
667
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase :List[str] = { '''configuration_mobilevit''': ['''MOBILEVIT_PRETRAIN...
667
'''simple docstring''' class _lowerCAmelCase : def __init__(self , lowercase , lowercase , lowercase ): A_ : List[str] = name A_ : Dict = value A_ : Optional[int] = weight def __repr__(self ): return F'{self.__class__.__name__}({self.na...
667
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class _lowerCAmelCase ( metaclass=__UpperCAmelCase ): __SCREAMING_SNAKE_CASE : List[str] = ['torch'] def __init__(self , *lowercase , **lowercase ): requires_backends(self , ["""t...
667
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor lowerCamelCase :int = logging.getLogger(__name__) lowerCa...
667
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) lowerCamelCase :List[str] = { '''configuration_spee...
667
'''simple docstring''' import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
667
1
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffuser...
667
'''simple docstring''' from __future__ import annotations def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' if partitions <= 0: raise ValueError("""partitions must be a positive number!""" ) if partitions > number_of_bytes: raise ValueE...
667
1
'''simple docstring''' import logging from transformers import PretrainedConfig lowerCamelCase :Optional[int] = logging.getLogger(__name__) lowerCamelCase :List[str] = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-...
667
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fr...
667
1
'''simple docstring''' import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
667
'''simple docstring''' print((lambda quine: quine % quine)('''print((lambda quine: quine %% quine)(%r))'''))
667
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vi...
667
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as...
667
1
'''simple docstring''' from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_availabl...
667
'''simple docstring''' from importlib import import_module from .logging import get_logger lowerCamelCase :Dict = get_logger(__name__) class _lowerCAmelCase : def __init__(self , lowercase , lowercase=None ): A_ : Optional[int] = attrs or [] if m...
667
1
'''simple docstring''' from collections import defaultdict def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' A_ : Any = first_str.lower().strip() A_ : Union[str, Any] = second_str.lower().strip() # Remove whitespace A_ :...
667
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase :int = { '''configuration_wav2vec2''': ['''WAV_2_VEC_2_PRETRAINED_CONF...
667
1
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import l...
667
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput cla...
667
1
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase :List[str] = logging.get_logger(__name__) lowerCa...
667
'''simple docstring''' import math lowerCamelCase :int = 1_0 lowerCamelCase :List[Any] = 7 lowerCamelCase :Union[str, Any] = BALLS_PER_COLOUR * NUM_COLOURS def a ( lowerCamelCase__ = 20 ): '''simple docstring''' A_ : ...
667
1
'''simple docstring''' from math import loga def a ( lowerCamelCase__ ): '''simple docstring''' if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(lowerCamelCase__ , lowerCamelCase__ ): raise TypeError("""Input ...
667
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase :List[Any] = logging.get_logger(__name__) lowerCamelCase :Union[str, Any] = { '''google/pix2struct-tex...
667
1
'''simple docstring''' from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowerCamelCase :Optional[Any] = (3, 9, -1_1, 0, 7, 5, 1, -1) lowerCamelCase :str = (4, 6, 2, 0, 8, 1_0, 3, -2) @dataclass class ...
667
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available lowerCamelCase :Union[str, Any] = { '''configuration_audio_spectrogram_transformer''': [ '''AUDIO_SPECTROGRAM_TRANSFO...
667
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCamelCase :Dict = { '''configuration_longt5''': ['''LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LongT5Config''', '''LongT5...
667
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _lowerCAmelCa...
667
1
'''simple docstring''' def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' print("""\nThe shortest path matrix using Floyd Warshall algorithm\n""" ) for i in range(lowerCamelCase__ ): for j in range(lowerCamelCase__ ): if dist...
667
'''simple docstring''' from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): ...
667
1
'''simple docstring''' import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase :Optional[int] = logging.get_logger(__name__) lowerCamelCase :Union[str, Any] = { '''facebook/data2vec-base-960h''': '''https://huggingfa...
667
'''simple docstring''' from collections.abc import Callable import numpy as np def a ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' A_ : Union[str, Any] = int(np.ceil((x_end - xa) / step_s...
667
1
'''simple docstring''' import math import os import sys def a ( lowerCamelCase__ ): '''simple docstring''' A_ : int = """""" try: with open(lowerCamelCase__ , """rb""" ) as binary_file: A_ : List[str] = binary_file.read() for...
667
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_...
667
1
'''simple docstring''' def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' _validate_point(lowerCamelCase__ ) _validate_point(lowerCamelCase__ ) if len(lowerCamelCase__ ) != len(lowerCamelCase__ ): raise ValueError("""Both poi...
667
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer lowerCamel...
667
1