code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP/resolve/mai...
76
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' ) def UpperCamelCase_( ) -> Any: _lowercase...
89
0
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block @datacl...
311
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCAmelCase__: Dict = { "configuration_gpt_neo": ["GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoConfig", "GPTNeoOnnxConfig"], } try: if no...
311
1
"""simple docstring""" from __future__ import annotations import time import numpy as np UpperCAmelCase =[8, 5, 9, 7] UpperCAmelCase =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] UpperCAmelCase =[ [3, 2, ...
617
"""simple docstring""" import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_...
617
1
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class UpperCAmelCase__ : def __init__( self ,A__ ,A__ ,A__ ): if dst_width < 0 or dst_height < 0: raise ValueError('''Destination width/height should be > 0''' ) _A : Uni...
718
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _UpperCamelCase : Any ={'configuration_vit': ['VIT_PRETRAINED_CONFIG_ARCHIVE_MAP', '...
332
0
"""simple docstring""" import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is...
610
"""simple docstring""" 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 OptionalDependencyN...
610
1
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTokeniz...
106
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 ( AlbertTokenizer, AutoTokenizer...
106
1
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils i...
379
import requests from bsa import BeautifulSoup def _lowerCamelCase ( SCREAMING_SNAKE_CASE_ : str = "AAPL" ): """simple docstring""" a_ : Optional[Any] = F"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" a_ : Optional[int] = ...
419
0
import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthC...
712
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __magic_name__ = {'''processing_layoutxlm''': ['''LayoutXLMProcessor'...
73
0
def __lowerCamelCase (UpperCAmelCase__ : int , UpperCAmelCase__ : List[Any] ): SCREAMING_SNAKE_CASE = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): SCREAMING_SNAKE_CASE = n - k # Calculate C(n,k) ...
403
from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class __A : UpperCamelCase = 42 UpperCamelCase ...
21
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_dimensi...
718
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import loggin...
198
0
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE__ = get_tests_dir('''fixtures/test_sentencepiece_with_bytefallba...
9
import os import re import shutil import sys import tempfile import unittest import black lowercase_ = 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_copies # noqa: E402 # This is the re...
291
0
"""simple docstring""" import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset SCREAMING_SNAKE_CASE_ = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5,...
714
"""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 ...
579
0
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class SCREAMING_SNAKE_CASE ( lowerCamelCase__ , unittest.TestCase ): __lowerCamelCase : Tuple ...
225
import random def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : int ): """simple docstring""" __a = num - 1 __a = 0 while s % 2 == 0: __a = s // 2 t += 1 for _ in range(5 ): __a = random.randrange(2 , num - 1 ) ...
225
1
from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class lowerCamelCase__ ( __lowercase , __lowercase): '''simple docstring''' @re...
94
import re import string import numpy as np import datasets lowercase : List[str] = '\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n' lowercase : List[str] = '\...
94
1
def a ( A__ : Optional[int] ) -> List[str]: """simple docstring""" if isinstance(_A , _A ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_A , _A ): raise TypeError('\'str\' object cannot be in...
291
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __UpperCamelCase ( ): lowerCAmelCase_ = { '''repo_name''': ['''test_repo1''', '''test_repo2''', '''test_repo3'''], '''path''': ...
431
0
'''simple docstring''' from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def __snake_case ( SCREAMING_SNAKE_CASE_ : Optional[int] , SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : Tuple = "x" , SCREAMING_SNAKE_CASE_ : Optional[Any] = 10**-10 , SCREAMIN...
719
'''simple docstring''' import inspect import unittest from transformers import BitConfig 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 Backbone...
570
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = {'vocab_file': 'spi...
147
import sys import turtle def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ): ...
183
0
"""simple docstring""" # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.versio...
718
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_comm...
93
0
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class ...
133
'''simple docstring''' def a_ ( lowerCamelCase : float , lowerCamelCase : float ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_...
133
1
import argparse import os import platform import numpy as np import psutil import torch from accelerate import __version__ as version from accelerate.commands.config import default_config_file, load_config_from_file from ..utils import is_npu_available, is_xpu_available def UpperCamelCase__ ( __magic_...
716
'''simple docstring''' import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transforme...
419
0
def lowerCamelCase__ ( lowercase = 50 ): """simple docstring""" SCREAMING_SNAKE_CASE : Dict = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - ...
62
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_...
62
1
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vision_available...
180
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available SCREAMING_SNAKE_CASE__ : Union[str, Any] = {"""tokenization_herbert""": ["""HerbertTokenizer"""]} try: if not is_tokenizers_available(): raise OptionalDepend...
180
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
1
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration __a = 5_0_0_0_0 __a = 5_0_0_0 __a , __a = os.path.split(__file__) __a = os.path.join(RESULTS_BASEPATH, """results""", RESULTS_FILENAME.replace(""".py""", ""...
719
from __future__ import annotations import math def UpperCamelCase_ ( a_ , a_ ) ->float: A =u for i in range(1 , a_ ): A =temp * (u - i) return temp def UpperCamelCase_ ( ) ->None: A =int(input("enter the numbers of values: " ) ) A =[] for _ in ...
689
0
"""simple docstring""" import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch ...
29
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from t...
29
1
'''simple docstring''' import datasets from .evaluate import evaluate UpperCAmelCase = '''\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}...
706
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import logging Upp...
565
0
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr...
21
# 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 won't be considered # since t...
562
0
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effect...
537
'''simple docstring''' from __future__ import annotations import math def _lowerCamelCase( UpperCamelCase__ : int ) -> list[int]: if num <= 0: A : str = F'''{num}: Invalid input, please enter a positive integer.''' raise ValueError(UpperCamelCase__ ...
537
1
'''simple docstring''' 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, floa...
270
'''simple docstring''' import argparse 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 ac...
270
1
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->Any: """simple docstring""" lowerCAmelCase__ ...
711
"""simple docstring""" from ...processing_utils import ProcessorMixin class _lowerCAmelCase ( a ): """simple docstring""" __magic_name__ :List[str] = """SpeechT5FeatureExtractor""" __magic_name__ :List[Any] = """SpeechT5Tokenizer""" ...
560
0
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent _lowercase : Tuple ={"""UserAgent""": UserAgent().random} def _SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ): lowerCamelCase_ : Union[str...
364
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def UpperCamelCase ( ): '''simple docstring''' __snake_case :List[str] = A...
717
from __future__ import annotations import time import numpy as np lowerCamelCase__ = [8, 5, 9, 7] lowerCamelCase__ = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] lowerCamelCase__ = [ [3, 2, 1, 4], [0,...
291
0
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, t...
118
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _lowercase = get_logger(__name__) class __a ( enum.Enum ): '''simple docstring''' ...
118
1
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_...
336
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord impor...
336
1
'''simple docstring''' import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutpu...
350
'''simple docstring''' import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from...
350
1
"""simple docstring""" def lowercase ( __UpperCamelCase ) -> bool: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError('''Input series is not valid, valid series - [2, 4, 6]''' ) if len(__UpperCamelCase ) == 0: raise ValueError('''Input list mu...
190
"""simple docstring""" from __future__ import annotations from random import choice def lowercase ( __UpperCamelCase ) -> Any: return choice(__UpperCamelCase ) def lowercase ( __UpperCamelCase , __UpperCamelCase ) -> int: __magic_name__ = ran...
190
1
'''simple docstring''' 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 Back...
42
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = {'vocab_file': 'sentencepi...
61
0
# limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils import deprecate deprec...
547
from __future__ import annotations lowerCamelCase__ = """Muhammad Umer Farooq""" lowerCamelCase__ = """MIT""" lowerCamelCase__ = """1.0.0""" lowerCamelCase__ = """Muhammad Umer Farooq""" lowerCamelCase__ = """contact@muhammadumerfarooq.me""" lowerCamelCase__ = """Alpha""" import re from html.parser im...
547
1
from __future__ import annotations _lowerCAmelCase = """#""" class _UpperCAmelCase : def __init__( self ): A_ : dict = {} def _lowerCamelCase ( self , a__ ): A_ : List[Any] = self._trie for char in t...
569
from ...configuration_utils import PretrainedConfig class _UpperCAmelCase ( _lowerCamelCase ): a = '''bert-generation''' def __init__( self , a__=50358 , a__=1024 , a__=24 , a__=16 , a__=4096 , a__="gelu" , a__=0.1 , ...
569
1
import os from typing import Dict, List, Tuple, TypeVar, Union __lowerCamelCase = TypeVar('''T''') __lowerCamelCase = Union[List[T], Tuple[T, ...]] __lowerCamelCase = Union[T, List[T], Dict[str, T]] __lowerCamelCase = Union[str, bytes, os.PathLike]
708
import operator def _snake_case ( __snake_case , __snake_case = False , __snake_case = None ) -> list: '''simple docstring''' UpperCAmelCase_ : Optional[int] = operator.lt if reverse else operator.gt UpperCAmelCase_ : int = so...
455
0
"""simple docstring""" import re from filelock import FileLock try: import nltk __lowercase : List[str] = True except (ImportError, ModuleNotFoundError): __lowercase : Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"""...
142
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokeni...
142
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTester...
644
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
644
1
'''simple docstring''' import requests from bsa import BeautifulSoup def _lowerCAmelCase ( __magic_name__ : str = "https://www.worldometers.info/coronavirus" ) -> dict: lowercase : List[Any] =BeautifulSoup(requests.get(__magic_name__ ).text , '''html.parser...
92
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) # TODO Update this UpperCamelCase_ = { """facebook/esm...
92
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase_ = { 'configuration_resnet': ['RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ResNetConfig...
215
"""simple docstring""" 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 ( __UpperCamelCase ): ""...
215
1
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import...
74
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=_snake_case ): UpperCAmelCase = ["speech"] def __init__( self : List[Any] , *__lowerCamelCase : List[Any] , **__lowerCamelCase : List[str]...
467
0
from __future__ import annotations def UpperCamelCase__ ( A__ ) -> List[Any]: snake_case__ : List[Any] = 0.0_0 snake_case__ : str = 0 for resistor in resistors: if resistor <= 0: snake_case__ : Union[str, Any] ...
720
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, ) lowerCAmelCase__ : Any = {'''configuration_xglm''': [''...
699
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ...
38
def lowerCAmelCase__ ( a__ , a__ , a__ , a__ , a__ ) ->int: '''simple docstring''' if index == number_of_items: return 0 _UpperCamelCase = 0 _UpperCamelCase = 0 _UpperCamelCase = knapsack(a__ , a__ , a__...
547
0
'''simple docstring''' from __future__ import annotations def __a ( lowerCAmelCase__ : list[int | str] ): create_state_space_tree(lowerCAmelCase__ , [] , 0 , [0 for i in range(len(lowerCAmelCase__ ) )] ) def __a ( lowerCAmelCase__ : list[int | st...
340
'''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 ( ChannelDimension, PILImag...
340
1
"""simple docstring""" import argparse import copy def _snake_case ( __snake_case : Tuple ): """simple docstring""" _lowerCamelCase : str = {} with open(__snake_case ) as f: for line in f: if line.split()[0] not in dict_of_...
88
def __snake_case ( _UpperCamelCase , _UpperCamelCase ) -> int: return x if y == 0 else greatest_common_divisor(_UpperCamelCase , x % y ) def __snake_case ( _UpperCamelCase , _UpperCamelCase ) -> int: return (x * y) // greatest_common_divisor(_UpperCamelCase , _U...
487
0
'''simple docstring''' import requests _a : Optional[Any] = "YOUR API KEY" def _lowercase ( lowerCamelCase__ , lowerCamelCase__ = giphy_api_key ) -> list: """simple docstring""" __UpperCAmelCase : Tuple = "+".join(query....
10
'''simple docstring''' 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 _a : str = logging.get_logger(__name__) _a : ...
10
1
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --host <host> --key_path <...
618
import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTokenizerFast, XLMRober...
618
1
import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast from datasets.utils....
383
import json import logging import os import sys from time import time from unittest.mock import patch from transformers.testing_utils import TestCasePlus, require_torch_tpu logging.basicConfig(level=logging.DEBUG) UpperCamelCase = logging.getLogger() def A ( lowercase__ : ...
383
1
def lowerCAmelCase_ ( lowerCamelCase = 1000 ): __magic_name__ : Optional[int] =2**power __magic_name__ : int =0 while n: __magic_name__ , __magic_name__ : List[str] =r + n % 10, n // 10 return r if __name__...
21
UpperCAmelCase_ : int = range(2, 20 + 1) UpperCAmelCase_ : Tuple = [10**k for k in range(ks[-1] + 1)] UpperCAmelCase_ : dict[int, dict[int, list[list[int]]]] = {} def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ...
21
1
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECK...
715
"""simple docstring""" import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a__ ( A__ ): def __init__( self :List[str] , *_lowerCamelCase :int ...
395
0
import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_flax_commo...
144
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['GitProcessor'], } try: if ...
144
1
"""simple docstring""" def __lowerCAmelCase ( __lowerCAmelCase : int , __lowerCAmelCase : bool = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False if n...
239
"""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 = { "...
239
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType a : ...
63
'''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 lowercase__ : int = logging.get_logger(__name__) lowercase__ : Any = ...
98
0
import torch from diffusers import StableDiffusionPipeline lowercase_ = 'path-to-your-trained-model' lowercase_ = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('cuda') lowercase_ = 'A photo of sks dog in a bucket' lowerca...
380
from math import pow, sqrt def a ( *A__ : float ) -> bool: """simple docstring""" _lowercase =len(A__ ) > 0 and all(value > 0.0 for value in values ) return result def a ( A__ : float , A__ : float ) -> float | ValueErro...
380
1
from math import factorial def a__ ( _UpperCamelCase : int = 1_00 ): return sum(int(snake_case__ ) for x in str(factorial(snake_case__ ) ) ) if __name__ == "__main__": print(solution(int(input("""Enter the Number: """).strip())))
175
from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch @require...
312
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_tor...
716
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
0
'''simple docstring''' from __future__ import annotations class a_ : def __init__( self : Optional[Any] , lowercase : str , lowercase : str ): """simple docstring""" lowercase_ , lowercase_ :int ...
172
'''simple docstring''' def UpperCAmelCase_ ( __lowerCamelCase : int ): if upper_limit < 0: raise ValueError("Limit for the Catalan sequence must be ≥ 0" ) lowercase_ :Optional[int] = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 l...
172
1
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=_SCREAMING_SNAKE_CASE ) class __A ( _SCREAMING_SNAKE_CASE ): lowerCamelCase...
704
'''simple docstring''' def A_ ( __SCREAMING_SNAKE_CASE : int ) -> None: """simple docstring""" __A : Tuple = generate_pascal_triangle(__SCREAMING_SNAKE_CASE ) for row_idx in range(__SCREAMING_SNAKE_CASE ): # Print left spaces for _ in ran...
499
0
"""simple docstring""" _snake_case = {str(digit): digit**5 for digit in range(1_0)} def __snake_case ( SCREAMING_SNAKE_CASE: int ): """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(SCREAMING_SNAKE_CASE ) ...
580
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand...
580
1
"""simple docstring""" import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODE...
709
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowercase : Dict = { "configuration_vision_text_dual_encoder": ["Visi...
93
0
from decimal import Decimal, getcontext from math import ceil, factorial def a__ ( lowercase__ ): '''simple docstring''' if not isinstance(lowercase__ , lowercase__ ): raise TypeError("Undefined for non-integers" ) elif precision < 1: ...
54
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...
141
0
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_g...
2
"""simple docstring""" from functools import reduce __SCREAMING_SNAKE_CASE : Tuple = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '1254069874715852386305071569329096329522...
2
1
"""simple docstring""" 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 UpperCAmelCase__ =logging.get_logger(__name__) UpperCAmelCase_...
616
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class _snake_case ( metaclass=_UpperCAmelCase ): _A : Tuple = ['''flax''', '''transformers'''] def __init__( self : Optional[Any] ,*SCREAMING_SNAKE_CASE__ : int ...
708
'''simple docstring''' import warnings from functools import wraps from typing import Callable def A_ ( snake_case ): @wraps(snake_case ) def _inner_fn(*snake_case , **snake_case ): warnings.warn( (F'''\'{fn.__name__}\' is experimental and might be subject to bre...
465
0
'''simple docstring''' import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class __magic_name__ ( tf.keras.layers.Layer ): d...
358
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_d...
358
1
"""simple docstring""" import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCas...
711
"""simple docstring""" import json import sys def lowerCamelCase__ ( __snake_case, __snake_case ) -> Union[str, Any]: """simple docstring""" with open(__snake_case, encoding='''utf-8''' ) as f: _UpperCamelCase = json.load(__snake...
78
0
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin Upper...
32
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeat...
171
0
from transformers import FSMTTokenizer, FSMTConfig, FSMTForConditionalGeneration lowerCAmelCase_ = 'facebook/wmt19-en-de' lowerCAmelCase_ = FSMTTokenizer.from_pretrained(mname) # get the correct vocab sizes, etc. from the master model lowerCAmelCase_ = FSMTConfig.from_pretrained(...
720
from functools import reduce lowerCAmelCase_ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """66...
669
0
from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class UpperCAmelCase_ : def __UpperCAmelCase ( self , _lowerCAmelCase ): raise NotImplementedError() ...
79
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
652
0
import math def UpperCamelCase ( snake_case__): 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, all even numbers, all multiples of 3 are not primes return False # ...
683
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCamelCase ( ): lowerCAmelCase_ : List[str] = HfArgumentParser(snake_case__) lowerCAmelCase_ : List[Any] = parser.parse_args_into_dataclasses()[0] lowerCAmelCase_...
683
1
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # noqa: ...
399
'''simple docstring''' import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": a__ : str =argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', default=N...
399
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) a_ = { """configuration_efficientformer""": [ """EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Effi...
622
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ = { """configuration_clipseg""": [ """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CLIPSegConfig""", """CLIPSegTextConfig""", """CLIPSegVisionConfig""...
622
1
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class a__ ( a_ ): __l...
361
"""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 YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging ...
361
1
'''simple docstring''' def _lowerCAmelCase ( __magic_name__ : int = 1000000 ) -> int: lowercase : Dict =set(range(3 , __magic_name__ , 2 ) ) primes.add(2 ) for p in range(3 , __magic_name__ , 2 ): if p not in primes...
88
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = ...
88
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_...
407
"""simple docstring""" def _lowerCAmelCase ( _UpperCamelCase ): """simple docstring""" stooge(_UpperCamelCase , 0 , len(_UpperCamelCase ) - 1 ) return arr def _lowerCAmelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): """simple ...
353
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_big_bird import B...
703
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A_ : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: A_ : str ...
64
0
import requests from bsa import BeautifulSoup def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: str , lowerCAmelCase: dict ) -> str: _UpperCAmelCase : List[str] = BeautifulSoup(requests.get(__lowerCamelCase , params=__lowerCamelCase ).content , "html.parser" ) _UpperCAm...
300
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TOKEN, USER, ge...
344
0
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) # TODO Update this __lowerCamelCase = { '''facebook/esm-1b'...
711
'''simple docstring''' from __future__ import annotations import math def UpperCAmelCase__ ( UpperCAmelCase__ ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Ne...
667
0
'''simple docstring''' 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 _UpperCamelCase = ...
459
'''simple docstring''' import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io ...
459
1
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.hu...
329
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ : List[str] = TypeVar("KEY") lowerCAmelCase__ : str = TypeVar("VAL") @dataclass(frozen=snake_case__ ,slots=snake_case__...
329
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
103
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...
308
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Optional[int] = logging.get_logger(__name__) _lowerCamelCase : List[str] = { """transfo-xl-wt103""": """https://huggingface.co/transfo-xl-wt103/resolve/main/config.json"...
308
1
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import Att...
102
# This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def SCREAMING_SNAKE_CASE ( snake_case__ , snake_c...
132
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : List[Any] = logging.get_logger(__name__) a__ : Dict = { "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/co...
642
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
1
'''simple docstring''' from __future__ import annotations a : Optional[Any] = '''Muhammad Umer Farooq''' a : int = '''MIT''' a : Dict = '''1.0.0''' a : Optional[int] = '''Muhammad Umer Farooq''' a : Optional[Any] ...
69
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = {"configuration_swin": ["SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwinConfig", "SwinOnnxConfig"]} try: if not ...
539
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a = { '''configuration_owlvit''': [ ...
715
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from tran...
505
0
'''simple docstring''' def __UpperCamelCase ( a : list , a : int = 0 ) ->Optional[Any]: snake_case = length or len(lowerCAmelCase_ ) snake_case = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: snake_case ...
342
from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import TimmBackboneConfig ...
53
0
class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self :Union[str, Any], snake_case :Optional[int]): """simple docstring""" _lowercase =arr.split(',') def UpperCamelCase__ ( self :List[Any]): ...
713
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( _a ): """simple docstring""" def __init__( self :str, *snake_c...
557
0
'''simple docstring''' import logging from transformers import PretrainedConfig SCREAMING_SNAKE_CASE_: Any =logging.getLogger(__name__) SCREAMING_SNAKE_CASE_: Any ={ 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/conf...
78
"""simple docstring""" def _snake_case ( lowercase__ = 1 , lowercase__ = 1000 ): _lowerCamelCase : Optional[int] = 1 _lowerCamelCase : List[Any] = 0 for divide_by_number in range(lowercase__ , digit + 1 ): ...
630
0
'''simple docstring''' def a_ ( __UpperCAmelCase ) -> Dict: """simple docstring""" return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], ...
347
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transfor...
347
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_device f...
99
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available SCREAMING_SNAKE_CASE = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
99
1
'''simple docstring''' import math def lowerCAmelCase ( snake_case__ : int )-> str: A_ = 0 A_ = 0 while num > 0: A_ = num % 8 A_ = octal + (remainder * math.floor(math.pow(10 , _lowercas...
709
from __future__ import annotations __magic_name__ : List[Any] = 8.9_8_8e9 # units = N * m^s * C^-2 def lowerCAmelCase ( snake_case__ : float , snake_case__ : float , snake_case__ : float , snake_case__ : float )-> ...
608
0
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_comm...
19
import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( '''The conver...
279
0
class __magic_name__ : def __init__( self : Optional[Any] ,__SCREAMING_SNAKE_CASE : List[str] ): UpperCAmelCase = n UpperCAmelCase = [None] * self.n UpperCAmelCase = 0 # index of the first element UpperCAmelCas...
707
def __UpperCamelCase ( _lowerCAmelCase = 10 ): """simple docstring""" if not isinstance(_lowerCAmelCase , _lowerCAmelCase ) or n < 0: raise ValueError("Invalid input" ) UpperCAmelCase = 10**n UpperCAmelCase = 2_84_33 * (pow(2 , 7_83_...
405
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _a : Optional[Any] = logging.get_logger(__name__) class _lowercase ( __lowercase ): def __init__( self : Any , *SCREAMING_SNAKE_CAS...
56
def __snake_case ( _lowerCAmelCase : list , _lowerCAmelCase : list , _lowerCAmelCase : int ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError("The length of profit and weight must be same." ) if max_weight <= 0:...
454
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase : Dict = {'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAva...
709
from __future__ import annotations def snake_case_ ( lowerCAmelCase_ : str , lowerCAmelCase_ : list[str] | None = None ): __lowercase : Tuple = word_bank or [] # create a table __lowercase : int = len(lower...
649
0