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''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=a ) class lowercase_ ( a ): '''simple docstring''' __lowerCAmelCase : str = field(de...
447
'''simple docstring''' 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 i...
447
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer UpperCamelCase : Dict = logging.get_logger(_...
610
'''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 : Optional[Any] = logging.get_logger(__name__) Upper...
610
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase_ : Any = logging.get_logger(__name__) # TODO: upload to AWS UpperCAmelCase_ : str = { "yjernite/retribert-base-uncased": ( "https://huggingface.co/yjern...
24
def lowercase_ (A : list , A : int = 0 ): snake_case__ : List[str] = length or len(A ) snake_case__ : Any = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: snake_case__...
478
0
'''simple docstring''' import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup _a : Optional[Any] = logging.get_log...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _a : Dict = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG...
10
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a : str = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
218
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
0
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () UpperCamelCase : int = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (t...
151
from copy import deepcopy class A__ : """simple docstring""" def __init__( self : Union[str, Any] , lowerCamelCase__ : list[int] | None = None , lowerCamelCase__ : int | None = None ): if arr is None and size is not None: a__ : Uni...
151
1
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_ : Optional[int] = logging.get_logger(__name__) UpperCamelCase_ : s...
461
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase_ : int = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], """tokenization_tran...
461
1
from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_pipeline_mixin ...
226
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forwar...
226
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) class a ( lowerCAmelCase_ ): _snake_case : List[Any] = 'timm_backbone' def __init__( self : List[Any] , __lower...
277
"""simple docstring""" from collections.abc import Generator def __UpperCAmelCase ( ): """simple docstring""" _UpperCAmelCase , _UpperCAmelCase = 0, 1 while True: _UpperCAmelCase , _UpperCAmelCase = b, a + b yield b def __UpperCAmelCase...
277
1
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline 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 flax.jax_utils import repl...
721
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { """google/umt5-small""": """https://huggingface.co/g...
688
0
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # all files ~60KB. As compared t...
6
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class _lowerCamelCase ...
243
0
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor __A = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE ( __UpperCAmelCase ): """simple docstring""" def __init__( self: Tuple , *__A: ...
716
import flax.linen as nn import jax import jax.numpy as jnp class SCREAMING_SNAKE_CASE ( nn.Module ): """simple docstring""" A_ = 42 A_ = jnp.floataa def __A ( self: Tuple ) -> Tuple: _A = nn.Conv( ...
62
0
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 import BytesIO from pathlib import Path...
509
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase : str = logging.get_logger(__name__) __lowerCAmelCase ...
509
1
"""simple docstring""" from __future__ import annotations def _lowercase ( _SCREAMING_SNAKE_CASE : str , _SCREAMING_SNAKE_CASE : list[str] | None = None ) -> list[list[str]]: '''simple docstring''' __A : int ...
237
"""simple docstring""" lowerCamelCase : int =[0, 2, 4, 6, 8] lowerCamelCase : List[str] =[1, 3, 5, 7, 9] def _lowercase ( _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : li...
237
1
from ..utils import DummyObject, requires_backends class _a ( metaclass=snake_case_ ): """simple docstring""" _lowerCamelCase : List[Any] = ['torch', 'torchsde'] def __init__( self : Any , *UpperCAmelCase : int ...
86
def A__ ( snake_case_ : int ): if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) SCREAMING_SNAKE_CASE__: List[Any]= [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 SCREAMING_SNAKE_CASE__: List[str]= 1 if upper_limit > 0: SCREAMING_SNAKE_CASE_...
64
0
from functools import lru_cache def A(__a: int ): lowerCAmelCase_ = 2 lowerCAmelCase_ = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(__a ) if n > 1: factors.add(__a ) return factors @lru_cache def A(__a: int ...
226
def A(__a: int ): lowerCAmelCase_ = abs(__a ) lowerCAmelCase_ = 0 while n > 0: res += n % 10 n //= 10 return res def A(__a: int ): lowerCAmelCase_ = abs(__a ) return n if n < 10 else n % 10 + sum_of_digits(n // 10 ) def A(__a: int ...
226
1
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging A__: in...
380
'''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...
94
0
from __future__ import annotations class a__ : def __init__( self : Optional[int] , lowerCamelCase_ : int = 0 ): a_ : str = key def UpperCAmelCase( self : Optional[Any] , lowerCamelCase_ : str ...
718
from heapq import heappop, heappush import numpy as np def _a ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , ): a_ , a_ : Any = grid.shape a_ : Dict = [-1, 1, 0, 0] a_ : List[Any] = [0, 0, -...
478
0
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_imag...
86
"""simple docstring""" from __future__ import annotations lowerCamelCase__ : Optional[int] = [True] * 1_00_00_01 lowerCamelCase__ : List[Any] = 2 while i * i <= 1_00_00_00: if seive[i]: for j in range(i * i, 1_00_00_01, i): lowerCamelCas...
238
0
from __future__ import annotations import pandas as pd def UpperCamelCase ( snake_case__ : list[int] ,snake_case__ : list[int] ,snake_case__ : int ): '''simple docstring''' __snake_case :Optional[int] = [0] * no_of...
291
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
1
import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from transformers.utils im...
130
import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql import sql # noqa F40...
130
1
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCamelCase () -> Any: A__ : Any = HfArgumentParser(lowercase_ ) A__ : List[Any] = parser.parse_args_into_dataclasses()[0] A__ : str = TensorFlowBenchm...
64
from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
64
1
'''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 TensorT...
331
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ : Optional[int] = logging.get_logger(__name__) UpperCamelCase_ : str = { """abeja/gpt-neox-japanese-2.7b""": """https://huggingface.co/abeja/gpt-...
331
1
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
190
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _lowercase ( __UpperCAmelCase ): _lowerCamelCase = (EulerDiscreteScheduler,) _lowerCamelCase ...
190
1
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is...
1
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/config.json""", """xlnet-large-cas...
2
0
'''simple docstring''' a__ : Optional[Any] ={ '''a''': '''AAAAA''', '''b''': '''AAAAB''', '''c''': '''AAABA''', '''d''': '''AAABB''', '''e''': '''AABAA''', '''f''': '''AABAB''', '''g''': '''AABBA''', '''h''': '''AABBB''', '''i''': '''ABAAA''', '''j''': '''BBB...
434
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=__lowerCamelCase ) class snake_case ( __lowerCamelCase ): """simple docstring""" SCREAMING_SNAKE_CAS...
434
1
import argparse import hashlib # hashlib is only used inside the Test class import struct class _a : """simple docstring""" def __init__( self , _UpperCAmelCase ) -> Optional[int]: UpperCamelCase_ = data UpperCamelCase_ = [0...
23
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Optional[int] = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/...
156
0
# 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 the...
689
def UpperCamelCase_ ( a_ = 6008_5147_5143 ) ->int: try: A =int(a_ ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: raise ValueError("Parameter n must be greater than or equal to one." ) A =2 A =0 if n == 2: r...
689
1
"""simple docstring""" import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelin...
633
"""simple docstring""" import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, id...
633
1
'''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, Ima...
702
'''simple docstring''' class __magic_name__ : """simple docstring""" def __init__( self , _lowercase ) -> Union[str, Any]: lowercase_ : Dict = n lowercase_ : Dict = [None] * self.n lowercase_ : Tuple ...
7
0
"""simple docstring""" import os import sys import unittest __UpperCamelCase : Dict = 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_fil...
450
"""simple docstring""" import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __UpperCamelCase : str = 4 __UpperCamelCase : List[str] = 3 ...
450
1
from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_pipeli...
714
import numpy as np def lowerCamelCase__ ( a : np.ndarray , a : np.ndarray , a : float = 1e-12 , a : int = 100 , ) -> tuple[float, np.ndarray]: """simple docstring""" assert np.shape(a )[0] == np.shape(a )[1] # Ensure proper dimensionality. assert np.shape(a )[0] ==...
373
0
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def _A ( __lowercase , __lowercase , __lowercase = None ): """simple docstring""" if version.parse(hfh.__version__...
129
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __magic_name__ = {"""configuration_reformer""": ["""REFORMER_PRETRAINED_CONFIG_A...
129
1
"""simple docstring""" def UpperCAmelCase__ (snake_case__ : list[list] ): """simple docstring""" _snake_case : Optional[int] = current_set.copy() for row_index, row in enumerate(_lowerCamelCase ): _snake_case : Any = row[0] for colum...
705
"""simple docstring""" import os import sys import unittest A_ = 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...
28
0
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration __UpperCamelCase : List[Any] = 50000 __UpperCamelCase : str = 5000 __UpperCamelCase , __UpperCamelCase : Tuple = os.path.split(__file__) __UpperCamelCa...
519
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
41
0
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accel...
179
'''simple docstring''' import unittest from transformers import MPNetConfig, 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_tensor, random_atten...
179
1
import json import os import torch from diffusers import UNetaDModel os.makedirs('hub/hopper-medium-v2/unet/hor32', exist_ok=True) os.makedirs('hub/hopper-medium-v2/unet/hor128', exist_ok=True) os.makedirs('hub/hopper-medium-v2/value_function', exist_ok=True) def lowerCamelCase__ (_UpperCAmel...
73
'''simple docstring''' SCREAMING_SNAKE_CASE__ = {str(digit): digit**5 for digit in range(1_0)} def lowercase__ ( __UpperCamelCase )-> int: return sum(DIGITS_FIFTH_POWER[digit] for digit in str(__UpperCamelCase ) ) def ...
301
0
def snake_case_ ( lowercase__ : list , lowercase__ : int = 0 ) -> List[Any]: '''simple docstring''' _lowerCAmelCase =length or len(_A ) _lowerCAmelCase =False for i in range(length - 1 ): if list_data[i] > list_data[i + ...
705
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel __SCREAMING_SNAKE_CASE : List[str] = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '''at...
149
0
'''simple docstring''' # 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_...
127
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
1
'''simple docstring''' import torch from diffusers import DiffusionPipeline class a__( lowerCamelCase__ ): def __init__( self : List[str] , __snake_case : List[Any] , __snake_case : int ): super().__init__() self.register_modules(unet...
195
'''simple docstring''' class a__: def __init__( self : Dict , __snake_case : Optional[int] , __snake_case : Any , __snake_case : Tuple ): a : List[str] = name a : Dict = value a : List[str] ...
195
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case :str =logging.get_logger(__name__) __snake_case :int ={ """tiiuae/falcon-40b""": """https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json""", """tiiuae/falcon-7b""": """http...
106
"""simple docstring""" import os def lowerCamelCase_ ( ): lowerCamelCase_ = os.path.dirname(os.path.realpath(_lowerCamelCase ) ) lowerCamelCase_ = os.path.join(_lowerCamelCase , '''triangle.txt''' ) with open(_lowerCamelCase ) as f: ...
142
0
from __future__ import annotations from math import gcd def __SCREAMING_SNAKE_CASE ( UpperCamelCase : int , UpperCamelCase : int = 2 , UpperCamelCase : int = 1 , UpperCamelCase : int = 3 , ) -> int | None: """simple docstring""" if num < 2: raise ValueError...
705
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers....
403
0
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 ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils import logging...
542
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMSch...
542
1
from string import ascii_uppercase __a : Optional[Any] = {char: i for i, char in enumerate(ascii_uppercase)} __a : Optional[int] = dict(enumerate(ascii_uppercase)) def UpperCAmelCase ( lowercase , lowercase ): """simple docstring""" ...
522
from __future__ import annotations __a : str = """Muhammad Umer Farooq""" __a : Optional[Any] = """MIT""" __a : int = """1.0.0""" __a : Optional[int] = """Muhammad Umer Farooq""" __a : Dict = """contact@muhammadumerfaro...
522
1
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float , lowerCAmelCase : int ): """simple docstring""" if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum...
561
'''simple docstring''' from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowerCAmelCase :Dict = datasets.utils.logging.get_logger(__name__) class _lowerCamelCase ( folder_based_builder.FolderBasedBuil...
561
1
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from ....
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
import math import tensorflow as tf from packaging import version def snake_case__ ( lowerCamelCase_ ): A : Optional[int] = tf.convert_to_tensor(lowerCamelCase_ ) A : Union[str, Any] = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(...
542
import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config import MAX_SHARD_SI...
542
1
import os import re import shutil import sys import tempfile import unittest import black _A = 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 reference code that will be used i...
717
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pipelin...
279
0
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : int , _UpperCAmelCase : float , _UpperCAmelCase : float ) -> float: return round(float(moles / volume ) * nfactor ) def __UpperCAmelCase ( _UpperCAmelCase : float , _UpperCAmelCase ...
69
"""simple docstring""" from __future__ import annotations from random import random from typing import Generic, TypeVar __lowerCAmelCase : int = TypeVar('''KT''') __lowerCAmelCase : Union[str, Any] = TypeVar('''VT''') class _lowerC...
58
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, ) from diffusers.utils import f...
715
"""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( __UpperCAmelCase ): """simple docstring""" _lowercase : ...
283
0
def __UpperCamelCase ( _lowerCAmelCase , _lowerCAmelCase ) -> list[int]: """simple docstring""" A : Optional[int] = int(_lowerCAmelCase ) # Initialize Result A : int = [] # Traverse through all denomination for denomination in reversed(...
662
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_:int = { """configuration_blenderbot""": [ """BLENDERBOT_PRETRAINED_...
662
1
"""simple docstring""" __UpperCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_00_00)] def _snake_case ( lowercase__ : int ) -> int: '''simple docstring''' lowerCAmelCase_ :str = 0 while number: ...
256
"""simple docstring""" import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( ...
256
1
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.u...
688
"""simple docstring""" from collections.abc import Callable import numpy as np def A_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__ ) -> np.ndarray: _UpperCamelCase :str = int(np.ceil((x_end - xa) / step_...
355
0
'''simple docstring''' from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
707
'''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_FIL...
172
0
'''simple docstring''' def UpperCamelCase__ ( _lowercase : list[int] , _lowercase : int ) -> bool: __UpperCAmelCase: int = len(_lowercase ) __UpperCAmelCase: Optional[int] = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for eac...
523
'''simple docstring''' class a : """simple docstring""" def __init__( self , snake_case_ , snake_case_ , snake_case_ ): '''simple docstring''' __UpperCAmelCase: List[Any] = None __UpperCAmelCase: Tuple = None __UpperCAmelCase: L...
523
1
'''simple docstring''' 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_f...
703
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def UpperCamelCase ( a ) -> Optional[int]: '''simple docstring''' return ConvertCommand( args.model_type , args.tf_checkpoint , arg...
245
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_available()...
340
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 logging logging...
297
0
"""simple docstring""" import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class __sna...
714
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { 'configuration_distilbert': [ 'DISTILBERT_PRETRAIN...
217
0
from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
63
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() a : Dict = logging.get_logger(__name__) a : Tuple = [ ["attention", "attn"], ...
63
1
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () _SCREAMING_SNAKE_CASE = np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining a...
239
"""simple docstring""" class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self , lowerCAmelCase__ ): '''simple docstring''' _UpperCamelCase : List[str] = size _UpperCamelCase : Optional[int] = [0] * size ...
239
1
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def lowercase ( lowerCAmelCase__ ): for param in module.parameters(): lowerCamelCase_ = False def lowercase ( ): lowerCamelCase_ = '''cuda''' if torch.cuda.is_availabl...
29
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def __a ( lowerCAmelCase_ : int = 8 ) -> str: '''simple docstring''' UpperCAmelCase_= ascii_letters + digits + punctuation return ""....
593
0
"""simple docstring""" import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: ...
702
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # all fi...
463
0
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar __lowerCamelCase : Dict = TypeVar('''KEY''') __lowerCamelCase : int = TypeVar('''VAL''') @dataclas...
653
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) __lowerCamelCase : Any = {'''configurat...
653
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__) UpperCAm...
702
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int ) -> bool: if num < 0: return False _snake_case = num _snake_case = 0 while num > 0: _snake_case = rev_num * 10 + (num % 10) num //= 10 return num_copy == rev_num ...
430
0
"""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=lowerCamelCase_ ) class snake_case_ ( lowerCamelCase_ ): """simple docst...
34
"""simple docstring""" from itertools import permutations def lowerCamelCase ( _snake_case ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False UpperCAmelCase__ : List[str] = ...
110
0
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def _A...
214
def _A ( __snake_case :int ) -> bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): raise ValueError("check_bouncy() accepts only integer arguments" ) __SCREAMING_SNAKE_CASE = str(__snake_case ) __SCRE...
214
1
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer UpperCAmelCase_ = logging.getLogger(__name__) def lowerCAmelCase_ ( ) -> Optional[Any]: '''simple docstring''' _UpperCamelCase: List[str] = argpa...
271
from pathlib import Path import fire def lowerCAmelCase_ ( lowercase: str , lowercase: str , lowercase: int ) -> int: '''simple docstring''' _UpperCamelCase: Any = Path(lowercase ) _UpperCamelCase: int = Path(lowercase ) dest_dir.mkdir(exist_o...
271
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
719
def _snake_case (_snake_case : int) -> bool: if p < 2: raise ValueError('p should not be less than 2!') elif p == 2: return True _lowercase =4 _lowercase =(1 << p) - 1 for _ in range(p - 2): _lowercase =((s * s) - 2) % m ret...
557
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor lowerCamelCase = logging.get_logger(__name__) class lowercase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' def _...
82
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock f...
227
0
'''simple docstring''' import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device ...
98
'''simple docstring''' from manim import * class a__ ( a__ ): '''simple docstring''' def __SCREAMING_SNAKE_CASE ( self ) -> List[str]: lowerCAmelCase__ = Rectangle(height=0.5 , width=...
98
1
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_common import ModelTesterMixin, ids_tensor, rand...
85
'''simple docstring''' import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin UpperCamelCase ="\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot a...
208
0
from typing import Union import fire import torch from tqdm import tqdm def _snake_case ( __snake_case , __snake_case = "cpu" , __snake_case = None ) -> Any: '''simple docstring''' UpperCAmelCase_ : Dict = torch.load(lowercase__ , map_lo...
702
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class snake_case_ (lowercase__ ): """simple docstring""" _lowerCamelCase = """ClapFeatureExtractor""" _lowerCamelCase = ("""RobertaTokenizer""", """RobertaTokeniz...
455
0
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def lowerCamelCase__ ( __lowerCamelCase : int ): return input_array.reshape((input_array.size, 1) ) de...
63
"""simple docstring""" def lowercase__(A ) ->str: """simple docstring""" if isinstance(A , A ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(A , A ): raise TypeErro...
218
0
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(__lowerCamelCase )...
694
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class snake_case ( __low...
694
1
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def snake_case_ (UpperCamelCase : Tuple ): '''simple docstring''' _a = os.path.join(...
22
def _lowerCamelCase ( __A : str ) -> list: return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__A ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
485
0
'''simple docstring''' from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup snake_case_ = """https://www.indeed.co.in/jobs?q=mobile+app+development&l=""" def _lowerCamelCase( UpperCamelCase__ : str = "mumbai" ): A ...
717
'''simple docstring''' from math import pi def _lowerCamelCase( UpperCamelCase__ : int , UpperCamelCase__ : int ) -> float: return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
537
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.utils imp...
74
"""simple docstring""" 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 t...
571
0
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version UpperCamelCase__ : Dict = version.parse(importlib_metadata.version('''nltk''')) if NLTK_VERSION >= version.Version('''3.6.4'''): from nltk import word_tokenize ...
718
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def __UpperCAmelCase ( lowerCamelCase_ : Tuple , lowerCamelCase_ : int=() , lowerCamelCase_ ...
685
0
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline __lowerCamelCase : Optional[int] = logging.get_logger(__name__) # pylint: disable=invalid-name class __magic_name__ ( ...
323
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...
323
1
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class snake_case ( SCREAMING_SNAKE_CASE_ ,SCREAMING_SNAKE_CASE_ ): '''simple docstring''' @register_to_config def __...
198
import sys a__ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6689664895044524452316173185640...
198
1
'''simple docstring''' import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configur...
614
'''simple docstring''' # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - gener...
614
1
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
711
"""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, ) from diffusers.utils import f...
696
0
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 BackboneTesterMixin from ...
483
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : Union[str, Any] ={} class lowercase_ ( UpperCamelCase__): """simple docstring""" ...
483
1
import glob import os import random from string import ascii_lowercase, digits import cva __a : str = "" __a : List[Any] = "" __a : Union[str, Any] = "" __a : Optional[Any] = 1 # (0 is vertical, 1 is horizontal) def _SCREAMING_SNAKE_CAS...
716
import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str: """simple docstring""" if "cls_token" in name: __A ...
199
0
from typing import Dict, Iterable, Optional, 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, to_pil_image from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
472
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def _lowercase ( *UpperCamelCase_ , UpperCamelCase_ = None , UpperCamelCase_=True , UpperCamelCase_=2 ) -> Optional[int]: '''simple docstring''' ...
472
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch ...
149
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel __SCREAMING_SNAKE_CASE : List[str] = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '''at...
149
1
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState fr...
631
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE__ = (720, 1_280) # Height, Width SCREAMING_SNAKE_CASE__ = (0.4, 0.6) # if height or width lower than this scale, drop it. SCREAMING_SNAKE_CASE__ ...
631
1
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase , UpperCamelCase ) -> str: """simple docstring""" return "\n".join( f"{number} * {i} = {number * i}" for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(m...
487
"""simple docstring""" import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class a__ : lowercase_ = None def a_ ( self : List[Any]): """simple docstring""" __UpperCAmelCase : Optional[An...
487
1
"""simple docstring""" import tensorflow as tf from ...tf_utils import shape_list class lowercase__ ( tf.keras.layers.Layer ): """simple docstring""" def __init__( self , _A , _A , _A , _A , _A=1 , _A=Fals...
102
'''simple docstring''' from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging UpperCa...
384
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def UpperCAmelCase__ ( UpperCAmelCase__ ) -> Any: if "cls_token" in name: A_ = name.r...
667
'''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_in_pyto...
667
1
'''simple docstring''' import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels a_ : List[str] = object() # For specifying empty leaf dict `{}` a_ : str = object() de...
676
'''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_...
8
0
import qiskit def lowerCamelCase ( SCREAMING_SNAKE_CASE = 2 ): '''simple docstring''' __UpperCamelCase :Tuple = qubits # Using Aer's simulator __UpperCamelCase :Optional[int] = qiskit.Aer.get_backend('''aer_simulator''' ) # Creating a Quantum Circuit acti...
452
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase ( SCREAMING_SNAKE_CASE , ...
452
1
"""simple docstring""" import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, rand...
554
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common ...
427
0
"""simple docstring""" import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_downlo...
718
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Optional[int] = logging.get_logger(__name__) __A : Optional[...
95
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import lo...
356
'''simple docstring''' def lowerCamelCase__ ( a ): __snake_case = [0] * len(a ) __snake_case = [] __snake_case = [] __snake_case = 0 for values in graph.values(): for i in values: indegree[i] += 1 ...
356
1
def snake_case_ ( __lowercase ): if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) UpperCAmelCase_ : List[Any] = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 UpperCAmelCase_ : Optional[Any] ...
641
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase : str = { 'configuration_x_clip': [ 'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XCLIPConfig', 'XCLIPTextConfig', '...
641
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase : str = logging.get_logger(__name__) __UpperCamelCase : Union[str, Any] = { """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/c...
328
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { 'microsoft/biogpt': 'https://huggingface.co/microsoft/biogpt/resolve/main/config.json', # See all BioGPT models at https://huggingfa...
201
0
'''simple docstring''' import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_in...
710
'''simple docstring''' def snake_case_ (UpperCamelCase : int ): '''simple docstring''' if n == 1 or not isinstance(UpperCamelCase , UpperCamelCase ): return 0 elif n == 2: return 1 else: _a = ...
377
0
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def _lowerCamelCase ( UpperCAmelCase_ : Tuple="ro", UpperCAmelCase_ : Any="en", UpperCAmelCase_ : List[str]="wmt16", UpperCAmelCase_ : Dict=None ) -> None: ...
104
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
0
import os import numpy import onnx def lowerCAmelCase_ ( __UpperCAmelCase: Any , __UpperCAmelCase: Tuple ) -> List[Any]: UpperCamelCase__ : str = a.name UpperCamelCase__ : str = b.name UpperCamelCase__ : Tupl...
715
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING UpperCAmelCase_ = logging.get_logger(__name__) class lowercase__ ( __lowerCamelCase ): '''simple docstring'''...
369
0