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
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 fr...
647
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
1
from dataclasses import dataclass, field from typing import Optional @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =field( default="""codeparrot/codeparrot""" , metadata={"""help""": """Model name or path of model to be trained."""}) snake_case_ ...
647
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
1
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device __snake_case : Optional[Any] =False class lowerCamelCase__ ( unittest.TestCase):...
647
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_video_inputs if is_torch_available(): import ...
647
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import ...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import ...
647
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
1
from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy __snake_case : List[Any] =logging.get_logger(__name__) ...
647
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor fro...
647
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
1
import json import os import torch from diffusers import UNetaDModel os.makedirs('hub/hopper-medium-v2/unet/hor32', exist_ok=True) os.makedirs('hub/hopper-medium-v2/unet/hor128', exist_ok=True) os.makedirs('hub/hopper-medium-v2/value_function', exist_ok=True) def lowerCAmelCase__ ( lower...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
1
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( lowerCamelCase_ : List[Any] ,lowerCamelCase_ : i...
647
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : int = 10 ,lowerCamelCase_ : int = 1000 ,lowerCamelCase_ : bool = True): '''simple docstring''' assert ( isinstance(lowerCamelCase_ ,lowerCamelCase_) and isinstance(lowerCamelCase_ ,lowerCame...
647
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ...
647
1
from collections import defaultdict class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ,__lowerCamelCase ) -> List[Any]: """simple docstring""" lowerCAmelCase__ : List[Any] = total # total no of tasks (N) # D...
647
import os import jsonlines import numpy as np from tqdm import tqdm __snake_case : List[str] =2_0_4_8 __snake_case : List[Any] =4_0_9_6 __snake_case : Tuple =4_2 __snake_case : List[Any] =os.environ.pop('PROCESS_TRAIN', 'false') __snake_case :...
647
1
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : List[str] =logging.get_logger(__name__) # TODO Update this __snake_case : Any ={ 'facebook/esm-1b': 'https://h...
647
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_ful...
647
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCa...
647
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.rob...
647
1
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaa...
647
__snake_case : str ='\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' __snake_case : ...
647
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import ...
647
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
647
1
from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import TimmBackboneConfig ...
647
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
1
import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes from unilm.wavlm.WavLM ...
647
from collections.abc import Callable class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> None: """simple docstring""" lowerCAmelCase__ : list = [] # Stores indexes of each item for supporting updates and ...
647
1
import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def lowerCAmelCase__ ( lowerCamelCase_ : List[str]): '''simple docstring''' ...
647
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoToke...
647
1
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pip...
647
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
1
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.rob...
647
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' def lowerCAmelCase__ (self ) -> str: """simple docstring""" ...
647
1
import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() __snake_case : Tuple =logging.get_logger(__name__) def lowerCAmelCase__ ( lowerCamelC...
647
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
1
from __future__ import annotations import numpy as np def lowerCAmelCase__ ( lowerCamelCase_ : list[float]): '''simple docstring''' return np.maximum(0 ,lowerCamelCase_) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
647
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
1
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTeste...
647
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
1
import argparse __snake_case : Any ='docs/source/_static/js/custom.js' def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' with open(lowerCamelCase_ ,encoding='''utf-8''' ,newline='''\n''') as f: lowerCAmelCase__ : ...
647
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_video_inputs if is_torch_available(): import ...
647
1
import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_availabl...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : str ={ 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', 'EncodecConfig', ], 'feature_extraction_enco...
647
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
1
from bisect import bisect from itertools import accumulate def lowerCAmelCase__ ( lowerCamelCase_ : Tuple ,lowerCamelCase_ : str ,lowerCamelCase_ : Tuple ,lowerCamelCase_ : List[str]): '''simple docstring''' lowerCAmelCase__ : ...
647
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
1
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeat...
647
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : Tuple): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : List[Any] = [], [] while len(lowerCamelCase_) > 1: lowerCAmelCase__ , lowerCAmelCase__ : int = min(lowerCamelCase_), max(lo...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
1
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_vision_available from ...test...
647
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
1
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import ...
647
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ...
647
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCAmelCase_...
647
import os import jsonlines import numpy as np from tqdm import tqdm __snake_case : List[str] =2_0_4_8 __snake_case : List[Any] =4_0_9_6 __snake_case : Tuple =4_2 __snake_case : List[Any] =os.environ.pop('PROCESS_TRAIN', 'false') __snake_case :...
647
1
import argparse import os import torch from transformers.utils import WEIGHTS_NAME __snake_case : Union[str, Any] =['small', 'medium', 'large'] __snake_case : List[Any] ='lm_head.decoder.weight' __snake_case : Union[str, Any] ='lm_head.weight' def low...
647
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_ful...
647
1
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
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.rob...
647
1
import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_checkpoint_callback, get_ear...
647
__snake_case : str ='\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' __snake_case : ...
647
1
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, ) from transformers.utils impor...
647
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
647
1
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_case : Dict =logging.get_logger(__name__) __snake_case : str ={'vocab_file': 'sen...
647
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __snake_case : Optional[int] ={ 'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP',...
647
from collections.abc import Callable class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> None: """simple docstring""" lowerCAmelCase__ : list = [] # Stores indexes of each item for supporting updates and ...
647
1
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoToke...
647
1
import os import time import numpy as np import onnxruntime as ort __snake_case : Tuple ='1' __snake_case : Optional[int] ='0' __snake_case : List[Any] ='1' __snake_case : Tuple =ort.SessionOptions() __snake_case : Any =ort.GraphOpt...
647
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Any ={ 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureExtractor'], 'processin...
647
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' def lowerCAmelCase__ (self ) -> str: """simple docstring""" ...
647
1
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, ne...
647
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
1
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface_hub.utils as hf_hu...
647
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECKING...
647
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
1
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece...
647
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_video_inputs if is_torch_available(): import ...
647
1
import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_available(): ...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
1
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIF...
647
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
1
import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFea...
647
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
1
import argparse import os import re import packaging.version __snake_case : Optional[int] ='examples/' __snake_case : List[Any] ={ 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R'^__versi...
647
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
1
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
1
import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation __snake_...
647
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Dict ={ 'configuration_blenderbot': [ 'BLENDERBOT_PRETRAINED_C...
647
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
1
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore, ) from transfo...
647
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ...
647
1
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder,...
647
import os import jsonlines import numpy as np from tqdm import tqdm __snake_case : List[str] =2_0_4_8 __snake_case : List[Any] =4_0_9_6 __snake_case : Tuple =4_2 __snake_case : List[Any] =os.environ.pop('PROCESS_TRAIN', 'false') __snake_case :...
647
1
__snake_case : str ='\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' __snake_case : ...
647
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_ful...
647
1
import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() __snake_case : int =logging.get_logger(__n...
647
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.rob...
647
1
__snake_case : Optional[Any] =8.3144598 def lowerCAmelCase__ ( lowerCamelCase_ : float ,lowerCamelCase_ : float): '''simple docstring''' if temperature < 0: raise Exception('''Temperature cannot be less than 0 K''') if molar_mass...
647
__snake_case : str ='\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' __snake_case : ...
647
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase__ ( lowerCamelCase__ , unittest.TestC...
647
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
647
1
from __future__ import annotations import requests def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : List[Any] = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowe...
647
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
1
__snake_case : Optional[int] ={ 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB'...
647
from collections.abc import Callable class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> None: """simple docstring""" lowerCAmelCase__ : list = [] # Stores indexes of each item for supporting updates and ...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1 ,lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ : Tuple = 1 lowerCAmelCase__ : Dict = 0 for divide_by_number in range(lowerCamelCase_ ,digit + 1): lowerC...
647
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoToke...
647
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __snake_case : Union[str, Any] =logging.get_logger(__name__) __snake_case : Uni...
647
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
1
import numpy as np def lowerCAmelCase__ ( lowerCamelCase_ : np.ndarray ,lowerCamelCase_ : np.ndarray ,lowerCamelCase_ : float = 1E-12 ,lowerCamelCase_ : int = 100 ,): '''simple docstring''' assert np.shape(lowerCamelCase_)[0] == np...
647
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' def lowerCAmelCase__ (self ) -> str: """simple docstring""" ...
647
1
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default...
647
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
1
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=lowerCamelCase__): '''simple docstring''' snake_case_ =["""torch"""] def __init__(self ,*__lowerCamelCase ,**__lowerCamelCase ) -> Any: """simple docstring""" ...
647
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
1
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case : List[Any] ='\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {BLEU: a Meth...
647
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
1
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets __snake_case : Optional[int] =datasets.logging.get_logger(__name__) __snake_case : List[Any] ='\\n@InProceedings{m...
647
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_video_inputs if is_torch_available(): import ...
647
1
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_case : Dict =logging.get_logger(__name__) __snake_case : int ='▁' __snake_case ...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' if num <= 0: raise ValueError('''Input must be a positive integer''') lowerCAmelCase__ : Optional[Any] = [True] * (num + 1) lowerCAmelCase__ : Union[str, Any] = 2 wh...
647
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
1
from __future__ import annotations from typing import TypedDict class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =42 snake_case_ =42 def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' ...
647
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
1
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_vision from transformers.util...
647
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
1
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class lowerCamelCase__ ( lowerCamelCase__ , lowerCamelCase__): '''simple docstring''' @register_to_config def __init__(self ,*, __lowerCam...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPIma...
647
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) fr...
647
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
1
import functools def lowerCAmelCase__ ( lowerCamelCase_ : list[int] ,lowerCamelCase_ : list[int]): '''simple docstring''' if not isinstance(lowerCamelCase_ ,lowerCamelCase_) or not all(isinstance(lowerCamelCase_ ,lowerCamelCase_) for day in days): ...
647
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ...
647
1
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils impo...
647
import os import jsonlines import numpy as np from tqdm import tqdm __snake_case : List[str] =2_0_4_8 __snake_case : List[Any] =4_0_9_6 __snake_case : Tuple =4_2 __snake_case : List[Any] =os.environ.pop('PROCESS_TRAIN', 'false') __snake_case :...
647
1
from jiwer import compute_measures import datasets __snake_case : Dict ='\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation ...
647
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_ful...
647
1
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
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.rob...
647
1
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) __snake_case...
647
__snake_case : str ='\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' __snake_case : ...
647
1
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...te...
647
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
647
1
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : list[int]): '''simple docstring''' if not nums: return 0 lowerCAmelCase__ : Union[str, Any] = nums[0] lowerCAmelCase__ : Dict = 0 for num in nums[1:]: ...
647
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
1
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version __snake_case : Any ={ '<': operator.lt, '<=': operator.le, '==': operator.eq, '!=': operator.ne, '>=': operator.ge, '>': operator.gt, } def ...
647
from collections.abc import Callable class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> None: """simple docstring""" lowerCAmelCase__ : list = [] # Stores indexes of each item for supporting updates and ...
647
1
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : ...
647
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoToke...
647
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
1
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Dict =logging.get_logger(__name__) __snake_case : List[Any] ={ 'snap-research/efficientformer-l1-300': ( 'https://huggingface.co/snap-research/effic...
647
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' def lowerCAmelCase__ (self ) -> str: """simple docstring""" ...
647
1
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device __snake_case : Tuple =False class lowerCamelCase__ ( unittest.Tes...
647
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
1
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Conf...
647
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
1
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStructTextConfig, ...
647
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
1
import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging __snake_case : List[A...
647
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_video_inputs if is_torch_available(): import ...
647
1
# Algorithm for the pigeonhole sorting def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Dict = min(lowerCamelCase_) # min() finds the minimum value lowerCAmelCase__ : Tuple = max(lowerCamelCase_) # max(...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : list): '''simple docstring''' if len(lowerCamelCase_) <= 1: return lst lowerCAmelCase__ : List[Any] = 1 while i < len(lowerCamelCase_): if lst[i - 1] <= lst[i]: i += 1 else: ...
647
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
1
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : List[Any]=() ,lowerCamelCase_...
647
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
1
import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig __snake_case : List[Any] =logging.get_logger(__name__) __snake_case : Dict ='T5Config' ...
647
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
1
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( '''split_dict''' ,[ SplitDict(), SplitDict({'''train''': SplitInfo(name='''train''' ,num_bytes=1337 ,num_examples=42 ,dataset_name='''my_dataset''')}...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
1
import unittest import numpy as np import requests 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()...
647
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
1
import re def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' return [char.split() for char in re.split(r'''[^ a-z A-Z 0-9 \s]''' ,str_)] def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring'''...
647
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
1
# Function to print upper half of diamond (pyramid) def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' for i in range(0 ,lowerCamelCase_): for _ in range(0 ,n - i - 1): # printing spaces print(''' ''' ,end='''''') f...
647
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ...
647
1
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class lowerCa...
647
import os import jsonlines import numpy as np from tqdm import tqdm __snake_case : List[str] =2_0_4_8 __snake_case : List[Any] =4_0_9_6 __snake_case : Tuple =4_2 __snake_case : List[Any] =os.environ.pop('PROCESS_TRAIN', 'false') __snake_case :...
647
1