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 __future__ import annotations import pandas as pd def lowerCamelCase__ ( SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : int ): UpperCAmelCase = [0] * no_of_processes UpperCAmelCase = ...
447
'''simple docstring''' import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print('Googling.....') _a : List[Any] = 'https://www.google.com/search?q=' + ' '.join(sys.argv[1:]) _a : Dict = re...
447
1
'''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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from tra...
160
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gp...
160
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { 'BridgeTower/bridgetower-base': 'https://huggingface.co/BridgeTower/bridgetower-base/blob/ma...
291
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowercase_ = datasets.utils.logging.get_logger(__name__) class __lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig ):...
291
1
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase__ ) -> list: return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(UpperCAmelCase__ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doc...
713
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def UpperCAmelCase__ ( UpperCAmelCase__ ) -> int: A_ = FileLock(str(tmpdir / """foo.lock""" ) ) A_ = FileLock(str(tmpdir / """foo.lock"...
667
0
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __lowerCAmelCase ( unittest.TestCase ): @prop...
60
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) lowerCamelCase = { """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrOCRConfig...
191
0
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_acceler...
267
'''simple docstring''' import random from typing import Any def UpperCAmelCase ( lowerCamelCase_ :list ): '''simple docstring''' for _ in range(len(lowerCamelCase_ ) ): snake_case_ : Union[str, Any] = random.randint(0 , len(lowerCamelCase_ ) - 1 ) ...
267
1
import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf ...
493
"""simple docstring""" import math def lowercase ( a__ : int ) -> str: _UpperCamelCase = 0 _UpperCamelCase = 0 while num > 0: _UpperCamelCase = num % 8 _UpperCamelCase = octal + (remainder * math.floor(math.pow(10 , a__ ) ))...
420
0
'''simple docstring''' from collections import deque def __a(SCREAMING_SNAKE_CASE_ : Optional[Any] ): '''simple docstring''' _lowerCAmelCase = len(__a ) _lowerCAmelCase = deque() _lowerCAmelCase = [False for _ in range(__a )] _lowerCAmelCase ...
720
'''simple docstring''' from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class lowerCAmelCase_ : def _snake_case ( self , _lowerCAmelCase ) -> Tuple: raise NotImplementedError() def ...
489
0
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational ...
58
"""simple docstring""" def snake_case ( _a: int , _a: int )-> int: '''simple docstring''' lowerCamelCase__ = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowerCamelCase__ = n - k # Calc...
510
0
'''simple docstring''' import numpy as np class _SCREAMING_SNAKE_CASE : def __init__( self : Optional[int] , __UpperCamelCase : List[str]=None , __UpperCamelCase : Any=None , __UpperCamelCase : Dict=None , __UpperCamelCase : List[Any]=None , __UpperCamelCase :...
705
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _lowercase : List[str] =logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE (lowercase__ ): def __init__( self : Any , *__UpperCamelCase : O...
574
0
"""simple docstring""" def UpperCamelCase ( _lowerCAmelCase : Optional[int] = 2000000 ) -> str: _UpperCAmelCase : List[str] = [0 for i in range(n + 1 )] _UpperCAmelCase : List[Any] = 1 _UpperCAmelCase : Optional[int...
238
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def __SCREAMING_SNAKE_CASE ( A_ ): lowerCAmelCase__ ,lowerCAmelCase__ : Dict = analyze_text(A_ ) lowerCAmelCase__ : Any ...
450
0
"""simple docstring""" def __lowercase ( lowerCamelCase_ : Union[str, Any] ): '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): SCREAMING_SNAKE_CASE__ = F'''Input value of [number={number}] must be an integer'...
700
"""simple docstring""" import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets _lowerCamelCase = datasets.logging.get_logger(__name__) _lowerCamelCase = '\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation...
112
0
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ......
686
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 impor...
686
1
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_common import Fla...
716
import argparse import os import re lowerCamelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCamelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCamelCase__ = re.compile(R'''^\s*"(...
226
0
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : int = 1000000 ): lowerCamelCase_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , UpperCAmelCase_ ): p...
675
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
1
'''simple docstring''' from math import sqrt def _lowerCamelCase ( A_ : Any ) -> str: '''simple docstring''' UpperCamelCase__ : List[Any] =0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE_ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE_CASE_ )...
715
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, nes...
582
0
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcessor, ...
439
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, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.utils import floa...
439
1
from datetime import datetime import requests def lowercase_ ( _A : str ): """simple docstring""" lowerCamelCase__ : Any = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" lowerCamelCase__ : Tuple = requests.get(ba...
5
import os from pathlib import Path def lowercase_ ( ): """simple docstring""" from torch.utils.cpp_extension import load lowerCamelCase__ : Any = Path(_A ).resolve().parent.parent.parent / "kernels" / "deformable_detr" lowerCamelCase__ : Optiona...
5
1
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def UpperCamelCase__ ( ): """simple docstring""" print("""Making key files...""...
207
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) A__ : Any ={ '''configuration_speecht5''': [ '''SPEECHT5_PRETRAINED_...
207
1
def lowerCamelCase_ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' SCREAMING_SNAKE_CASE = set() # To detect a back edge, keep track of vertices currently in the recursion stack SCREAMING_SNAKE_CASE = set() return any( node not in visited and depth_fi...
450
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging __A : List[Any] = logging.get_logger(__name__) __A : Tuple = { """facebook/encodec_24khz""": """https://huggingface.co/facebook/en...
450
1
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_tr...
93
'''simple docstring''' import argparse import datetime def lowerCamelCase__ ( A : str ): '''simple docstring''' UpperCAmelCase = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', ...
210
0
_snake_case = { """a""": """AAAAA""", """b""": """AAAAB""", """c""": """AAABA""", """d""": """AAABB""", """e""": """AABAA""", """f""": """AABAB""", """g""": """AABBA""", """h""": """AABBB""", """i""": """ABAAA""", """j""": """BBBAA""", """k""": """ABAAB""", ...
611
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _snake_case = logging.get_logger("""transformers.models.speecht5""") def _A ( __magic_name__ , __magic_name__ , __magic_n...
611
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase__) class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =field(...
647
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { """microsoft/wavlm-base""": """https://huggingface.co/microsoft/wavlm-base/resolve/main...
19
0
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets ...
318
'''simple docstring''' _lowerCAmelCase = "Input must be a string of 8 numbers plus letter" _lowerCAmelCase = "TRWAGMYFPDXBNJZSQVHLCKE" def _lowerCAmelCase ( lowercase : str ) ->bool: """simple docstring""" if not isinstance(lowercase...
318
1
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common i...
498
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_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints, we had to include /home/niel...
37
0
'''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_tens...
508
'''simple docstring''' import socket def lowercase__( ): """simple docstring""" SCREAMING_SNAKE_CASE : str = socket.socket(socket.AF_INET ,socket.SOCK_STREAM ) SCREAMING_SNAKE_CASE : Any = socket.gethostname() ...
508
1
'''simple docstring''' def A__ ( __lowerCAmelCase : List[str] , __lowerCAmelCase : List[Any] ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) lowerCamelCase__ = (boundary[1] - boundary[0]) / steps lowerCamelCase__ ...
50
"""simple docstring""" def _A (__a ) -> bool: """simple docstring""" return str(__a ) == str(__a )[::-1] def _A (__a ) -> int: """simple docstring""" return int(__a ) + int(str(__a )[::-1] ) def _A (__a = 1_00_00 ) ...
512
0
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class UpperCamelCase_ ( snake_case_ , snake_case_ ): '''simple ...
713
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, 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 Con...
607
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffuser...
111
'''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 ...
111
1
from __future__ import annotations import os from collections.abc import Mapping _lowercase = tuple[int, int] class _UpperCAmelCase : def __init__( self , a__ , a__): A__ = vertices A__ = { (min(a__), max(a__)): weight for edge, wei...
712
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Conf...
526
0
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def _UpperCAmelCase ( UpperCAmelCase : Any , UpperCAmelCase : Dict ): """simple docstring""" ...
519
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance __UpperCamelCase : Optional[Any] = 6_378_137.0 __UpperCamelCase : Any = 6_356_752.314_245 __UpperCamelCase : Optional[int] = 6378137 def _UpperCAmelCase ( Up...
519
1
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling_uti...
712
def lowercase_ ( SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : list[int] ): """simple docstring""" # Check if the input is valid if not len(SCREAMING_SNAKE_CASE ) == len(SCREAMING_SNAKE_CASE ) == 3: raise ValueError('''Please enter a valid equation.''' ) if...
408
0
def lowercase ( __A : int ) -> 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 interpreted as an inte...
36
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_CHECKING: from ... import Pr...
36
1
'''simple docstring''' # DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configur...
0
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset from utils import logger class _a (_lowerCamelCase): """simple docstring""" def __init__( self , A__ , A__ ) -> Any: _SCREAMING_SNAKE_CASE ...
0
1
class snake_case__ : '''simple docstring''' def __init__( self : List[Any] ) -> Any: UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 UpperCAmelCase_ = {} def UpperCamelCase ( ...
121
def _a ( SCREAMING_SNAKE_CASE__ : List[Any]=2_81_23 ) -> Any: '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i ...
663
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Optional[Any] = logging.get_logger(__name__) _lowerCamelCase : Optional[int] = { """tiiuae/falcon-40b""": """https://huggingface.co/tiiuae/falco...
715
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lowerCamelCase : Any = { """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggi...
512
0
"""simple docstring""" def __snake_case ( _lowercase ): """simple docstring""" UpperCamelCase = [] UpperCamelCase = [] UpperCamelCase = { '''^''': 3, '''*''': 2, '''/''': 2, '''%''': 2, '''+'''...
34
'''simple docstring''' from __future__ import annotations from fractions import Fraction def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 1_0 == den // 1_0 and (num // 1_0) / (d...
446
0
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class _UpperCAmelC...
703
"""simple docstring""" import sys def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : Dict = len(_UpperCAmelCase ) A_ : int = [[0 for x in range(_UpperCAmelCase )] for x in range(_UpperCAmelCase )] A_ : T...
302
0
"""simple docstring""" import string from math import logaa def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase ) -> int: '''simple docstring''' _lowerCamelCase : Tuple = document.translate( str.maketrans("" , "" , string.punctuation ...
46
'''simple docstring''' import importlib.metadata import operator import re import sys from typing import Optional from packaging import version __lowerCamelCase : List[str] = { '<': operator.lt, '<=': operator.le, '==': operator.eq, '!=': operator.ne, '>=': operator.ge, '>':...
404
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE = { """configuration_roc_bert""": ["""ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RoCBertConfig"""], ...
556
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_ve...
556
1
import string def lowerCamelCase ( UpperCamelCase : str ) -> None: for key in range(len(string.ascii_uppercase ) ): _lowerCamelCase = '' for symbol in message: if symbol in string.ascii_uppercase: _lowerCamelCase = string.ascii_uppercase...
544
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' def __lt__( self : List[Any] , sn...
544
1
"""simple docstring""" import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_c...
16
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class __Upper...
16
1
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor fro...
14
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUM...
14
1
"""simple docstring""" import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.mo...
714
"""simple docstring""" # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, T...
492
0
'''simple docstring''' 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], ...
474
'''simple docstring''' from __future__ import annotations from typing import Any def _A ( _lowerCAmelCase ): """simple docstring""" create_state_space_tree(_lowerCAmelCase , [] , 0 ) def _A ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ): ...
474
1
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from tran...
332
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline _UpperCamelCase : str =argparse.ArgumentParser('Stable Diffusion script with intel optimization', add_help=False) parser.add_argument('--dpm', ...
332
1
def lowerCAmelCase__(__snake_case ,__snake_case ) -> bool: '''simple docstring''' lowerCamelCase__ = len(a_ ) lowerCamelCase__ = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed ...
481
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ : Tuple = logging.get_logger(__name__) lowerCamelCase__ : Optional[Any] = { "microsoft/markuplm-base": "https://huggingface.co/microsoft/markuplm-bas...
698
0
"""simple docstring""" import heapq import sys import numpy as np SCREAMING_SNAKE_CASE__:Optional[int] = tuple[int, int] class snake_case__ : def __init__( self ): __a = [] __a = set() def a__ ( self ): if not self.empty(): retu...
704
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def _lowerCamelCase( a , a , a ): __a = OmegaConf.load(a ) __a = torch.load(a , map_location...
67
0
"""simple docstring""" import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": a_ = """%20""".join(argv[1:]) if len(argv) > 1 else quote(str(input("""Search: """))...
437
"""simple docstring""" import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor a_ = logging.get_logger(__name__) class A_(SCREAMING_SNAKE_CASE_ ): """simple docstring""" def __init__( self , *A , **A ...
437
1
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness _SCREAMING_SNAKE_CASE : Tuple = '\\n@misc{chen2021evaluating,\n title={Evaluating...
714
def __lowerCAmelCase ( __magic_name__ ): return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') _SCREAMING_SNAKE_CASE : str = int(input(...
206
0
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def __UpperCAmelCase ( lowercase ,lowercase ,lowercase ,lowercase ,lowercase ): """simple docstr...
277
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoModelFo...
614
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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltForQ...
702
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def A_ ( snake_case : int ) -> int: '''simple docstring''' def is_in_circle(snake_case : float , snake_case : float ) -> bool: ...
451
0
import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_ut...
101
"""simple docstring""" import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_ava...
545
0
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def snake_case__ ( __lowercase , __lowercase , __lowercase ) -> int: """simple docstring""" ...
719
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex snake_case : Any = logging.getLogger(__name__) class lowerCAmelCase__ : def __init__( self : ...
182
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @datac...
273
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class A__ : """simple docstring""" def __init__( self: Union[str, Any] )-> List[str]: lowerCamelCase : Optional[int] = ...
222
0
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__ ='\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingua...
719
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase__ (__lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): # Const...
381
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCamelCase__ = {'tokenization_bertweet': ['BertweetTokenizer']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys UpperCamelCase__ = _LazyModule(__n...
110
from __future__ import annotations _lowerCAmelCase : Optional[Any] = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class lowerCAmelCase : '''simple docs...
246
0
'''simple docstring''' 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 snak...
718
'''simple docstring''' import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, ...
377
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, ft...
588
'''simple docstring''' from heapq import heappop, heappush import numpy as np def SCREAMING_SNAKE_CASE ( lowercase_ : np.ndarray , lowercase_ : tuple[int, int] , lowercase_ : tuple[int, int] , lowercase_ : bool , ): lowercase , lowercase = grid.shape ...
588
1
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase )-> list[int]: if len(__UpperCamelCase ) == 0: return array UpperCamelCase ,UpperCamelCase = min(__UpperCamelCase ), ma...
35
'''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 model through reduction of a normal pre-trained model, but keep...
35
1
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be...
47
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __magic_name__ ={ '''configuration_roformer''': ['''ROFORMER_PRETRAINED_CONFIG_ARCHIVE_...
415
0
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, ) lowercase_ = { '''configuration_clip''': [ ...
700
# 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...
336
0
"""simple docstring""" class A_ : def __init__( self: Optional[int] ): '''simple docstring''' _lowerCamelCase : Dict = {} def _lowercase ( self: str ): '''simple docstring''' print(self.vertex )...
46
from math import factorial class __lowercase : """simple docstring""" def __init__( self , __UpperCAmelCase , __UpperCAmelCase ) -> Optional[int]: A : Union[str, Any] = real if isinstan...
542
0
"""simple docstring""" import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import nu...
176
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_wei...
176
1
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar _lowercase : Union[str, Any] =TypeVar("T") class snake_case__ (Generic[T] ): ...
136
from importlib import import_module from .logging import get_logger _lowercase : Optional[int] =get_logger(__name__) class snake_case__ : """simple docstring""" def __init__( self , __lowercase , __lowercase=None ) -> Dict: ...
136
1
import argparse import os import re import packaging.version lowerCAmelCase : Any = 'examples/' lowerCAmelCase : Optional[int] = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R'^__versi...
353
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 from ..auto import CONFIG_MAPPING lowerCAmelCase : Dict = logging.get_logger(__name__) lowe...
353
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, Wav...
103
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = { '''google/pix2struct-textcaps-base''': ( '''https:/...
288
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import...
583
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 ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoo...
583
1
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...
629
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models ...
707
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class a : UpperCamelCase : int UpperCamelCase : int class a : def __init__( ...
254
0
# 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...
55
"""simple docstring""" from __future__ import annotations def lowercase (_lowerCAmelCase ): __lowerCAmelCase = 2 __lowerCAmelCase = [] while i * i <= n: if n % i: i += 1 else: n //= i factor...
465
0
A = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _lowerCamelCase( lowerCAmelCase__ : Optional[int] , lowerCAmelCase__ : List[str] , lowerCAmelC...
706
def _lowerCamelCase( ): '''simple docstring''' return 1 def _lowerCamelCase( lowerCAmelCase__ : int ): '''simple docstring''' return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def _lowerCamelCase( lowerCAmelCase__ : int ...
97
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __a :List[Any] = {'configuration_speech_encoder_decoder': ['SpeechEncoderDecoderConfig']} try: if not is_torch_available(): raise Optional...
86
def lowerCamelCase__ ( a : list , a : list , a : int , a : int , a : int ) -> int: """simple docstring""" if index == number_of_items: return 0 a__ :str = 0 a__ :Union[str, Any] = 0 a__ :Optional[int...
395
0
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging _U...
575
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase : Dict =logging.get_logger(__name__) _UpperCamelCase : List[str] ={ "huggingface/informer-tourism-monthly": ( ...
575
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __UpperCamelCase ( unittest.TestCase...
80
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __A : List[str] = HUGGINGFACE_HUB_CACHE __A : Optional[int] = 'config.json' __A : List[str] = 'diffusion_pytorch_model.bin' __A : Tuple ...
394
0
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ): ...
23
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING...
23
1
class __lowercase : def __init__( self , a__ , a__ , a__ ) -> Dict: '''simple docstring''' A_ = None A_ = None A_ = graph self._normalize_graph(a__ ...
141
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) SCREAMING_...
141
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase = { """configuration_mobilenet_v2""": [ """MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MobileNetV2Con...
713
"""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: F401 ...
342
0
import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_available(): from transformers...
348
from __future__ import annotations def SCREAMING_SNAKE_CASE ( __UpperCamelCase , __UpperCamelCase) -> set[str]: a , a = set(__UpperCamelCase), [start] while stack: a = stack.pop() explored.add(__UpperCamelCase) # Differences from BF...
515
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer _A = {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''} _A ...
325
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def __UpperCamelCase ( _A ): lowerCAmelCase_ = Swi...
325
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_tor...
532
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowercase ( uni...
532
1
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, infer_sh...
712
'''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 __a = logging.get_logger(__name__) __a = "T5Config" def __snake_case( ...
301
0
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common im...
79
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
from __future__ import annotations def A_ ( A__ ) -> bool: a__ : List[Any] = len(A__ ) # We need to create solution object to save path. a__ : Dict = [[0 for _ in range(A__ )] for _ in range(A__ )] a__ : Tuple = run_...
702
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : List[str] = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """AutoformerCon...
392
0
from __future__ import annotations def A ( lowercase__ : int ) -> list[int]: UpperCamelCase__ :Tuple = 2 UpperCamelCase__ :Dict = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(lowercase__ ) if n > 1: factors.append(lowercase__ ) retu...
45
'''simple docstring''' import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sente...
72
0
from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def a ( _UpperCAmelCase : Sequence[float] , _UpperCAmelCase : int , _UpperCAmelCase : int ): ...
720
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class UpperCAmelCase__ ( __UpperCamelCase ): '''simple docstring''' @require_torch def sn...
241
0
import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
40
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( UpperCamelCase__ ): __lowercase = ["""image_processor""", """tokenizer"""] __lowercase = """CLIPImage...
440
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from...
715
from typing import Any def a (_lowerCAmelCase ): if not input_list: return [] SCREAMING_SNAKE_CASE_ = [input_list.count(_lowerCAmelCase ) for value in input_list] SCREAMING_SNAKE_CASE_ = max(_lowerCAmelCase ) # Gets the maximum count in t...
89
0
import os import pytest from attr import dataclass UpperCAmelCase_ = """us-east-1""" # defaults region @dataclass class lowerCamelCase__ : """simple docstring""" a__ : str a__ : List[str] = "arn:aws:iam::558105141721:role/sagemaker_execution_role" a__ : List[A...
2
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""} class lowerCamelCase__ ( _A): """simple ...
2
1
def _a ( SCREAMING_SNAKE_CASE__ : List[str]=2_81_23 ) -> List[str]: '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): s...
157
import math def _a ( SCREAMING_SNAKE_CASE__ : int ) -> bool: '''simple docstring''' SCREAMING_SNAKE_CASE__ : int = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(SCREAM...
157
1
import math from collections.abc import Iterator from itertools import takewhile def lowerCamelCase_ ( lowerCAmelCase__ : Dict ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
106
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : str = logging.get_logger(__name__) UpperCAmelCase : Optional[int] = { "edbeeching/decision-transformer-gym-hopper-medium": ( "https://huggingface...
567
0
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 A_ ( __lowerCamelCase ): '''simple...
708
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter UpperCAmelCase = True except ImportError...
565
0
'''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 __SCREAMING_SNAKE_CASE : Optional[Any] = logging.get_logger(__name__) __SCREAM...
244
'''simple docstring''' import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_flax_...
244
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=lowercase ): """simple docstring""" _lowerCAmelCase : List[Any] = ["sentencepiece"] def __init__( self , *UpperCAmelCase__ ...
112
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _lowerCamelCase = 0b1011_0011_1110_1100_1001_0000_0111_1011_...
112
1
class __lowercase : # Public class to implement a graph """simple docstring""" def __init__( self , A , A , A ) -> Tuple: '''simple docstring''' lowerCamelCase = row lowerCamelCase = col lowerCamelCase = graph def ...
457
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 =logging.get_logger(__name__) a ="""▁""" a ={"""vocab_file""": """...
652
0
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase ...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ : Optional[Any] = { "configuration_encodec": [ "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP", "EncodecConfig", ]...
43
1
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) UpperCAmel...
117
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer else:...
117
1
from __future__ import annotations import collections import pprint from pathlib import Path def __a ( A__ : str ): return "".join(sorted(lowerCAmelCase__ ) ) def __a ( A__ : str ): return word_by_signature[signature(lowerCAmelCase__ )] ...
709
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
698
0
'''simple docstring''' import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union _UpperCamelCase : List[Any] = re.compile(r"^(?P<major>\d+)" r"\.(?P<minor>\d+)" r"\.(?P<patch>\d+)$") @total_ordering @dataclass c...
284
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
399
0
import operator as op __magic_name__ = '''scaler.pt''' __magic_name__ = '''pytorch_model''' __magic_name__ = '''random_states''' __magic_name__ = '''optimizer''' __magic_name__ = '''scheduler''' __magic_name__ = '''pytorch_model.bin''' __magic_name_...
705
from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def __magic_name__ ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ = False): '''simple docstring''' if radian_mode: return [magn...
73
0