code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from ... import PretrainedConfig _A : Any = { """sijunhe/nezha-cn-base""": """https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json""", } class __snake_case ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowerCamelCase__ : str = NEZHA_PRETR...
100
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
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__ : int =pytest.mark.integration @pytest.mark.paramet...
101
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
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class ...
102
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
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils ...
103
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
0
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def _lowerCamelCase ( UpperCAmelCase_ : Tuple="ro", UpperCAmelCase_ : Any="en", UpperCAmelCase_ : List[str]="wmt16", UpperCAmelCase_ : Dict=None ) -> None: ...
104
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
0
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging UpperCamelCase__ : Any = logging.get_logger(__name__) def __UpperCAmelCase ( lowerCamelCase_ : Tup...
105
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
0
from __future__ import annotations __snake_case :Union[str, Any] =tuple[int, int, int] __snake_case :Tuple =tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase __snake_case :Tuple ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' # -------------------...
106
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
0
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils ...
107
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
0
from __future__ import annotations from collections.abc import Generator def _SCREAMING_SNAKE_CASE ( ) -> Generator[int, None, None]: _UpperCAmelCase = {} _UpperCAmelCase = 2 while True: _UpperCAmelCase = factor_map.pop(__snak...
108
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
0
'''simple docstring''' from functools import lru_cache @lru_cache def __magic_name__ ( __UpperCAmelCase ) -> int: '''simple docstring''' if num < 0: raise ValueError("""Number should not be negative.""" ) return 1 if num in (0, 1) else num * factorial(num - 1 ...
109
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
0
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 a_ = False class __lowerCAmelCase ( unittest.TestCase ): pass @ni...
175
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
0
def UpperCamelCase ( __lowercase : list ): '''simple docstring''' if len(lowerCamelCase_ ) <= 1: return lst A_ : List[Any] = 1 while i < len(lowerCamelCase_ ): if lst[i - 1] <= lst[i]: i += 1 else: A_ : List[st...
558
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
0
'''simple docstring''' from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase_ = 6_37_81_37.0 lowerCAmelCase_ = 6_35_67_52.31_42_45 lowerCAmelCase_ = 6_3_7_8_1_3_7 def _A ( UpperCAmelCase ,UpperCAmelCase ,UpperCAmelCase ...
531
__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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase : Dict = { 'configuration_blenderbot': [ ...
663
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
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_ut...
672
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
0
"""simple docstring""" 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...
218
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
0
'''simple docstring''' import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() _SC...
369
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
0
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import t...
313
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
0
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_checkpoin...
311
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
0
"""simple docstring""" 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, BER...
564
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
0
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time A_: Dict = Lock() def __lowerCAmelCase ( _A ,_A ,_A ,_A ,_A ,_A ,_A ): """simple docstring""" global process_lock # we perfo...
398
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
0
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_...
175
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
0
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () _UpperCAmelCase = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf(), gbell...
558
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
0
'''simple docstring''' 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' ...
531
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
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 transfor...
663
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
0
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __magic_name__ : Any = HfArgumentParser(InitializationArguments) __magic_name__ : Any = parser.parse_args() #...
672
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
0
"""simple docstring""" 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....
218
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
0
'''simple docstring''' # Algorithm for the pigeonhole sorting def __lowerCamelCase ( __lowerCAmelCase : Dict ) -> int: snake_case = min(lowerCamelCase_ ) # min() finds the minimum value snake_case = max(lowerCamelCase_ ) ...
369
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
0
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 ...
313
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
0
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 ...
311
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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase : str = logging.get_logger(__name__) __lowercase : Tuple = { 'microsoft/biogpt': 'https://huggingface.co/microsoft/biogpt/resolve/main/config.json', # See...
564
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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_: int = { 'configuration_mobilenet_v2': [ 'MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileNetV2Config', 'MobileNetV2OnnxConfig', ]...
398
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
0
from jiwer import compute_measures import datasets a_ = '\\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 measures for connec...
175
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
0
def UpperCamelCase ( __lowercase : Dict ): '''simple docstring''' A_ : Optional[Any] = len(lowerCamelCase_ ) while cur > 1: # Find the maximum number in arr A_ : Tuple = arr.index(max(arr[0:cur] ) ) # Reverse from 0 to mi...
558
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
0
'''simple docstring''' import numpy as np def _A ( UpperCAmelCase ,UpperCAmelCase ,UpperCAmelCase = 1e-12 ,UpperCAmelCase = 100 ,): '''simple docstring''' assert np.shape(lowerCamelCase_ )[0] == np.shape(lowerCamelCase_ )[1] # Ensure prop...
531
__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
0
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf...
663
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
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch...
672
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
0
"""simple docstring""" import argparse import os import re a : Optional[int] = 'src/diffusers' # Pattern that looks at the indentation in a line. a : str = re.compile(r"""^(\s*)\S""") # Pattern that matches `"key":" and puts `key` in group 0. ...
218
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
0
'''simple docstring''' from collections import defaultdict class _lowerCAmelCase : """simple docstring""" def __init__( self : Any , __snake_case : Optional[int] , __snake_case : int )-> List[Any]: snak...
369
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
0
from math import factorial, radians def A ( snake_case__ : float , snake_case__ : int = 18 , snake_case__ : int = 10 ) -> Dict: '''simple docstring''' __snake_case = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting fro...
313
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ : Union[str, Any] = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_M...
311
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
0
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ...
564
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
0
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 ...test_c...
398
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
0
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...
175
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
0
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() _UpperCAmelCase = logging.get_logger(__name__) def UpperCamelCase ( __lowercase : ...
558
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
0
'''simple docstring''' def _A ( UpperCAmelCase ,UpperCAmelCase ): '''simple docstring''' A__ = (boundary[1] - boundary[0]) / steps A__ = boundary[0] A__ = boundary[1] A__ = make_points(lowerCamelCase_ ,lowerCamelCa...
531
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
0
import warnings 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 _lowerCamelCase : Optional[int] = logging.get_logger(__...
663
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
0
'''simple docstring''' def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' _snake_case = current_set.copy() for row_index, row in enumerate(lowerCamelCase_ ): _snake_case = row[0] for column_index, column in enumerate(lowerCamelCase_ ...
672
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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a : str = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
218
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
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...
369
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
313
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
0
import argparse SCREAMING_SNAKE_CASE__ : Any = 'docs/source/_static/js/custom.js' def A ( _SCREAMING_SNAKE_CASE ) -> Dict: with open(lowerCamelCase_ ,encoding="utf-8" ,newline="\n" ) as f: lowerCamelCase : List[str] = f.readlines...
311
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
0
"""simple docstring""" 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:...
564
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
0
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 SequenceFeature...
398
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
0
import unittest from knapsack import greedy_knapsack as kp class __lowerCAmelCase ( unittest.TestCase ): def lowerCamelCase ( self ): '''simple docstring''' __lowerCamelCase = [10, 20, 30, 40, 50, 60] __lowerCamelCase = [2, 4, 6, 8, 10, 12] ...
175
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
0
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(): from tran...
558
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
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _snake_case( unittest.Tes...
531
__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
0
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 _lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) _low...
663
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
0
'''simple docstring''' 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...
672
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
0
"""simple docstring""" def lowercase__() ->int: """simple docstring""" return 1 def lowercase__(A ) ->Any: """simple docstring""" return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def lowe...
218
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
0
'''simple docstring''' 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 .tokenizat...
369
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
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Optional[int] = logging.get_logger(__name__) ...
313
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
0
def A ( _SCREAMING_SNAKE_CASE ) -> List[str]: if upper_limit < 0: raise ValueError("Limit for the Catalan sequence must be ≥ 0" ) lowerCamelCase : Optional[int] = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 lowerCa...
311
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
0
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git...
564
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_: int = { 'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'VisionEncoderDecoderOnnxConfig'] } try: ...
398
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
0
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor a_ = logging.get_logger(__name__) class __lowerCAmelCase ( lowerCamelCase__ ): def __init__( self , *__UpperCAmelCase , **__UpperCAmelCase ): '''sim...
175
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
0
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_forma...
558
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
0
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _snake_case: __snake_case: str = None __snake_case: List[Any] = False __snake_case: str = False __snake_c...
531
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
0
import itertools import math def _a ( SCREAMING_SNAKE_CASE__ : int ) -> Union[str, Any]: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number ...
663
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
0
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, p...
672
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
0
"""simple docstring""" import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers c...
218
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
0
'''simple docstring''' 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 fro...
369
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
0
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def A ( snake_case__ : List[Any] ) -> Optional[int]: '''simple docstring''' def wrapper(*snake_case__ : Any , ...
313
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
0
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def A ( _SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ) -...
311
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
0
"""simple docstring""" 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 # impo...
564
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
0
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_p...
398
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
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def a__ ( _UpperCamelCase : int ,_UpperCamelCase : List[Any]=() ,_UpperCamelCase : List[str]=None ,_...
175
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
0
from __future__ import annotations import requests def UpperCamelCase ( __lowercase : str ): '''simple docstring''' A_ : List[Any] = f'''https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty''' return requests.get(lowerCamelCase_ )....
558
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
0
'''simple docstring''' import argparse import os import re import packaging.version lowerCAmelCase_ = 'examples/' lowerCAmelCase_ = { 'examples': (re.compile(R'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R...
531
__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
0
from __future__ import annotations import math def _a ( SCREAMING_SNAKE_CASE__ : int ) -> Any: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or...
663
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
0
'''simple docstring''' 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 hu...
672
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
0
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basic...
218
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
0
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def __lowerCamelCase ( __lowerCAmelCase : Optional[Any] ) -> Any: snake_case = FileLock(str(tmpdir / """foo.lock""" ) ) snake_c...
369
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
0
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_opt...
313
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
0
import argparse import os import torch from transformers.utils import WEIGHTS_NAME SCREAMING_SNAKE_CASE__ : Union[str, Any] = ['small', 'medium', 'large'] SCREAMING_SNAKE_CASE__ : List[Any] = 'lm_head.decoder.weight' SCREAMING_SNAKE_CASE__ : Union[str, Any] = 'lm_head.weight'...
311
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
0
"""simple docstring""" import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) ...
564
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
0
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version A_: Any = { '<': operator.lt, '<=': operator.le, '==': operator.eq, '!=': operator.ne, '>=': operator.ge, '>': operator.gt, } def __lowerCAmelCase ( ...
398
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
0
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 a_ = ...
175
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
0
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): impo...
558
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
0
'''simple docstring''' 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, RegN...
531
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
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class lowerCamelCase : """simple docstring""" UpperCAmelCase_ = 42 # [batch_size x 3] UpperCAmelCase_ = 42 # [batch_size...
663
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
0
'''simple docstring''' from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
672
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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Tuple = { 'configuration_mvp': ['MVP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MvpConfig', 'MvpOnnx...
218
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
0
'''simple docstring''' def __lowerCamelCase ( __lowerCAmelCase : int ) -> Optional[int]: if num <= 0: raise ValueError("""Input must be a positive integer""" ) snake_case = [True] * (num + 1) snake_case = 2 while p * p <= num: ...
369
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
0
import math import unittest def A ( snake_case__ : int ) -> Optional[int]: '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are prim...
313
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
0
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 SCREAMING_SNAKE_CASE__ : List[Any] = logging.get_logge...
311
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
0
"""simple docstring""" def SCREAMING_SNAKE_CASE ( snake_case = 1, snake_case = 10_00): __snake_case = 1 __snake_case = 0 for divide_by_number in range(lowerCamelCase_, digit + 1): __snake_case = [] __snake_case = numerator f...
564
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
0
A_: Optional[Any] = 8.3_1_4_4_5_9_8 def __lowerCAmelCase ( _A ,_A ): """simple docstring""" if temperature < 0: raise Exception("""Temperature cannot be less than 0 K""" ) if molar_mass <= 0: raise Exception("""Molar mass cannot ...
398
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
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureExtractor'], 'processing_mctct': ['MCTCTP...
175
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
0
def UpperCamelCase ( __lowercase : Tuple ): '''simple docstring''' A_ : List[Any] = [], [] while len(lowerCamelCase_ ) > 1: A_ : int = min(lowerCamelCase_ ), max(lowerCamelCase_ ) start.append(lowerCamelCase_ ) end.a...
558
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
0