code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int , UpperCamelCase__: int ): SCREAMING_SNAKE_CASE__ = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): SCREAMING_SNAKE_CASE__ = n - k # Calculate C(n,k) for i in range(__U...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "timm_backbone" def __init__( self :Union[str, Any] ...
59
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase = { 'configuration_squeezebert': [ 'SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SqueezeBertConfig', 'SqueezeBertOnn...
700
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
0
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Optional[Any] , UpperCamelCase__: Optional[Any] ): SCREAMING_SNAKE_CASE__ = ...
701
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
0
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int , UpperCamelCase__: int ): if partitions <= 0: raise ValueError("""partitions must be a positive number!""" ) if partitions > number_of_bytes: raise ValueError("""partiti...
702
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
0
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitConfig, ViTHybri...
703
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int ): if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: SCREAMING_SNAKE_CASE__ = str(abs(_lowerCamelCase ) ) SCREAMING_SNAKE_CASE__...
704
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
0
from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Dict , UpperCamelCase__: Optional[Any] ): SCREAMING_SNAKE_CASE__ = int(UpperCamelCase__ ) assert noofclusters < len(UpperCamelCase__ ) ...
705
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
0
import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import floats_tensor, is_xformers_availab...
706
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
0
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 = logging.get_logger(__name__) _lowerCamelCase = '▁' _lowerCamelCase ...
707
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
0
'''simple docstring''' from torch import nn class UpperCamelCase_ ( nn.Module ): def __init__( self :List[Any] , __A :Tuple , __A :Optional[int] ) -> str: """simple docstring""" super().__init__() SCREAMING_SNA...
708
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
0
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset...
709
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { '''facebook/xglm-564M''': '''https://huggingface.co/facebook/xglm-564M/resolve/main/config.json''', # See all XGLM models at https://huggin...
710
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
0
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, require_torc...
711
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
59
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 b...
712
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
0
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = (CMStochasticIterativeScheduler,) lowerCamelCase_ ...
713
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-textcaps...
59
0
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property ...
714
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase_ ( unittest.TestCase ): def ...
59
0
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CONFIG_A...
59
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase_ ( __snake_case ): lowerCamelCase_ ...
716
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = ArgumentParser( description=( """PyTorch TPU distribu...
717
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
59
0
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import GradientAccu...
718
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
59
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torc...
719
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 UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = fi...
59
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, UNeta...
720
# 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 app...
59
0
from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: float ): if side_length < 0: raise ValueError("""surface_area_cube() only accepts non-negative values""" ) return 6 * side_length**2 def SCREAMING_SNAKE_CASE__ ( UpperCam...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "timm_backbone" def __init__( self :Union[str, Any] ...
59
0
_lowerCamelCase = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' _lowerCamelCase = [{'type...
700
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
0
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig _lowerCamelCase = { 'facebook/maskformer-swin-base...
701
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Optional[int] , UpperCamelCase__: Tuple=() , Up...
702
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: str = 1 , UpperCamelCase__: Optional[Any] = 1_000 ): SCREAMING_SNAKE_CASE__ = 1 SCREAMING_SNAKE_CASE__ = 0 for divide_by_number in range(lowerCAmelCase_ , digit + 1 ): SCREAMING_SNAKE_CASE__ = ...
703
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
0
_lowerCamelCase = {'a': ['c', 'b'], 'b': ['d', 'e'], 'c': [], 'd': [], 'e': []} _lowerCamelCase = ['a', 'b', 'c', 'd', 'e'] def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Optional[int] , UpperCamelCase__: List[str] , UpperCamelCase__: Optional[in...
704
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
0
import operator as op _lowerCamelCase = 'scaler.pt' _lowerCamelCase = 'pytorch_model' _lowerCamelCase = 'random_states' _lowerCamelCase = 'optimizer' _lowerCamelCase = 'scheduler' _lowerCamelCase = 'pytorch_model.bin' _lowerCamelCase = 'pytorch_model.bin.i...
705
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
0
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dime...
706
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
0
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class UpperCamelCa...
707
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
0
'''simple docstring''' # using dfs for finding eulerian path traversal def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Union[str, Any] , UpperCamelCase__: List[str] , UpperCamelCase__: List[Any] , UpperCamelCase__: List[str]=None ): SCREAM...
708
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: List[str] ): if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or number < 0: raise ValueError("""Input must be a non-negative integer""" ) SCREAMING_SNAKE_CASE__ = 0 while number: # This way we ...
709
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
0
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin _lowe...
710
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
0
from manim import * class UpperCamelCase_ ( SCREAMING_SNAKE_CASE_ ): def _snake_case ( self :Union[str, Any] ) -> List[str]: """simple docstring""" SCREAMING_SNAKE_CASE__ = Rectangle(height=0.5 , width=0.5 ) SCREAMIN...
711
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: str , UpperCamelCase__: int ): return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_ ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import testmod testmod()
712
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
0
'''simple docstring''' def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int , UpperCamelCase__: int ): return number | (1 << position) def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int , UpperCamelCase__: int ): return number ...
713
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-textcaps...
59
0
import pprint import requests _lowerCamelCase = 'https://zenquotes.io/api' def SCREAMING_SNAKE_CASE__ ( ): return requests.get(API_ENDPOINT_URL + """/today""" ).json() def SCREAMING_SNAKE_CASE__ ( ): return requests.get(API_ENDPOINT_URL + """/random""" ...
714
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase_ ( unittest.TestCase ): def ...
59
0
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, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dime...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CONFIG_A...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int ): if isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise TypeError("""\'float\' object cannot be interpreted as an integer""" ) if isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise TypeError("""\...
716
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
0
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging...
717
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
59
0
'''simple docstring''' from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function _lowerCamelCase = 1.054571817e-34 # unit of ℏ : J * s _lowerCamelCase = 3e8 # unit of c : m * s^-1 def ...
718
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int = 10 , UpperCamelCase__: int = 22 ): SCREAMING_SNAKE_CASE__ = range(1 , lowercase_ ) SCREAMING_SNAKE_CASE__ = range(1 , lowercase_ ) return sum( 1 for power in powers for base in bas...
719
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 UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = fi...
59
0
_lowerCamelCase = { 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': ...
720
# 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 app...
59
0
from __future__ import annotations from decimal import Decimal from numpy import array def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementa...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "timm_backbone" def __init__( self :Union[str, Any] ...
59
0
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class UpperCamelCase_ ( snake_case_ ): lowerCamelCase_ = (EulerDiscreteScheduler,) lowerCamelCase_ = 10...
700
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
0
'''simple docstring''' class UpperCamelCase_ : def __init__( self :Optional[Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE__ = {} def _snake_case ( self :List[Any] ) -> str: """simple docstring"...
701
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
0
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @requir...
702
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableU...
703
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', 'JukeboxVQVAEConfig', ...
704
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
0
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _lowerCamelCase = pytest.mark.integration @pytest.mark.parametrize("""path""" , ["""paws""", ...
705
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
0
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functional...
706
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
0
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'vocab_file': 'vocab.txt', 'merges_file': 'bpe....
707
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
0
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Paddi...
708
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
0
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pi...
709
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
0
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Optional[int] , UpperCamelCase__: Any , UpperCamelCase__: str , UpperCamelCase__: List[Any]=5 ): # Adapted from https:...
710
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_UNKNOWN_ID...
711
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
59
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowerCamelCase = { 'configuration_mobilenet_v2': [ 'MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileNetV2Config', 'MobileNetV2OnnxC...
712
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase = {} try: if not is_sentencepiece_available(): raise Option...
713
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-textcaps...
59
0
_lowerCamelCase = {'a': ['c', 'b'], 'b': ['d', 'e'], 'c': [], 'd': [], 'e': []} _lowerCamelCase = ['a', 'b', 'c', 'd', 'e'] def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Any , UpperCamelCase__: Tuple , UpperCamelCase__: List[str] ): SCREAMI...
714
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase_ ( unittest.TestCase ): def ...
59
0
from argparse import ArgumentParser from .env import EnvironmentCommand def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) SCREAMING_SNAKE_CASE__ = parser.add_subparsers...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CONFIG_A...
59
0
from __future__ import annotations from collections.abc import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable[[int | float], int | float] , UpperCamelCase__: int | float , UpperCamelCase__: int | float , UpperCamelCase__: int = 100 ...
716
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
0
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import ...
717
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
59
0
'''simple docstring''' from ...processing_utils import ProcessorMixin class UpperCamelCase_ ( SCREAMING_SNAKE_CASE__ ): lowerCamelCase_ = ["image_processor", "feature_extractor"] lowerCamelCase_ = "TvltImageProcessor" lowerCamelCase_ ...
718
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
59
0
from __future__ import annotations _lowerCamelCase = '#' class UpperCamelCase_ : def __init__( self :Optional[int] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE__ = {} def _snake_case ( self :str , ...
719
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 UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = fi...
59
0
from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar _lowerCamelCase = TypeVar('T') class UpperCamelCase_ ( Generic[T] ): def __init__( self :Optional[Any] , __A :Tuple = True ) -> str: """simp...
720
# 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 app...
59
0
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 ...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "timm_backbone" def __init__( self :Union[str, Any] ...
59
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: List[str] ): if isinstance(_lowerCAmelCase , np.ndarray ...
700
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
0
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_...
701
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
0
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput ...
702
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
0
from __future__ import annotations from collections import Counter from random import random class UpperCamelCase_ : def __init__( self :Dict ) -> Tuple: """simple docstring""" SCREAMING_SNAKE_CASE__ = {} def _snake_case ( self ...
703
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
0
from __future__ import annotations class UpperCamelCase_ : def __init__( self :Optional[int] , __A :int ) -> None: """simple docstring""" SCREAMING_SNAKE_CASE__ = order # a_{0} ... a_{k} SCREAMING_SNAKE_CASE__ = ...
704
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list] ): SCREAMING_SNAKE_CASE__ = current_set.copy() for row_index, row in enumerate(_lowerCamelCase ): SCREAMING_SNAKE_CASE__ = row[0] for column_index, column in enumerate(_lowerCamelCase ): if mag...
705
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
0
import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow _lowerCamelCase = [ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ "text-classification", "...
706
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _lowerCamelCase = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https://huggingface.co/al...
707
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
0
'''simple docstring''' import string from math import logaa def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: str , UpperCamelCase__: str ): SCREAMING_SNAKE_CASE__ = document.translate( str.maketrans("""""" , """""" , string.punctuation ) ...
708
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename _lowerCamelCase = 'http://www.mocksite.com/file1.txt' _low...
709
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
0
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 _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = {'vocab_file': 'spm_char.mo...
710
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
0
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Optional[int] , UpperCamelCase__: Optional[int] , Uppe...
711
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
59
0
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCamelCase = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n author = "Snover, Matthew and\n Dorr, Bonnie and\n ...
712
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
0
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_informer': [ 'INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InformerC...
713
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-textcaps...
59
0
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_backbone_com...
714
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase_ ( unittest.TestCase ): def ...
59
0
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :str , *__A :Any , **__A :Dict )...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CONFIG_A...
59
0
import math import tensorflow as tf from packaging import version def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Dict ): SCREAMING_SNAKE_CASE__ = tf.convert_to_tensor(UpperCamelCase__ ) SCREAMING_SNAKE_CASE__ = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ...
716
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
0
import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline _lowerCamelCase = version.parse(version.parse(torch.__versi...
717
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
59
0
'''simple docstring''' import os def SCREAMING_SNAKE_CASE__ ( ): with open(os.path.dirname(snake_case_ ) + """/grid.txt""" ) as f: SCREAMING_SNAKE_CASE__ = [] # noqa: E741 for _ in range(20 ): l.append([int(snake_case_ ) for x in f.readline().split()]...
718
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
59
0
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def SCREAMING_SNAKE_CASE__ ( ...
719
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 UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = fi...
59
0
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 TFXLMRobertaModel @re...
720
# 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 app...
59
0
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "timm_backbone" def __init__( self :Union[str, Any] ...
59
0
_lowerCamelCase = '\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...
700
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
0
'''simple docstring''' def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list , UpperCamelCase__: list ): _validate_point(UpperCamelCase__ ) _validate_point(UpperCamelCase__ ) if len(UpperCamelCase__ ) != len(UpperCamelCase__ ): raise ValueError("""Both...
701
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
0
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_common import ...
702
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
0
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_uti...
703
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
0
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self ...
704
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
0
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Optional[int] , UpperCamelCase__: Dict ): SCREAMING_SNAKE_CASE...
705
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.r...
706
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'Intel/dpt-large': 'https://huggingface.co/Intel/dpt-large/resolve/main/config.json', # See all DP...
707
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
0
'''simple docstring''' import argparse import gc import json import os import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed f...
708
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'YituTech/conv-bert-base': 'https://huggingface....
709
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
0
from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: str , UpperCamelCase__: str , UpperCamelCase__: Optional[str] = None ): if version.parse(h...
710
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
0