code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def _lowerCAmelCase ( lowerCamelCase_ : Optional[Any] ): ...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDim...
56
0
'''simple docstring''' import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput _SCREAMING_SNAKE_CASE = '''scheduler_config...
710
'''simple docstring''' from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean _SCREAMING_SNAKE_CASE = 0 _SCREAMING_SNAKE_CASE = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstac...
56
0
import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def _lowerCAmelCase ( lowerCamelCase_ : Optional[int] ): ...
711
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosi...
56
0
'''simple docstring''' def _lowerCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int ): '''simple docstring''' if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) __lowercase = str(bi...
712
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger _SCREAMING_SNAKE_CASE = '''<<<<<<< This should probably be modified because it ...
56
0
'''simple docstring''' from typing import Any def _lowerCAmelCase ( lowerCamelCase_ : list , lowerCamelCase_ : list , lowerCamelCase_ : dict , lowerCamelCase_ : dict , lowerCamelCase_ : dict , ): _validation( lowerCamel...
713
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAP...
56
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { '''configuration_x_clip''': [ '''XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XCLIPConfig''', ...
714
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: i...
56
0
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger _SCREAMING_SNAKE_CASE = '''<<<<<<< This should probably be modified because it mentions: ''' _SCREAMING_SN...
715
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __lowercase ( lowerCAmelCase__ ): '''simple docstrin...
56
0
'''simple docstring''' def _lowerCAmelCase ( lowerCamelCase_ : str ): __lowercase = 0 for ch in input_str: __lowercase = ord(lowerCamelCase_ ) __lowercase = pow(2 , lowerCamelCase_ ) # If we alre...
716
'''simple docstring''' from __future__ import annotations from typing import Any class __lowercase : '''simple docstring''' def __init__(self ,_lowerCamelCase ) -> None: '''simple docstring''' __lowerca...
56
0
'''simple docstring''' def _lowerCAmelCase ( lowerCamelCase_ : str ): return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(lowerCamelCase_ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''').testmo...
717
'''simple docstring''' import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) _SCREAMING_SNAKE_CASE = m...
56
0
'''simple docstring''' import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin, SchedulerO...
718
'''simple docstring''' # flake8: noqa # Lint as: python3 _SCREAMING_SNAKE_CASE = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import Veri...
56
0
'''simple docstring''' from __future__ import annotations import math def _lowerCAmelCase ( lowerCamelCase_ : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1...
719
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational impo...
56
0
'''simple docstring''' import os import jsonlines import numpy as np from tqdm import tqdm _SCREAMING_SNAKE_CASE = 2_0_4_8 _SCREAMING_SNAKE_CASE = 4_0_9_6 _SCREAMING_SNAKE_CASE = 4_2 _SCREAMING_SNAKE_CASE = os.environ.pop('''PROCESS_TRAIN''', '''false''') _SC...
720
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _SCREAMING_SNAKE_CASE = '''\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Under...
56
0
'''simple docstring''' import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class __lowercase : '''simple docstring''' def __init__(se...
721
'''simple docstring''' import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def _lowerCAmelCase ...
56
0
'''simple docstring''' from argparse import ArgumentParser from .env import EnvironmentCommand def _lowerCAmelCase ( ): __lowercase = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) __lowercase =...
700
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_...
56
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
701
'''simple docstring''' import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokeni...
56
0
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { '''post_extract_proj...
702
'''simple docstring''' 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, ) _SCREAMING_SNAKE_CASE ...
56
0
def _lowerCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : list[str] ): __lowercase = '''''' for word_or_phrase in separated: if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise Exception('''join() accepts only string...
703
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _SCREAMING_SNAKE_CASE = WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN''']) ...
56
0
import os from datetime import datetime as dt from github import Github _SCREAMING_SNAKE_CASE = [ '''good first issue''', '''feature request''', '''wip''', ] def _lowerCAmelCase ( ): __lowercase = Github(os.environ['''GITHUB_TOKEN'''] ...
704
'''simple docstring''' from argparse import ArgumentParser from .env import EnvironmentCommand def _lowerCAmelCase ( ): __lowercase = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) __lowercase =...
56
0
from math import sqrt def _lowerCAmelCase ( lowerCamelCase_ : int ): assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" __lowercase = True # 0 and 1 are none primes...
705
'''simple docstring''' import math def _lowerCAmelCase ( lowerCamelCase_ : int ): assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are prime...
56
0
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow _SCREAMING_SNAKE_CASE = logging.getLogger() ...
706
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def _lowerCAmelCase ( lowerCamelCase_ : Sequence[float] , lowerCamelCase_ : int , ...
56
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedCla...
707
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''',...
56
0
def _lowerCAmelCase ( lowerCamelCase_ : int = 1_0_0_0_0_0_0 ): __lowercase = set(range(3 , lowerCamelCase_ , 2 ) ) primes.add(2 ) for p in range(3 , lowerCamelCase_ , 2 ): if p not in primes: continue ...
708
'''simple docstring''' import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers imp...
56
0
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union _SCREAMING_SNAKE_CASE = TypeVar('''T''') _SCREAMING_SNAKE_CASE = Union[List[T], Tuple[T, ...]] _SCREAMING_SNAKE_CASE = Union[T, List[T], Dict[str, T]] _SCREAMING_SNAKE_CASE = U...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDim...
56
0
'''simple docstring''' import logging from transformers.configuration_utils import PretrainedConfig _SCREAMING_SNAKE_CASE = logging.getLogger(__name__) class __lowercase ( lowerCAmelCase__ ): '''simple docstring''' a : Optional[...
710
'''simple docstring''' from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean _SCREAMING_SNAKE_CASE = 0 _SCREAMING_SNAKE_CASE = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstac...
56
0
def _lowerCAmelCase ( lowerCamelCase_ : str ): __lowercase = [int(lowerCamelCase_ ) for i in ip_va_address.split('''.''' ) if i.isdigit()] return len(lowerCamelCase_ ) == 4 and all(0 <= int(lowerCamelCase_ ) <= 2_5_4 for octet in octets ) if __name...
711
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosi...
56
0
'''simple docstring''' def _lowerCAmelCase ( lowerCamelCase_ : List[str] ): '''simple docstring''' __lowercase = len(lowerCamelCase_ ) for i in range(length - 1 ): __lowercase = i for k in range(i + 1 , ...
712
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger _SCREAMING_SNAKE_CASE = '''<<<<<<< This should probably be modified because it ...
56
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = { '''configuration_resnet''': ['''RESNET_PRETRAIN...
713
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAP...
56
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase ( metaclass=lowerCAmelCase__ ): '''simple docstring''' a : Optional[int] = ["flax"] def __init__(self ,*_lowerCamelCase ...
714
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: i...
56
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMIN...
715
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __lowercase ( lowerCAmelCase__ ): '''simple docstrin...
56
0
'''simple docstring''' import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_util...
716
'''simple docstring''' from __future__ import annotations from typing import Any class __lowercase : '''simple docstring''' def __init__(self ,_lowerCamelCase ) -> None: '''simple docstring''' __lowerca...
56
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : List[Any] = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/O...
717
'''simple docstring''' import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) _SCREAMING_SNAKE_CASE = m...
56
0
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers ...
718
'''simple docstring''' # flake8: noqa # Lint as: python3 _SCREAMING_SNAKE_CASE = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import Veri...
56
0
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='''session''' ...
719
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational impo...
56
0
'''simple docstring''' from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor ...
720
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _SCREAMING_SNAKE_CASE = '''\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Under...
56
0
'''simple docstring''' from math import sqrt def _lowerCAmelCase ( lowerCamelCase_ : int = 1_0_0_0_0_0_0 ): __lowercase = 0 __lowercase = 0 __lowercase = 4_2 while num_cuboids <= limit: max_cuboid_size += 1 for sum_short...
721
'''simple docstring''' import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def _lowerCAmelCase ...
56
0
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SN...
700
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_...
56
0
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_d...
701
'''simple docstring''' import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokeni...
56
0
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before ...
702
'''simple docstring''' 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, ) _SCREAMING_SNAKE_CASE ...
56
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def _lowerCAmelCase ( lowerCamelCase_ : Union[tf.Tensor, np.ndarray] ): if isinstance(lowerCame...
703
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _SCREAMING_SNAKE_CASE = WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN''']) ...
56
0
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def _lowerCAmelCase ( lowerCamelCase_ : Dict ): # picklable ...
704
'''simple docstring''' from argparse import ArgumentParser from .env import EnvironmentCommand def _lowerCAmelCase ( ): __lowercase = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) __lowercase =...
56
0
_SCREAMING_SNAKE_CASE = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import VerificationMode from .logging import disable_progress_bar, enable_pr...
705
'''simple docstring''' import math def _lowerCAmelCase ( lowerCamelCase_ : int ): assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are prime...
56
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE = ...
706
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def _lowerCAmelCase ( lowerCamelCase_ : Sequence[float] , lowerCamelCase_ : int , ...
56
0
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 im...
707
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''',...
56
0
import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors import Templat...
708
'''simple docstring''' import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers imp...
56
0
'''simple docstring''' 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, ) _SCREAMING_SNAKE_CASE ...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDim...
56
0
'''simple docstring''' import random class __lowercase : '''simple docstring''' @staticmethod def _UpperCAmelCase (_lowerCamelCase ) -> tuple[list[int], list[int]]: '''simple docstring''' __lowercase ...
710
'''simple docstring''' from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean _SCREAMING_SNAKE_CASE = 0 _SCREAMING_SNAKE_CASE = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstac...
56
0
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.aut...
711
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosi...
56
0
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _lowerCAmelCase ( ): '''simple docstring''' __lowercase = HfArgumentParser(lowerCamelCase_ ) __lowercase = ...
712
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger _SCREAMING_SNAKE_CASE = '''<<<<<<< This should probably be modified because it ...
56
0
'''simple docstring''' 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 BaseTransforme...
713
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAP...
56
0
'''simple docstring''' import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba...
714
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: i...
56
0
from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def _lowerCAmelCas...
715
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __lowercase ( lowerCAmelCase__ ): '''simple docstrin...
56
0
'''simple docstring''' from collections.abc import Sequence def _lowerCAmelCase ( lowerCamelCase_ : Sequence[int] | None = None ): if nums is None or not nums: raise ValueError('''Input sequence should not be empty''' ) __lowercase = nums[0...
716
'''simple docstring''' from __future__ import annotations from typing import Any class __lowercase : '''simple docstring''' def __init__(self ,_lowerCamelCase ) -> None: '''simple docstring''' __lowerca...
56
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _SCREAMING_SNAKE_CASE : Optional[Any] = { '''configuration_nezha''': ['''NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP'...
717
'''simple docstring''' import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) _SCREAMING_SNAKE_CASE = m...
56
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = ...
718
'''simple docstring''' # flake8: noqa # Lint as: python3 _SCREAMING_SNAKE_CASE = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import Veri...
56
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDim...
719
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational impo...
56
0
'''simple docstring''' from __future__ import annotations from random import choice def _lowerCAmelCase ( lowerCamelCase_ : str ): return choice(lowerCamelCase_ ) def _lowerCAmelCase ( lowerCamelCase_ : list[int] , lowerCamelCase_ : ...
720
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _SCREAMING_SNAKE_CASE = '''\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Under...
56
0
'''simple docstring''' from __future__ import annotations from typing import Any def _lowerCAmelCase ( lowerCamelCase_ : list ): if not postfix_notation: return 0 __lowercase = {'''+''', '''-''', '''*''', '''/'''} __lowercase = [] for toke...
721
'''simple docstring''' import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def _lowerCAmelCase ...
56
0
'''simple docstring''' def _lowerCAmelCase ( lowerCamelCase_ : list , lowerCamelCase_ : int , lowerCamelCase_ : int = 0 , lowerCamelCase_ : int = 0 ): __lowercase = right or len(lowerCamelCase_ ) - 1 if left > right: retu...
700
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_...
56
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _SCREAMING_SNAKE_CAS...
701
'''simple docstring''' import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokeni...
56
0
import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accelerate.uti...
702
'''simple docstring''' 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, ) _SCREAMING_SNAKE_CASE ...
56
0
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_availabl...
703
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _SCREAMING_SNAKE_CASE = WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN''']) ...
56
0
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, )...
704
'''simple docstring''' from argparse import ArgumentParser from .env import EnvironmentCommand def _lowerCAmelCase ( ): __lowercase = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) __lowercase =...
56
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers...
705
'''simple docstring''' import math def _lowerCAmelCase ( lowerCamelCase_ : int ): assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are prime...
56
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 cla...
706
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def _lowerCAmelCase ( lowerCamelCase_ : Sequence[float] , lowerCamelCase_ : int , ...
56
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx im...
707
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''',...
56
0
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class __lowercase ( unittest.TestCase ): '''simple docstring''' def _UpperCAmelCase (self ) ...
708
'''simple docstring''' import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers imp...
56
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) fr...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDim...
56
0
'''simple docstring''' import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transform...
710
'''simple docstring''' from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean _SCREAMING_SNAKE_CASE = 0 _SCREAMING_SNAKE_CASE = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstac...
56
0
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch _SCREA...
711
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosi...
56
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __lowercase ( lowerCAmelCase__ ): '''simple docstrin...
712
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger _SCREAMING_SNAKE_CASE = '''<<<<<<< This should probably be modified because it ...
56
0
'''simple docstring''' from PIL import Image def _lowerCAmelCase ( lowerCamelCase_ : Image ): __lowercase , __lowercase = image.size __lowercase = 0 __lowercase = image.load() for i in range(lowerCamelCase_ ...
713
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAP...
56
0
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithN...
714
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: i...
56
0
_SCREAMING_SNAKE_CASE = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git ''' _SCREAMING_SNAKE_CASE...
715
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __lowercase ( lowerCAmelCase__ ): '''simple docstrin...
56
0
'''simple docstring''' import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _SCREAMING_SNAKE_CASE : Union[str, Any] ...
716
'''simple docstring''' from __future__ import annotations from typing import Any class __lowercase : '''simple docstring''' def __init__(self ,_lowerCamelCase ) -> None: '''simple docstring''' __lowerca...
56
0
'''simple docstring''' 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_co...
717
'''simple docstring''' import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) _SCREAMING_SNAKE_CASE = m...
56
0
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tens...
718
'''simple docstring''' # flake8: noqa # Lint as: python3 _SCREAMING_SNAKE_CASE = [ '''VerificationMode''', '''Version''', '''disable_progress_bar''', '''enable_progress_bar''', '''is_progress_bar_enabled''', '''experimental''', ] from .info_utils import Veri...
56
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 fr...
719
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational impo...
56
0
'''simple docstring''' import math def _lowerCAmelCase ( lowerCamelCase_ : int ): assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are prime...
720
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _SCREAMING_SNAKE_CASE = '''\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Under...
56
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs i...
721
'''simple docstring''' import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def _lowerCAmelCase ...
56
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase : Tuple = logging.get_logger(__name__) __UpperCAmelCase : Optional[Any] = {} class _snake_case ( _A ): _A = 'llama' _A = ['pas...
57
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, ...
57
1
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils im...
57
import pytest __UpperCAmelCase : int = "__dummy_dataset1__" __UpperCAmelCase : int = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann...
57
1
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging __UpperCAmelCase : Union[s...
57
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: fro...
57
1
from collections import defaultdict class _snake_case : def __init__( self ,UpperCamelCase ,UpperCamelCase ) -> Optional[Any]: snake_case__ :Dict = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
57
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter __UpperCAmelCase ...
57
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging...
57
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer __UpperCAmelCase : str = logging.get_logger(__name__) __UpperCAmelCase : List[Any] ...
57
1
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter __UpperCAmelCase ...
57
def lowercase_ ( __snake_case : int ) -> bool: '''simple docstring''' if p < 2: raise ValueError("p should not be less than 2!" ) elif p == 2: return True snake_case__ :List[str] = 4 snake_case__ ...
57
1
import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset from...
57
from typing import Any def lowercase_ ( __snake_case : list , __snake_case : list , __snake_case : dict , __snake_case : dict , __snake_case : dict , ) -> list: '''simple docstring''' _validation( __s...
57
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class _snake_case ( unittest.TestCase ): def lowerCAmelCas...
57
def lowercase_ ( __snake_case : str ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__snake_case ) ) if txt[a].isalpha() ] if __name__ == "__main__": __...
57
1
def lowercase_ ( __snake_case : int , __snake_case : int ) -> int: '''simple docstring''' return number | (1 << position) def lowercase_ ( __snake_case : int , __snake_case : int ) -> int: ...
57
def lowercase_ ( __snake_case : int = 10_00 ) -> int: '''simple docstring''' snake_case__ :int = 3 snake_case__ :int = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % ...
57
1
import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor ...
57
import os import sys import unittest __UpperCAmelCase : str = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, creat...
57
1
from __future__ import annotations def lowercase_ ( __snake_case : list[int] ) -> int: '''simple docstring''' snake_case__ :Union[str, Any] = len(__snake_case ) // 2 # choose the middle 3 elements snake_case__ ...
57
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __UpperCAmelCase : Tuple = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable...
57
1
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_...
57
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
57
1
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __UpperCAmelCase :...
57
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from...
57
1
def lowercase_ ( __snake_case : str , __snake_case : str ) -> str: '''simple docstring''' snake_case__ :int = len(__snake_case ) snake_case__ :int = len(__snake_case ) snake_case__ :int ...
57
from __future__ import annotations class _snake_case : def __init__( self ,UpperCamelCase ) -> None: snake_case__ :Union[str, Any] = data snake_case__ :Node | None = None snake_case__ :Node | None ...
57
1
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from...
57
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore __UpperCAmelCase : List[Any] = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" __UpperCAmelCase : in...
57
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_availab...
57
def lowercase_ ( __snake_case : Tuple , __snake_case : Optional[int] ) -> List[Any]: '''simple docstring''' snake_case__ :Dict = "" for i in table: res += inp[i - 1] return res def lowercase_ ( ...
57
1
import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __UpperCAmelCase : Union[str, Any] = "src/transformers" # This is to make su...
57
import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _snake_case ...
57
1
def lowercase_ ( __snake_case : int = 10_00 ) -> int: '''simple docstring''' snake_case__ :int = 3 snake_case__ :int = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % ...
57
__UpperCAmelCase : int = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} __UpperCAmelCase : List[str] = ["a", "b", "c", "d", "e"] def lowercase_ ( __snake_case : Optional[Any] , __snake_case : List[Any] , __snake_case ...
57
1
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from...
57
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from...
57
1
from PIL import Image def lowercase_ ( __snake_case : Image , __snake_case : int ) -> Image: '''simple docstring''' snake_case__ :int = (2_59 * (level + 2_55)) / (2_55 * (2_59 - level)) def contrast(__snake_case ...
57
def lowercase_ ( __snake_case : list ) -> list: '''simple docstring''' if any(not isinstance(__snake_case , __snake_case ) or x < 0 for x in sequence ): raise TypeError("Sequence must be list of non-negative integers" ) for _ ...
57
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRContextEnc...
57
from __future__ import annotations def lowercase_ ( __snake_case : list ) -> float: '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(__snake_case ) / len(__snake_case ) if __nam...
57
1