code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase (...
266
"""simple docstring""" import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): imp...
266
1
"""simple docstring""" import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def lowerCAmel...
85
"""simple docstring""" from queue import PriorityQueue from typing import Any import numpy as np def lowerCAmelCase (__UpperCamelCase : dict , __UpperCamelCase : str , __UpperCamelCase : set , __UpperCamelCase : set , __UpperCamelCase : dict , __UpperCamelCase ...
85
1
"""simple docstring""" def SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 50 ) -> Dict: _lowerCAmelCase : Dict = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 ,5 ): for tile_start in range...
44
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast UpperCAmelCase : Union[str, Any] = datasets.utils.logging.get_logger(__name__) @dataclass class __low...
252
0
import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline __A = version.parse(version.parse(torch.__version__).base_ve...
360
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
0
'''simple docstring''' 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(): ...
206
import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() lowerCamelCase : Any = logging.get_...
124
0
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTeste...
366
lowerCamelCase : Optional[int] ={ '''A''': ['''B''', '''C''', '''E'''], '''B''': ['''A''', '''D''', '''E'''], '''C''': ['''A''', '''F''', '''G'''], '''D''': ['''B'''], '''E''': ['''A''', '''B''', '''D'''], '''F''': ['''C'''], '''G''': ['''C'''], } ...
196
0
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _lowerCAmelCase : Tuple = logging.get_logger(...
218
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Tuple = logging.get_logger(__name__) _lowerCAmelCase : Union[str, Any] = {"ctrl": "https://huggingface.co/ctrl/resolve/main/config.json"} class __magic_name__ ( lo...
218
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants _lowerCamelCase : Union[str, Any] = 300 # TEMPERATURE (unit = K) def __lowerCamelCase ( A__ , A__ , A__ , ) -> float: ...
249
'''simple docstring''' import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE ( _a ): """simple docstring""" _SCREAMING_SNAKE_CASE = (UnCLIPScheduler,) def A ( ...
249
1
import pickle import numpy as np from matplotlib import pyplot as plt class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase=0.2 , _lowerCamelCase=0.2 ): a :T...
94
UpperCAmelCase__ = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''': '''-.''',...
5
0
'''simple docstring''' def __snake_case( _lowerCAmelCase ) -> tuple[int, int]: try: snake_case__ : Any = float(_lowerCAmelCase ) except ValueError: raise ValueError("""Please enter a valid number""" ) snake_case__ : int = deci...
43
'''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_torch...
43
1
"""simple docstring""" def _snake_case ( UpperCamelCase : List[Any] , UpperCamelCase : Any ): return int((input_a, input_a).count(1 ) != 0 ) def _snake_case ( ): assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(...
109
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase__ : List[str] = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, Any] = { 'xl...
121
0
import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassification, MobileViTVaForSe...
354
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ = logging.get_logger(__name__) def __magic_name__ ( __a : Optional[int] ): '''simple docstring''' ...
178
0
"""simple docstring""" from __future__ import annotations import math def UpperCAmelCase ( UpperCAmelCase ) -> list[int]: if num <= 0: snake_case_ = f'{num}: Invalid input, please enter a positive integer.' raise ValueError(UpperCAmelCase ) ...
69
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
0
"""simple docstring""" 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() cl...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
'''simple docstring''' _SCREAMING_SNAKE_CASE : str = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7....
85
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": _SCREAMING_SNAKE_CASE : Optional[int] = argparse.ArgumentParser() parser.add_a...
85
1
def _lowerCamelCase( lowercase__ ) -> str: '''simple docstring''' __lowercase= 0 # if input_string is "aba" than new_input_string become "a|b|a" __lowercase= '' __lowercase= '' # append each character + "|" in new_string for range(0, length-1) for i in input_s...
304
from math import factorial, radians def _lowerCamelCase( lowercase__ , lowercase__ = 1_8 , lowercase__ = 1_0 ) -> float: '''simple docstring''' __lowercase= angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from degrees to radians __l...
304
1
def a__ ( A_, A_ ): '''simple docstring''' if digit_amount > 0: return round(number - int(A_ ), A_ ) return number - int(A_ ) if __name__ == "__main__": print(decimal_isolate(1.53, 0)) print(decimal_isolate(35.345, 1)) print(deci...
88
from __future__ import annotations import inspect import unittest from transformers import ViTConfig 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_common import ConfigTester...
273
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase : Dict = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['GitPr...
186
"""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_...
186
1
import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffusers.utils.testing_utils import...
278
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __lowerCAmelCase = logging.get_logger(__name__) def snake_case_ ( snake_case , snake_ca...
196
0
from timeit import timeit def SCREAMING_SNAKE_CASE__( _UpperCamelCase : int ) -> Union[str, Any]: '''simple docstring''' if number < 0: raise ValueError("the value of input must not be negative" ) UpperCamelCase__ = 0 while number: ...
370
'''simple docstring''' from __future__ import annotations def SCREAMING_SNAKE_CASE__( _UpperCamelCase : Dict , _UpperCamelCase : str , _UpperCamelCase : Optional[int] , _UpperCamelCase : str ) -> Dict: # noqa: E741 '''simple docstri...
31
0
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # all files ~60KB. A...
307
from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase : int = logging.get_logger(__name__) __UpperCamelCase : List[Any] = { """tanreinama/GPTSAN-2.8B-spout_is_uniform""": ( """https://huggingface.co/tanreinama...
307
1
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py snake_case__ : int = '''src/transformers''' # This is to make su...
314
"""simple docstring""" def _snake_case ( _snake_case : int = 50000000 ): lowerCAmelCase : List[str] = set() lowerCAmelCase : List[Any] = int((limit - 24) ** (1 / 2) ) lowerCAmelCase : Optional[int] = set(range(3 , prime_square_limit + 1 , ...
314
1
# 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 applicabl...
43
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging __lowercase = logging.get_logger(__name__) def lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' __UpperCamelCase ...
43
1
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def lowerCamelCase_ ( lowerCAmelCase: str , lowerCAmelCase: complex , lowerCAmelCase: str = "x" , lowerCAmelCase: float = 10**-10 , lowerCAmelCase: int = 1 , )...
260
import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowerCAmelCase_ = logging.getLogger() @unittest.skip("""Temporarily disable the doc tests.""" ...
260
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> bool: 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 n...
23
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCamelCase_ ( ...
178
0
'''simple docstring''' from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance A_ : List[Any] = 6_3_7_8_1_3_7.0 A_ : Dict = 6_3_5_6_7_5_2.3_1_4_2_4_5 A_ : int = 6_3_7_8_1_3_7 def ...
360
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowercase ( _lowerCamelCase ): """simple docstring""" de...
349
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acce...
13
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase_ = { 'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'VisionEncoderDecoderOnnxConfi...
12
0
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
93
# Copyright 2021 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 require...
93
1
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokeni...
304
'''simple docstring''' import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you shou...
304
1
def _a ( a :list ) -> list: if len(a ) <= 1: return lst a = 1 while i < len(a ): if lst[i - 1] <= lst[i]: i += 1 else: a , a = lst[i], lst[i - 1] i -= 1 if i == 0: a = 1 return lst if __name__ == "__main_...
26
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase_ ( lowercase ): '''simple docstring''' __snake_case = ['''image_processor''', '''tokenizer'''] __...
26
1
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Huggin...
186
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GEN...
186
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision ...
242
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_a...
242
1
"""simple docstring""" import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {'''vocab_...
108
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable __SCREAMING_SNAKE_CASE : Optional[int] = {"""configuration_gpt_neox""": ["""GPT_NEOX_PRETRAINED_CONFIG_ARCH...
31
0
def SCREAMING_SNAKE_CASE_ ( __A : list[int] ) -> list[int]: """simple docstring""" a_ : List[str] = len(__A ) for i in range(__A ): for j in range(i + 1 , __A ): if numbers[j] < numbers[i]: ...
120
from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function UpperCAmelCase_ : str = 1.054571817e-34 # unit of ℏ : J * s UpperCAmelCase_ : Dict = 3e8 # unit of c : m * s^-1 def SCR...
120
1
import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py _SCREAMING_SNAKE_CASE : Dict = '''src/transformers''' # This is to make sure the transformers module i...
314
from __future__ import annotations def UpperCAmelCase_ ( _A , _A = None ): '''simple docstring''' SCREAMING_SNAKE_CASE__ = word_bank or [] # create a table SCREAMING_SNAKE_CASE__ = len(_A ) + 1 SCREAMING_SNAKE_CASE__ = [] for _ in range(...
314
1
"""simple docstring""" def _snake_case ( lowerCamelCase__ : list[list[int]] , lowerCamelCase__ : int , lowerCamelCase__ : int , lowerCamelCase__ : list[int] ) -> bool: # 1. Validate that path exists between current and next vertices ...
209
"""simple docstring""" import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline A__ : int = { 'n_samples': 64, 'horizon': 32, 'num_inference_steps': 20, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use value network 's...
209
1
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCAmelCase : List[Any] = logging.get_logger(__name__) # pylint: disable=invalid-name class __lowercase ( a_...
252
import json import pathlib import unittest import numpy as np 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 ImageProcessingSavingTestMixin, prepare_image_inputs if is_t...
252
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType UpperCamelCase__ = ...
102
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": UpperCamelCase__ = argparse.ArgumentParser() parser.add_argument( """--checkpoint_path""", default=None, type=str, required=True, ...
102
1
import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_metric from .utils imp...
36
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def lowerCAmelCase__ ( *a__: str , a__: Optional[Union[Dict, Any]] = None , a__: Dict=True , a__: Any=2 ) -> Union[str, Any]: '''simple docstring''' from .. ...
329
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProcessor, BlipImagePr...
273
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" lowerCamelCase__: int =("dense.weight", "attention.self.query"...
273
1
'''simple docstring''' def snake_case_ ( __SCREAMING_SNAKE_CASE : str , __SCREAMING_SNAKE_CASE : list[str] ): """simple docstring""" lowercase_ : List[str] = '''''' for word_or_phrase in separated: ...
93
'''simple docstring''' import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class lowerCAmelCase__ : lowerCAmelCase_ = None def _snake_case ( self ): """simple docst...
93
1
"""simple docstring""" import re def lowerCamelCase_( _lowerCamelCase ) -> str: '''simple docstring''' if len(re.findall("[ATCG]" , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError("Invalid Strand" ) return dna.translate(dna.maketrans("ATCG...
361
"""simple docstring""" def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase ) -> float: '''simple docstring''' _validate_point(_lowerCamelCase ) _validate_point(_lowerCamelCase ) if len(_lowerCamelCase ) != len(_lowerCamelCase ): raise ValueError("Both poin...
340
0
from __future__ import annotations import typing from collections import Counter def lowerCAmelCase_ ( snake_case_ ): _A : typing.Counter[int] = Counter() for base in range(1,max_perimeter + 1 ): for perpendicular in range(snake_case_,max_perimeter +...
26
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() _snake_case = logging.get_logger(__name__) _snake_case = [ ["attention", "attn"], ["encoder_atten...
26
1
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def UpperCAmelCase_ ( __lowercase : str , __lowercase : str = "cpu" , __lowercase : Union[str, None] = None ) -> None: '''simple docstring''' ...
156
'''simple docstring''' from __future__ import annotations from typing import TypedDict class A_ ( lowerCAmelCase_ ): _lowerCamelCase : str _lowerCamelCase : int def UpperCAmelCase_ ( __lowercase : str ) -> list[str]: '''simple docstring''' i...
156
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 diffusers.pipel...
242
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
242
1
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils i...
323
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import...
323
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_sing...
120
'''simple docstring''' import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class __snake_case ( _SCREAMING_SNAKE_CASE): """simple docstring""" lowercase = (IPNDMSchedul...
120
1
def UpperCAmelCase_ ( __UpperCAmelCase : Tuple , __UpperCAmelCase : List[str] ) -> List[Any]: # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) SCREAMING_SNAKE_CASE_ = (boundary[1] - boundary[0]) / steps SCREAM...
210
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transfo...
210
1
_a = 65_521 def lowerCAmelCase__(__snake_case ) -> int: '''simple docstring''' lowerCamelCase__ = 1 lowerCamelCase__ = 0 for plain_chr in plain_text: lowerCamelCase__ = (a + ord(__snake_case )) % MOD_ADLER lowerCamelCase__ = ...
209
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class __A ( lowerCAmelCase ): '''simple docstring''' lowerCAmelCase_ = """Speech2TextFeatureExtractor""" lowerCAmelCase_ = """Speech2TextTokenizer...
209
1
'''simple docstring''' import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPText...
240
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, S...
240
1
"""simple docstring""" def lowercase ( _snake_case : int ) ->list: """simple docstring""" if bit_count < 0: raise ValueError('''The given input must be positive''' ) # get the generated string sequence __snake_case : int = gray_code_sequence_string(_snake_ca...
102
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER...
102
1
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , 2 ...
276
# 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 r...
276
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Any = logging.get_logger(__name__) a__ : int = { 'microsoft/trocr-base-handwritten': ( 'https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main...
349
'''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_ten...
349
1
from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE (metaclass=UpperCAmelCase ): _UpperCamelCase : str = ['torch', 'torchsde'] def __init__( self : List[Any] , *a : Any , **a : Any )-> Union[str, Any]...
269
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 lowercase_ = logging.get_logger(__name__) lowercase_ = {"""...
269
1
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def A_ ( _lowercase ): '''simple docstring''' ...
66
"""simple docstring""" def lowercase__ ( _UpperCAmelCase , _UpperCAmelCase ) -> bool: '''simple docstring''' lowercase : Optional[int] = len(_UpperCAmelCase ) + 1 lowercase : Any = len(_UpperCAmelCase ) + 1 # dp i...
255
0
import numpy as np from transformers import Pipeline def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> int: lowerCamelCase__ : List[str] = np.max(a__ , axis=-1 , keepdims=a__ ) lowerCamelCase__ : int = np.exp(outputs - maxes ) return shifted_exp ...
370
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class lowerCAmelCase ( pl.LightningModule ): def __init__( self : List[str] , UpperCAmelCase : Optional[Any] ) ...
45
0
import datasets __lowerCAmelCase : Optional[int] = "\\n@InProceedings{conneau2018xnli,\n author = \"Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk,...
156
def UpperCAmelCase_ ( __lowerCAmelCase ) -> int: if not isinstance(__lowerCAmelCase , __lowerCAmelCase ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) __lowercase : List[str] = 0 while number: # This way we arrive at n...
156
1
def _a ( lowerCamelCase: int = 1_00 ) -> int: '''simple docstring''' __A = 0 __A = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints*...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) snake_case__ : Tuple = { 'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_C...
250
0
'''simple docstring''' from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDif...
323
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase__ ( lowercase_ ): """simple docstring""" SCREAMING_SNAKE_CASE__ = (CMStochasticIterativeScheduler,) SC...
323
1
from __future__ import annotations from typing import Any def _snake_case( SCREAMING_SNAKE_CASE__ : list ) -> int: '''simple docstring''' if not postfix_notation: return 0 A__ = {'+', '-', '*', '/'} A__ = [...
282
def _snake_case( SCREAMING_SNAKE_CASE__ : int = 1000 ) -> int: '''simple docstring''' A__ = 3 A__ = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: res...
282
1
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 __a : List[Any] = logging.get_logger(__name__) __a : Optional[int] = { """hustvl/y...
210
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : List[Any] = logging.getLogger(__name__) def UpperCAmelCase ( ): """simple docstring""" __lowercase = argparse.ArgumentParser( ...
210
1
import os import sys import unittest __UpperCAmelCase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dum...
352
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionSchedu...
145
0
"""simple docstring""" from PIL import Image def _snake_case ( lowercase__ : Image , lowercase__ : float ) -> Image: '''simple docstring''' def brightness(lowercase__ : int ) -> float: return 1_2_8 + level + (c - 1_2_8) if n...
84
'''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 lowerCAmelCase : Dict ...
223
0
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home snake_case_ = HUGGINGFACE_HUB_CACHE snake_case_ = """config.json""" snake_case_ = """diffusion_pytorch_model.bin""" snake_case_ = """diffusion_flax_mode...
181
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: snake_case_ = None try: import msvcrt except ImportError: snake_case_ = None try: import fcntl except ImportError: snake_case_...
181
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : str = { "configuration_wav2vec2": ["WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Wav2Vec2Config"],...
94
import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class __lowerCAmelCase ( datasets.BuilderConfig): _a = None class __lowerCAmel...
236
0
'''simple docstring''' from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test...
368
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'vocab_file': 'vocab.json', 'merg...
222
0
'''simple docstring''' import argparse import json import subprocess def _A ( snake_case , snake_case ) -> Tuple: _lowercase : int = [] _lowercase : Union[str, Any] = ( F'''curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer {...
250
'''simple docstring''' import argparse import os import re _snake_case = 'src/transformers' # Pattern that looks at the indentation in a line. _snake_case = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. _snake_case = re.compile(r'^\s*"([^"]+)":') # Pattern that m...
250
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
43
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load...
43
1
"""simple docstring""" def __lowerCAmelCase (_UpperCamelCase = 1000 ): __lowerCAmelCase , __lowerCAmelCase : Optional[int] = 1, 1 __lowerCAmelCase : int = 2 while True: __lowerCAmelCase : Optional[int] = 0 __lowerCAmelCase : L...
86
"""simple docstring""" from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowercase ( lowerCAmelCase__ : Namespace ) -> Tuple: return ConvertCommand( args.model_type , args.tf_checkpoint ...
45
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers...
358
'''simple docstring''' import pytest lowerCAmelCase_ = "__dummy_dataset1__" lowerCAmelCase_ = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", ...
332
0
'''simple docstring''' import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline _lowerCamelCase : ...
28
'''simple docstring''' from math import factorial def _A ( snake_case , snake_case ) -> int: # If either of the conditions are true, the function is being asked # to calculate a factorial of a negative number, which is not possible if n < k or k < 0: raise ValueError("Please ...
250
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_i...
48
'''simple docstring''' from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging l...
48
1
import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ) if is_flax_available()...
282
from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def a_ ( __lowercase : Sequence[float] , __lowercase : int , __lowercase : int ) -> tuple[int | None, int | None, float]: ...
282
1
UpperCAmelCase_ : Optional[int] = [0, 2, 4, 6, 8] UpperCAmelCase_ : List[Any] = [1, 3, 5, 7, 9] def SCREAMING_SNAKE_CASE_ ( __A : int , __A : int , __A : list[int] , __A : int ) -> int: """simple docstring""" ...
120
import json import sys def SCREAMING_SNAKE_CASE_ ( __A : Optional[Any] , __A : List[str] ) -> Tuple: """simple docstring""" with open(__A , encoding='utf-8' ) as f: a_ : Union[str, Any] = json.load(__A ) ...
120
1
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaS...
109
'''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 ....
145
0
'''simple docstring''' def __UpperCamelCase ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase ): return round(float(moles / volume ) * nfactor ) def __UpperCamelCase ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase ): return round(float((moles * 0.0_821 * temperat...
371
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ : Dict = logging.get_logger(__name__) lowerCAmelCase__ : int = { "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json", "g...
37
0
'''simple docstring''' import re from filelock import FileLock try: import nltk UpperCamelCase__ = True except (ImportError, ModuleNotFoundError): UpperCamelCase__ = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', qu...
181
'''simple docstring''' import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict UpperCamelCase__ = namedtuple( '''_Te...
181
1
A_ : Tuple = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> list[str]: UpperCam...
352
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggi...
292
0
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _lowerCamelCase : int = (720, 1280) # Height, Width _lowerCamelCase : List[str] = (0.4, 0.6) # if height or width lower tha...
28
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : Union[str, Any] = { "configuration_instructblip": [ "INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "InstructBlipConfig", "InstructBlipQFor...
222
0
from graphs.minimum_spanning_tree_kruskal import kruskal def __magic_name__ ( ) -> Union[str, Any]: __lowerCamelCase = 9 __lowerCamelCase = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2, 8, 2], [8, 6, ...
339
from __future__ import annotations def __magic_name__ ( __lowerCAmelCase : list[int] ) -> bool: return len(set(__lowerCAmelCase ) ) == len(__lowerCAmelCase ) if __name__ == "__main__": import doctest doctest.testmod()
339
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...utils im...
43
def lowerCamelCase ( SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 1_000 ): '''simple docstring''' __UpperCamelCase :Union[str, Any] = 1 __UpperCamelCase :Any = 0 for divide_by_number in range(SCREAMING_SNAKE_CASE , digit + 1 ): __UpperCamelCase :list[i...
43
1
'''simple docstring''' from math import factorial def SCREAMING_SNAKE_CASE_ (UpperCamelCase = 20 ) -> int: lowerCamelCase__ : List[str] = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... lowerCamelCas...
129
'''simple docstring''' import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentPar...
129
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __a :Any = {'configuration_vit_mae': ['VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMAEConfig']} try: ...
312
"""simple docstring""" _lowercase : Any = '\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https:/...
332
0
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin lowerCAmelCase__ = get_tests_dir('''fixtures/test_sentence...
360
"""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, BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(_...
244
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ : Union[str, Any] = logging.get_logger(__name__) SCREAM...
48
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ : List[Any] = {'processing_layoutxlm'...
48
1
'''simple docstring''' class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase = "" , _UpperCAmelCase = False): '''simple docstring''' __A : dict[str, RadixNode] = {} # A node will be a le...
357
'''simple docstring''' from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER,...
190
0
'''simple docstring''' from __future__ import annotations def UpperCamelCase_ ( A__ : list[int] , A__ : int ): '''simple docstring''' if len(A__ ) < k or k < 0: raise ValueError("""Invalid Input""" ) lowerCAmelCase_ : ...
120
'''simple docstring''' def UpperCamelCase_ ( A__ : list[list[float]] ): '''simple docstring''' lowerCAmelCase_ : list[list[float]] = [] for data in source_data: for i, el in enumerate(A__ ): if len(A__ ) < i + 1: data_lists...
120
1
'''simple docstring''' import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import Bat...
350
'''simple docstring''' from __future__ import annotations from typing import Any def __a ( _UpperCamelCase: list[Any] ) -> None: """simple docstring""" create_state_space_tree(_UpperCamelCase , [] , 0 ) def __a ( _UpperCamelCase: ...
142
0
def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ ) -> List[str]: """simple docstring""" return round(float(moles / volume ) * nfactor ) def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ ) -> Any:...
14
'''simple docstring''' from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_availab...
37
0
"""simple docstring""" from __future__ import annotations import typing from collections.abc import Iterable import numpy as np __UpperCamelCase : Optional[Any] = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 __UpperCamelCase : List[Any] = typing.Union[n...
368
"""simple docstring""" from __future__ import annotations import math __UpperCamelCase : Dict = '''2020.9.26''' __UpperCamelCase : Tuple = '''xcodz-dot, cclaus, dhruvmanila''' def __SCREAMING_SNAKE_CASE ( A_ , A_ , A_ , A_ , A_ ): if n...
74
0
from __future__ import annotations import requests _SCREAMING_SNAKE_CASE : Dict = set( "approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_cat...
127
"""simple docstring""" import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class _UpperCAmelCase : UpperCamelCase = None def lowerCamelCase ( self :List[Any] ): A = self.feature_extraction_...
292
0
'''simple docstring''' import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase : int = { """facebook/mask2former-swin-small-coco-instance""": ( """htt...
370
'''simple docstring''' from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( snake_case : int | float | str , snake_case : int | float | str ) -> list[str]: """simple docstring""" if nth_term == "": return [""] a : ...
345
0
from graphs.minimum_spanning_tree_kruskal import kruskal def A ( ) -> Any: '''simple docstring''' _UpperCAmelCase = 9 _UpperCAmelCase = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2, 8, 2], [8, 6, 6...
339
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def A ( _UpperCAmelCase : str , _UpperCAmelCase : Any , _UpperCAmelCase : List[str] , _UpperCAmelCase : Optional[int]=5 ) -> List[Any]: '''simple docstring''' ...
339
1
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets....
365
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase__ : str ={'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']} t...
118
0
from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def lowerCAmelCase__ ( lowerCamelCase_ : float ,lowerCamelCase_ : float ,lowerCamelCase_ : bool = False): '''simple docstring''' if radian_mode: ...
129
def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : Any = [0] * len(lowerCamelCase_) for i in range(1 ,len(lowerCamelCase_)): # use last results for better performance - dynamic programming lowerCAmelCase__ ...
129
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : str = logging.get_logger(__name__) A_ : Tuple = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/...
316
"""simple docstring""" print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = '...
244
from __future__ import annotations import inspect import unittest from transformers import ViTConfig 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_common import ConfigTester from...
244
1
"""simple docstring""" from sklearn.metrics import recall_score import datasets _a : Tuple = '\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives and FN ...
126
"""simple docstring""" import socket def SCREAMING_SNAKE_CASE ( ) -> str: _lowerCAmelCase : Optional[int] = socket.socket(socket.AF_INET ,socket.SOCK_STREAM ) _lowerCAmelCase : Optional[int] = socket.gethostname() _lowerCAmelCase : Tuple ...
126
1
'''simple docstring''' from typing import List import numpy as np def _lowerCAmelCase ( _UpperCamelCase : dict ) -> int: """simple docstring""" _SCREAMING_SNAKE_CASE ={key: len(_UpperCamelCase ) for key, value in gen_kwargs.items() if isinstance(_UpperC...
47
'''simple docstring''' from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.c...
190
0
import pprint import requests _lowerCamelCase : Dict = '''https://zenquotes.io/api''' def __lowerCamelCase (): return requests.get(API_ENDPOINT_URL + "/today" ).json() def __lowerCamelCase (): return requests.get(API_ENDPOINT_URL + "/random" ...
206
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer _lowerCamelCase : Optional[Any] = logging.get_logger(__name__) _lowerCamelCase : Any = {'...
206
1