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
import operator as op def lowerCAmelCase_ ( __a ) -> Tuple: """simple docstring""" lowerCamelCase__: Optional[Any] =[] lowerCamelCase__: Tuple =lambda __a , __a : int(x / y ) # noqa: E731 integer division operation lowerCamelCase__: T...
59
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 logging.set_...
20
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def a_ ( lowerCamelCase : Any ): # vision encoder if "img_encoder.pos_embed" in name: lower...
513
'''simple docstring''' def a_ ( lowerCamelCase : Tuple , lowerCamelCase : Tuple ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) lowerCAmelCase = (boundary[1] - boundary[0]) / steps lowerCAmelCase = boundary[0] lowerCAmelCase...
513
1
"""simple docstring""" SCREAMING_SNAKE_CASE_ = 256 # Modulus to hash a string SCREAMING_SNAKE_CASE_ = 1_000_003 def lowercase (_lowerCAmelCase , _lowerCAmelCase ): __lowerCAmelCase = len(_lowerCAmelCase ) __lowerCAmelCase = len(_lowerCAmelCase ) ...
465
"""simple docstring""" import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.a...
465
1
import warnings from ..trainer import Trainer from ..utils import logging UpperCAmelCase_ = logging.get_logger(__name__) class UpperCamelCase_ ( _lowerCamelCase ): def __init__( self , lowerCAmelCase_=None , **lowerCAmelCase_ ) -> Dict: warni...
541
def lowerCamelCase__ ( UpperCamelCase__ : List[Any] , UpperCamelCase__ : Dict , UpperCamelCase__ : str , UpperCamelCase__ : int , UpperCamelCase__ : List[str] , UpperCamelCase__ : str ) -> List[Any]: ...
541
1
'''simple docstring''' from functools import lru_cache @lru_cache def __snake_case ( UpperCAmelCase_ : int ): if num < 0: raise ValueError("Number should not be negative." ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": ...
675
from __future__ import annotations class __snake_case : """simple docstring""" def __init__( self , _UpperCamelCase , _UpperCamelCase ) -> Tuple: """simple docstring""" __snake_case , __snake_case ...
268
0
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a_ :Union[str, Any] = logging.get_logger(__name__) class snake_case__ ( lowerCAmelCase_ ): """simple docstring""" ...
243
import random def lowercase_ (A : int ): snake_case__ : List[str] = num - 1 snake_case__ : Union[str, Any] = 0 while s % 2 == 0: snake_case__ : Any = s // 2 t += 1 for _ in range(5 ): ...
243
1
'''simple docstring''' def lowercase_ ( __A : List[str] ) -> Union[str, Any]: """simple docstring""" lowercase : str =[0] * len(__A ) lowercase : Union[str, Any] =[] lowercase : str =[] lowercase : List[Any] =0 for...
94
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_co...
545
0
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae import Decoder, DecoderOutput, Encoder, V...
522
import random from typing import Any def UpperCAmelCase ( lowercase ): """simple docstring""" for _ in range(len(lowercase ) ): __lowercase = random.randint(0 , len(lowercase ) - 1 ) __lowercase = random....
522
1
"""simple docstring""" import numpy as np def lowercase__ ( lowerCAmelCase__ : Union[str, Any] ) -> Dict: '''simple docstring''' return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
642
"""simple docstring""" import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def A__ ( __lowerCamelCase, __lowerCamelCase, __lowerCam...
589
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { "shi-lab...
489
'''simple docstring''' _SCREAMING_SNAKE_CASE = range(2, 20 + 1) _SCREAMING_SNAKE_CASE = [10**k for k in range(ks[-1] + 1)] _SCREAMING_SNAKE_CASE = {} def __a(SCREAMING_SNAKE_CASE_ : Tuple , SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : Any , SC...
489
1
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
621
"""simple docstring""" def lowercase__ ( lowerCamelCase, lowerCamelCase ): return abs(lowerCamelCase ) if a == 0 else greatest_common_divisor(b % a, lowerCamelCase ) def lowercase__ ( lowerCamelCase, lowerCamelCase ): while y: # --> when y=0 ...
621
1
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.u...
42
"""simple docstring""" import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.te...
42
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : List[Any] = logging.get_logger(__name__) a__ : str = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'} class UpperCAmel...
601
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBen...
601
1
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowercase ( a : int ) -> int: __snake_case : Optional[int] =prime_factors(a ) if is_square_free(a ): return -1 if len(a ) % 2 el...
715
"""simple docstring""" from __future__ import annotations def __lowercase ( a : int , a : int ) -> list[str]: if partitions <= 0: raise ValueError('''partitions must be a positive number!''' ) if partitions > number_of_bytes: raise Value...
497
0
def UpperCamelCase ( lowercase_ ) -> list: '''simple docstring''' for i in range(len(lowercase_ ) - 1 , 0 , -1 ): lowercase__ : Union[str, Any] = False for j in range(lowercase_ , 0 , -1 ): if unsorted[j] < unsorted[j - 1]: lower...
12
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowercase_ = logging.get...
695
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import MC...
704
import math class _lowerCAmelCase : def __init__( self , _UpperCamelCase=0 ) -> Tuple: # a graph with Node 0,1,...,N-1 lowerCAmelCase_ = n lowerCAmelCase_ = [ [math.inf for j in range(0 , _UpperCamelCase )] for i ...
279
0
import faiss # 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 requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 # Here to have...
290
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing import APIRo...
324
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _A : Optional[int] = { '''configuration_mobilebert''': [ '''MOBILEBERT_PRETRA...
711
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class _lowercase : '''simple docstring''' def __init__( self : Tuple ) -> Any: __lowerCAmelCase = {} def a ...
330
0
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin snake_case__ = get_tests_dir('''fixtures/spiece.model''') @...
395
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, DistributedT...
395
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ : Optional[Any] = { """configuration_instructblip""": [ """INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """InstructBlipConfig""", """Inst...
655
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import Reg...
655
1
'''simple docstring''' from __future__ import annotations import typing from collections.abc import Iterable import numpy as np A__ : Dict = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 A__ : Optional[Any] = typing.Union[np.floataa, int, float] # noqa: UP00...
13
'''simple docstring''' def __UpperCamelCase ( lowercase__ : list[int] ): '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) __lowercase =sum(lowercase__ ) / len(lowercase__ ) # Calculate ...
119
0
from math import pi def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
38
from PIL import Image def A_ ( _lowerCAmelCase ) -> Image: UpperCamelCase , UpperCamelCase : List[Any] = image.size UpperCamelCase : Union[str, Any] = 0 UpperCamelCase : List[str] = image.load() for i in range(_lowerCAmelCase ): for j in range...
38
1
"""simple docstring""" import math import os import sys def _lowercase ( __lowerCAmelCase ) -> str: SCREAMING_SNAKE_CASE__ : Union[str, Any] = """""" try: with open(__lowerCAmelCase , """rb""" ) as binary_file: SCREAMING_SNA...
680
"""simple docstring""" import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger a :Optional[Any] = "<<<<<<< This should probably be modified because it mentions: " a :Tupl...
680
1
'''simple docstring''' def _a ( _SCREAMING_SNAKE_CASE : Any ): _SCREAMING_SNAKE_CASE = [0] * len(_SCREAMING_SNAKE_CASE ) _SCREAMING_SNAKE_CASE = [] _SCREAMING_SNAKE_CASE = [1] * len(_SCREAMING_SNAKE_CASE ) for values in graph.values(): for i in values: ...
493
'''simple docstring''' import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrat...
493
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionP...
664
'''simple docstring''' import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def __snake_case ( lowerCamelCase_ : Any , lowerCamelCase_ : int , lowerCamelCase_ : Optional[Any] ): '''simple docstring''' ...
664
1
import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case_ ( __a , unittest.TestCas...
706
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case_ = {'''configuration_swin''': ['''SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SwinConfig''', '''SwinOnnxConfig''']} try: if not is_torch_a...
262
0
'''simple docstring''' from __future__ import annotations from math import pow, sqrt def lowerCamelCase ( _snake_case : float ,_snake_case : float ,_snake_case : float ): '''simple docstring''' if (resistance, reactance, impedance).count...
267
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ = { "configuration_clap": [ "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST", "ClapAudioConfig", "C...
267
1
'''simple docstring''' UpperCamelCase_ = { '''A''': ['''B''', '''C''', '''E'''], '''B''': ['''A''', '''D''', '''E'''], '''C''': ['''A''', '''F''', '''G'''], '''D''': ['''B'''], '''E''': ['''A''', '''B''', '''D'''], '''F''': ['''C'''], '''G''': ['''C'''], } def lowerCamelC...
703
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = {'''vocab_file''': '...
320
0
import requests def __lowercase ( snake_case, snake_case ): """simple docstring""" __magic_name__ :Dict = {'''Content-Type''': '''application/json'''} __magic_name__ :Union[str, Any] = requests.post(snake_case, json={'''text''': message_body}, headers=snake_case ...
0
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowerCamelCase =(3, 9, -1_1, 0, 7, 5, 1, -1) lowerCamelCase =(4, 6, 2, 0, 8, 1_0, 3, -2) @dataclass class _lowerCamelCase : """simple docstring""" SCREAMING_SNAKE_CAS...
285
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } class UpperCAmelCase ( ...
704
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class UpperCAmelCase ( UpperCAmelCase__ ): '''simple...
139
0
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_tenso...
73
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class UpperCAmelCase__ : """simple docstring""" lowerCAmelCase__ : int lowerCAmelCase__ : TreeNode | None = None lowerCAmelCase__ : TreeNode | None ...
221
0
def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : float ) -> float: """simple docstring""" if edge <= 0 or not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""Length must be a positive.""" ) return 3 * ((25 + 10 * (5 ** (1 /...
379
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCamelCase : List[Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''In...
379
1
# Algorithm for the pigeonhole sorting def _SCREAMING_SNAKE_CASE ( lowercase : str ): '''simple docstring''' lowerCamelCase_ = min(lowercase ) # min() finds the minimum value lowerCamelCase_ = max(lowercase ) # max() finds the ...
70
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class lowerCAmelCase ( ...
247
0
'''simple docstring''' import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _lowerCamelCase ( lowercase : Dict = 3 ) -> List[str]: '''simple docstring''' if isinstance(_lowerCamelCase ...
717
'''simple docstring''' import os from datetime import datetime as dt from github import Github lowerCAmelCase_ : List[Any] = [ 'good first issue', 'feature request', 'wip', ] def _lowerCamelCase ( ) -> Dict: _a = Github(os.environ["GITH...
521
0
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example __lowerCamelCase = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0,...
288
'''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 from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_featu...
288
1
"""simple docstring""" import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers...
716
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
91
0
"""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 __lowerCAmelCase ...
584
"""simple docstring""" __UpperCAmelCase : List[str] = {str(digit): digit**5 for digit in range(10)} def A ( _A ): """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_A ) ) def A ( ): """simple docstring""" return...
584
1
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor im...
719
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start...
129
0
import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput snake_case_ = '''scheduler_config.json''' class SCREAMING_SNAKE_CASE__ (_UpperCAmelCase ): __lowerCamelCase : List[An...
164
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig a : List[str] = logging.get_logger(__name__) class a_ : def __init_...
555
0
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING,...
652
lowercase_ : Tuple = ''' # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/huggingface/tr...
652
1
import functools def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' snake_case_ = len(__snake_case ) snake_case_ = len(__snake_case ) @functools.cache def min_distance(UpperCamelCa...
362
"""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 keeping th...
361
0
from collections.abc import Callable import numpy as np def __UpperCamelCase ( a, a, a, a, a) ->np.ndarray: lowerCamelCase__ = int(np.ceil((x_end - xa) / step_size)) lowerCamelCase__ = np.zeros((n + 1,)) lowerCamelCase__ = ya ...
360
def __UpperCamelCase ( a = 100) ->int: lowerCamelCase__ = (n * (n + 1) // 2) ** 2 lowerCamelCase__ = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(f"""{solution() = }""")
360
1
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from dif...
224
"""simple docstring""" import sys from collections import defaultdict class lowerCAmelCase__ : def __init__( self : List[str] ): _snake_case = [] def lowercase ( self : Optional[Any] , _lowerCamelCase : ...
224
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCamelCase : List[str] = { 'configuration_graphormer': ['GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GraphormerConfig'], } tr...
134
"""simple docstring""" import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_f...
134
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def snake_case_ (UpperCa...
22
'''simple docstring''' import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCS...
244
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import Regre...
713
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _lowerCamelCase : List[str] = (720, 1280) # Height, Width _lowerCamelCase : Optional[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. _lower...
177
0
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extracti...
69
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : int ) -> int: assert ( isinstance(_UpperCAmelCase , _UpperCAmelCase ) and number_of_steps > 0 ), F'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if number_of_st...
69
1
'''simple docstring''' import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbo...
411
'''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_retribert import RetriBertTokenizer lowerCamelCase__ = ...
411
1
'''simple docstring''' import warnings from ..trainer import Trainer from ..utils import logging lowercase = logging.get_logger(__name__) class __lowerCamelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self ...
211
'''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 ...
211
1
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, ...
714
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
0
from math import factorial UpperCAmelCase__ : dict[str, int] = {str(digit): factorial(digit) for digit in range(10)} def A ( snake_case__ : int ) -> int: '''simple docstring''' if not isinstance(snake_case__ , snake_case__ ): raise TypeError('Pa...
313
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever UpperCAmelCase__ : Union[str, Any] = logging.getLogger(__name__) class __lowercase ...
313
1
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.mod...
714
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _SCREAMING_SNAKE_CASE = { "configuration_encodec": [ "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP", "EncodecConfig", ], "feature_extraction_en...
557
0
"""simple docstring""" from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class UpperCAmelCase_ : def __init__( self , UpperCamelCase_ = None ) -> None: if components is N...
76
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { """google/bit-50""": """https...
558
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a : int = logging.get_logger(__name__) a : ...
593
'''simple docstring''' import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated a : int = collections.namedtuple('_...
593
1
'''simple docstring''' import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
13
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping A__ : Optional[Any] = tuple[int, int] class UpperCAmelCase_ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ...
13
1
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : list[list[int]] ): def update_area_of_max_square(_lowerCamelCase : int , _lowerCamelCase : int ) -> int: # BASE CASE ...
63
"""simple docstring""" import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def lowerCAmelCase__(self ): '''simple docstring''' __a : str = 0 __...
63
1
'''simple docstring''' import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class _UpperCamelCase ( SCREAMING_SNAKE_CASE): '''simple docstring''' _snake_case = '''M-CLIP''' def __init__( self , a_=1_0_2_4 , a_...
372
'''simple docstring''' from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_a...
372
1
import os def _lowerCAmelCase ( __lowerCAmelCase ) -> List[Any]: """simple docstring""" snake_case__ : Dict = len(grid[0] ) snake_case__ : Optional[Any] = len(__lowerCAmelCase ) snake_case__ : int = 0 snake_case__ : List...
219
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transformers...
219
1
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 import ImageProcessin...
59
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, AutoTokenizer, Dat...
691
0
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import req...
489
'''simple docstring''' import math def __a(SCREAMING_SNAKE_CASE_ : int = 100 ): '''simple docstring''' _lowerCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) _lowerCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) ...
489
1
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAM...
34
'''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.pipelines.conversational import ...
109
0
import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import floats_tensor, is_xformers_...
83
import numpy as np import qiskit def snake_case ( snake_case__ :int = 8 , snake_case__ :int | None = None) -> str: _A = np.random.default_rng(seed=snake_case__) # Roughly 25% of the qubits will contribute to the key. # So we take more than we ...
83
1
def lowerCAmelCase__ ( a__ = 50 ) ->str: '''simple docstring''' _UpperCamelCase = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ways_number[row_length] ...
547
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 ....
643
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase__ = { '''configuration_convbert''': ['''CONVBERT_PRETRAINED_CONFIG_ARC...
544
"""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 ...tes...
544
1
'''simple docstring''' import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_availabl...
566
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : int = logging.get_logger(__name__) snake_case : Optional[Any] = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-...
566
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ : List[str] ...
716
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf fro...
295
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase: str = { '''configuration_roberta''': ['''ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
192
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 if is_torch_available(): import torch if is_vision_available...
192
1
'''simple docstring''' 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_identi...
624
'''simple docstring''' def _A ( ): """simple docstring""" for n in range(1 , 1000000 ): yield n * (n + 1) // 2 def _A ( A__ ): """simple docstring""" __lowercase = 1 __lowercase = 2 while i * i <= n: __lowercase = ...
624
1
"""simple docstring""" from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
610
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
1
import warnings from ..trainer import Trainer from ..utils import logging __lowercase : Union[str, Any] =logging.get_logger(__name__) class A ( __lowercase ): def __init__( self: int , _lowerCAmelCase: Any=None , **_lowerCAmelCase: Op...
711
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_ut...
550
0
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def UpperCamelCase_ ( lowerCAmelCase__ = 8 ): """simple docstring""" _lowerCAmelCase : str = ascii_letters + digits + punctuation return ...
424
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 # Here to have a ni...
443
0
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class A__ ( __snake_case , unittest.TestCase ): _UpperCAmelCase :List[str] = DownBlockaD # noqa F40...
720
import math import tensorflow as tf from packaging import version def A_ ( _lowerCAmelCase ) -> Any: UpperCamelCase : List[Any] = tf.convert_to_tensor(_lowerCAmelCase ) UpperCamelCase : Any = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) , x.dtype )...
38
0
"""simple docstring""" import re from filelock import FileLock try: import nltk UpperCAmelCase : Tuple = True except (ImportError, ModuleNotFoundError): UpperCAmelCase : Optional[int] = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: ...
139
"""simple docstring""" def lowerCamelCase ( _UpperCamelCase : int = 1_0_0_0_0_0_0 ) -> int: '''simple docstring''' __UpperCAmelCase : List[str] = 1 __UpperCAmelCase : Union[str, Any] = 1 __UpperCAmelCase : Optional[Any] = {1: 1} ...
139
1
from __future__ import annotations import typing from collections import Counter def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> typing.Counter[int]: UpperCAmelCase_ : typing.Counter[int] = Counter() for base in range(1, max_perimeter + 1 ): ...
713
'''simple docstring''' import sys import turtle def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : tuple[float, float], SCREAMING_SNAKE_CASE__ : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCamelCase...
644
0
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, AutoModelForQuestionAnswering, ...
219
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __magic_name__ : Any = { """configuration_layoutlmv2""": ["""LAYOUTLMV2_PRETRAINED_CONFIG_...
615
0
"""simple docstring""" import argparse import os import re import packaging.version a_ = '''examples/''' a_ = { '''examples''': (re.compile(r'''^check_min_version\(\"[^\"]+\"\)\s*$''', re.MULTILINE), '''check_min_version(\"VERSION\")\n'''), '''init''': (re.compile(r'''^__version__\s+...
709
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING a_ = logging.get_logger(__name__) class __lowercase ( _UpperCAmelCase): """simple docstring""" ...
48
0
"""simple docstring""" from torch import nn def _snake_case ( snake_case__ : Union[str, Any] ): if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(F'Unsupported activation function: {act_f...
91
'''simple docstring''' from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, g...
400
0
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ , lowercase_ ) -> List[str]: """simple docstring""" A__ = { '''en''': '''Machine learning is...
177
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 f...
177
1
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_...
682
"""simple docstring""" import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.te...
682
1
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __a (UpperCamelCase_): '''simple docstring''' _SCREAMING_SNAKE_CASE :Optional[Any] = (EulerDiscre...
711
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .token...
12
0
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCAmelCase_ ( unittest.TestCa...
529
import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available __lowerCAmelCase : Dict = logging.getLogger(__name__) ...
529
1
'''simple docstring''' from __future__ import annotations from math import pi, sqrt def lowerCamelCase__ ( A : Union[str, Any] , A : Any ): '''simple docstring''' if inductance <= 0: raise ValueError('''Inductance cannot be 0 or negative''' ) ...
700
'''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...
50
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbo...
7
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def snake_case ( ) -> Generator[int, None, None]: lowerCamelCase : dict[int, int] = {} lowerCamelCase : str = 2 while True: lowerCamelCase ...
222
0
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": lowercase_ = input("Enter image url: ").strip() print(F'''Downloading image from {url} ...''') lowercase_ = BeautifulSoup(requests.get(url).content, "html.parser") # The ima...
390
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTR...
390
1
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
391
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, ...
231
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 _UpperCamelCase : Tuple = logging.get_l...
118
"""simple docstring""" import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import M...
118
1
'''simple docstring''' import sys from collections import defaultdict class a__ : def __init__( self : Optional[Any] ): """simple docstring""" __lowerCamelCase = [] def SCREAMING_SNAKE_CASE__ ( self : List[...
546
'''simple docstring''' import numpy as np def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ) -> str: __lowerCamelCase = int(np.ceil((x_end - xa) / h ) ) ...
546
1
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def _UpperCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , l...
719
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""", } class __lowercase ( __snake_case ):...
627
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffu...
22
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision fro...
598
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
714
'''simple docstring''' # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for t...
352
0
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _lowerCAmelCase ( snake_case_ , unittest.TestCase ): __UpperCAmelCase...
178
"""simple docstring""" __snake_case = """ABCDEFGHIJKLMNOPQRSTUVWXYZ""" def __lowerCAmelCase ( ) -> None: """simple docstring""" snake_case : str = input("Enter message: " ) snake_case : Tuple = input("Enter key [alphanumeric]: " ...
178
1
from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowerCAmelCase_ ( _a): def __init__( self : List[Any] , __A : i...
373
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
373
1
from __future__ import annotations def _lowercase ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) -> Dict: if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and array[indexa] < array...
410
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase : Optional[int] = logging.get_logger(__name__) lowerCAmelCase : List[Any] = { 'xlm-mlm-en-2048': 'https://hu...
511
0
import requests from bsa import BeautifulSoup def _UpperCAmelCase (UpperCamelCase_ : str = "https://www.worldometers.info/coronavirus" ): '''simple docstring''' _lowerCAmelCase : Optional[int] = BeautifulSoup(requests.get(UpperCamelCase_ ).text , """html....
710
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_comm...
196
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase : Tuple = logging.get_logger(__name__) _lowerCAmelCase : Optional[Any] = { ...
246
from collections import deque def a_ ( UpperCamelCase_ : List[str] ) -> Optional[Any]: """simple docstring""" lowerCamelCase = len(UpperCamelCase_ ) lowerCamelCase = deque() lowerCamelCase = [False for _ in range(UpperCamelCase_ )] ...
246
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimensi...
712
'''simple docstring''' def UpperCAmelCase ( UpperCAmelCase__ : int = 10_00): lowerCamelCase : Optional[Any] = 2**power lowerCamelCase : str = str(UpperCAmelCase__) lowerCamelCase : Union[str, Any] = list(UpperCAmelCase__) ...
449
0
'''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_CONF...
407
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case (...
407
1
'''simple docstring''' def __snake_case ( _UpperCAmelCase : int = 100): UpperCamelCase = n * (n + 1) * (2 * n + 1) / 6 UpperCamelCase = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares) if __name__ == "__main__": print(F'''{solution() = }''') ...
721
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __snake_case ( ): UpperCamelCase = ArgumentParser( description=( '''PyTorch TP...
350
0
import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBertForMaskedLM, DistilB...
226
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : Union[str, Any] = { 'configuration_vision_text_dual_encoder': ['VisionTextDualEncoderCon...
226
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { 'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json', # See all Donut models at https://hug...
142
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 UpperCamelCase_ = '\\n@misc{chen2021evaluating,\n title={Evaluating Large Language Models...
142
1