code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' def __snake_case ( _UpperCAmelCase : str): return credit_card_number.startswith(('''34''', '''35''', '''37''', '''4''', '''5''', '''6''')) def __snake_case ( _UpperCAmelCase : str): UpperCamelCase = credit_card_number UpperCamelC...
212
'''simple docstring''' def __snake_case ( _UpperCAmelCase : int): UpperCamelCase = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
212
1
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( _lowercase : dict , _lowercase : str ) -> str: __UpperCAmelCase, __UpperCAmelCase: Dict = set(snake_case__ ), [start] while stack: __UpperCAmelCase: int = stack.pop() ...
700
'''simple docstring''' import argparse import os import torch from transformers.utils import WEIGHTS_NAME SCREAMING_SNAKE_CASE_ = ['small', 'medium', 'large'] SCREAMING_SNAKE_CASE_ = 'lm_head.decoder.weight' SCREAMING_SNAKE_CASE_ = 'lm_head.weight' def UpperCamelCase__ ( _lowerc...
466
0
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCamelCase__ ( _UpperCAmelCase ): def __lt__(self : Union[str, Any] , snake_case_ : int ): return self[-1] < other[-1...
521
import numpy as np def __lowerCAmelCase ( _A ,_A ,_A = 1E-12 ,_A = 100 ,): """simple docstring""" assert np.shape(_A )[0] == np.shape(_A )[1] # Ensure proper dimensionality. assert np.shape(_A )[0] == np.shape(_A )[0] # Ensure inputs ...
398
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( OPENAI_CLIP_MEAN, OPENA...
108
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_to...
108
1
"""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 tensorflow as tf from transformers import AutoTokenizer,...
169
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( _a ): _a = (DDIMParallelScheduler,) _a = (('eta', 0.0), ('num_inference_steps', 50)) ...
169
1
"""simple docstring""" import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
595
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from t...
595
1
"""simple docstring""" def snake_case_ ( A_ : int = 1_00_00_00 ): '''simple docstring''' _lowerCamelCase : str = set(range(3, A_, 2 ) ) primes.add(2 ) for p in range(3, A_, 2 ): if p not in primes:...
83
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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.o...
685
0
'''simple docstring''' import os from distutils.util import strtobool def lowercase_ ( lowercase__ , lowercase__ ) ->Optional[Any]: for e in env_keys: _snake_case: List[str] = int(os.environ.get(lowercase__ , -1 ) ) if val >= 0...
721
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets A : Dict = '\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. ...
273
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig UpperCamelCase__ = { '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/config.json''', ''...
75
"""simple docstring""" def a__ ( ) -> list[list[int]]: return [list(range(1_0_0_0 - i , -1_0_0_0 - i , -1 ) ) for i in range(1_0_0_0 )] __A = generate_large_matrix() __A = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, ...
346
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A__ : Optional[int] = { "configuration_rag": ["RagConfig"], "retrieval_rag": ["RagRetriever"], "tokenization_rag": ["Ra...
718
'''simple docstring''' import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_...
124
0
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRu...
345
import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tens...
35
0
"""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_vid...
716
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def snake_case__ ( _snake_case : Dict ): """simple docstring""" for param in module.parameters(): UpperCamelCase__ = False def snake_case__ ( ):...
304
0
'''simple docstring''' from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a : """simple docstring""" __lowerCAmelCase = 42 __lowerCAmelCase = None...
523
'''simple docstring''' import argparse import json from tqdm import tqdm def UpperCamelCase__ ( ) -> Optional[Any]: __UpperCAmelCase: Dict = argparse.ArgumentParser() # Required parameters parser.add_argument( """--src_path""" , type=_lowercase , default...
523
1
"""simple docstring""" def lowerCamelCase__ ( __snake_case=2_81_23 ) -> Optional[int]: """simple docstring""" _UpperCamelCase = [1] * (limit + 1) for i in range(2, int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in...
78
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make...
78
1
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { 'vocab_file': 'vocab.json', 'me...
406
import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def lowercase__ ( __snake_case : Optional[Any] ): '''simple docstring''' if "model" in orig_key: UpperCAmelCase_ : Optional[int] = orig_key.replace('model....
406
1
"""simple docstring""" from __future__ import annotations def A_ ( __lowercase ): UpperCamelCase_ : List[Any] =0.00 UpperCamelCase_ : Dict =0 for resistor in resistors: if resistor <= 0: UpperCamelCase_ : List[str] =F'''Resistor at index {index} ha...
395
"""simple docstring""" def A_ ( __lowercase ): UpperCamelCase_ : List[str] ='' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def A_ ( __lowercase ): UpperCamelCase_ : int =[chr(i + 65 ...
395
1
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import ...
79
'''simple docstring''' import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.s...
495
0
import random def a_ ( lowerCAmelCase_ : Union[str, Any], lowerCAmelCase_ : Union[str, Any], lowerCAmelCase_ : Union[str, Any] ): __lowerCAmelCase = a[left_index] __lowerCAmelCase = left_index + 1 for j in range(left_index + 1, lowerCAmelCase_ ...
705
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, R...
421
0
'''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_distilbert import DistilBertTokenizer A__ : List[str] = logging.get_logger(...
13
'''simple docstring''' from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import...
664
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig snake_case__ = { '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/config.json''', '''albert-large-v1''': '''https://huggingfa...
719
import sys from collections import defaultdict class lowerCAmelCase_ : def __init__( self : Optional[int] ) ->Any: """simple docstring""" a__ :Optional[Any] = [] def _snake_case ( self : Optional[Any] , __A : ...
373
0
'''simple docstring''' def __snake_case ( SCREAMING_SNAKE_CASE_ : str ) -> Optional[int]: """simple docstring""" return "".join(chr(ord(snake_case__ ) - 32 ) if '''a''' <= char <= '''z''' else char for char in word ) if __name__ == "__main__": from doctest import testmo...
51
'''simple docstring''' def _A ( snake_case__ : list[int] , snake_case__ : list[int] ): snake_case__ : Tuple = len(snake_case__ ) print('''The following activities are selected:''' ) # The first activity is always selected snake_case__ : Optional[Any] ...
261
0
import torch from ..models.speechta import SpeechTaForTextToSpeech, SpeechTaHifiGan, SpeechTaProcessor from ..utils import is_datasets_available from .base import PipelineTool if is_datasets_available(): from datasets import load_dataset class a ( __lowerCAmelCase ): ...
704
def snake_case ( snake_case__ :int = 1_000_000) -> int: _A = set(range(3 , snake_case__ , 2)) primes.add(2) for p in range(3 , snake_case__ , 2): if p not in primes: continue primes.difference...
83
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedule...
554
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...
302
0
'''simple docstring''' import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.j...
162
'''simple docstring''' 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 ...
162
1
'''simple docstring''' import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class a__ ( a_ ): '''simple docstring''' def lowerCAmelCase ( self : Optional[int] , lowerCAmelCase_ : str ) -> Any: ...
186
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
186
1
'''simple docstring''' import collections import os import re from pathlib import Path __UpperCAmelCase = 'src/transformers' # Matches is_xxx_available() __UpperCAmelCase = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} __UpperCAmelCase = re.c...
717
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE ) class _a ( SCREAMING_SNAKE_CASE ): ...
220
0
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, E...
268
from PIL import Image def lowerCamelCase__ ( __A :Image ): """simple docstring""" __snake_case , __snake_case = image.size __snake_case = 0 __snake_case = image.load() for i in range(__A ): ...
268
1
"""simple docstring""" from __future__ import annotations import typing from collections.abc import Iterable import numpy as np lowercase__ : int = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 lowercase__ : Optional[Any] = typing.Union[np.fl...
485
"""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.commands.test import Te...
485
1
'''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.testing_ut...
384
'''simple docstring''' import warnings 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_...
384
1
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_available(): import...
704
from typing import List from .keymap import KEYMAP, get_character def _A ( _UpperCamelCase ): def decorator(_UpperCamelCase ): _UpperCAmelCase : Optional[int] = getattr(_UpperCamelCase , '''handle_key''' , [] ) handle += [key] setattr(_UpperCamelCase ,...
416
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transfo...
217
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer ...
217
1
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( _snake_case ): lowercase = ['image_processor', 'tokenizer'] lowercase = 'CLIPImageProcessor' lowercase = ('CLIPT...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase : Union[str, Any] = { '''configuration_table_transformer''': [ '''TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
46
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowe...
594
0
from __future__ import annotations import math def __a ( __UpperCAmelCase : int ) -> Dict: """simple docstring""" if num <= 0: lowerCamelCase_ : List[Any] = f"{num}: Invalid input, please enter a positive integer." raise ValueE...
705
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say that...
253
0
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
235
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore...
235
1
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, ...
713
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = { "configuration_time_series_transformer": [ "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimeSeriesTransformerConfig", ], } try: ...
54
0
'''simple docstring''' import logging import os import threading import time try: import warnings except ImportError: lowercase : Optional[Any] = None try: import msvcrt except ImportError: lowercase : Union[str, Any] = None try: ...
649
'''simple docstring''' def __a ( A__ = 1000 ) -> int: lowerCAmelCase = 3 lowerCAmelCase = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a a += 1 return result if __name__ == "__main__...
649
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ = { "configuration_mobilebert": [ "MOBILEBERT_PRETRAINED_CONFIG_ARCHIV...
715
def __lowerCAmelCase ( __SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' __snake_case : int = 1 __snake_case : Any = 2 while i * i <= n: __snake_case : Tuple = 0 while n % i == 0: n...
390
0
"""simple docstring""" from scipy.stats import pearsonr import datasets a_ = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption...
480
"""simple docstring""" from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __lowercase ( _UpperCAmelCase): """simple docst...
480
1
"""simple docstring""" import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTester...
31
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
31
1
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import O...
12
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeli...
585
0
"""simple docstring""" import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def UpperCamelCase ( UpperCAmelCase ) ->List[Tuple[int, ...]]: ...
712
"""simple docstring""" def UpperCamelCase ( UpperCAmelCase ) ->bool: """simple docstring""" a_ = 0 for ch in input_str: a_ = ord(UpperCAmelCase ) a_ = pow(2 , UpperCAmelCase ) # If we already turned on bit for current character's...
210
0
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params impo...
563
from __future__ import annotations from math import pow, sqrt def _A ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueErr...
563
1
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_bac...
643
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCAmelCase : Any = logging.get_logger(__name__) __UpperCAmelCase : int = "▁"...
643
1
import cmath import math def UpperCAmelCase__ ( __magic_name__ : float , __magic_name__ : float , __magic_name__ : float , __magic_name__ : float ): '''simple docstring''' lowerCAmelCase : Tuple = math.radians(_A ) lowerCAmelCase : int ...
348
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def UpperCamelCase__ ( _A: Tuple ): ...
479
0
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIFICATI...
682
# 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 required by applic...
682
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { "facebook/dpr-ctx_encoder-single-nq-base": ( "https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-ba...
41
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class _snake_case : '''simple docstring''' def ...
436
0
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def __UpperCamelCase ( _A ): lowerCAmelCase_ , lowerCAmelCase_ = analyze_text(_A ) lowerCAmelCase_ = list(''' ''' + ascii_lowercase ) ...
710
def __UpperCamelCase ( _A ): lowerCAmelCase_ = [int(_A ) for i in ip_va_address.split('''.''' ) if i.isdigit()] return len(_A ) == 4 and all(0 <= int(_A ) <= 254 for octet in octets ) if __name__ == "__main__": _A = input().strip() ...
325
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer UpperCAmelCase__ : int = logging.get_logger(__name__) ...
410
from statistics import mean, stdev def A ( _lowercase , _lowercase = 3 ): SCREAMING_SNAKE_CASE : int = min(_lowercase ) SCREAMING_SNAKE_CASE : Optional[Any] = max(_lowercase ) # normalize data return [round((x - x_min) / (...
248
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
441
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedClassifie...
441
1
from collections import deque def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> Union[str, Any]: snake_case__ = len(__lowerCAmelCase ) snake_case__ = deque() snake_case__ = [False for _ in range(__lowerCAmelCase )] snake_case__ = [-1 for _ in range(__...
33
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...
568
0
'''simple docstring''' import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger a : Optional[int] = get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( enum.Enum ): __SCREAMING_SNAKE_CASE ...
680
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : List[Any] = { ...
680
1
"""simple docstring""" def lowercase__(A ) ->list: """simple docstring""" if len(A ) <= 1: return lst lowercase__ : Any= 1 while i < len(A ): if lst[i - 1] <= lst[i]: i += 1 ...
218
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def lowercase__(A ) ->list[list[float]]: """simple docstring""" lowercase__ : str= Decimal # Check if the prov...
218
1
'''simple docstring''' import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class A ( unittest.TestCase ): '''simple docstring''' def a_ (self ) ...
399
'''simple docstring''' def __lowerCAmelCase ( snake_case__ ): return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(snake_case__ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''').testmod()
399
1
'''simple docstring''' def __lowerCAmelCase ( a_ ) -> Any: '''simple docstring''' SCREAMING_SNAKE_CASE : str = set() # To detect a back edge, keep track of vertices currently in the recursion stack SCREAMING_SNAKE_CA...
251
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : List[Any] = { "configuration_funnel": ["FUNNEL_PRETRAINED...
400
0
"""simple docstring""" def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : Dict , SCREAMING_SNAKE_CASE : Any ): '''simple docstring''' lowerCAmelCase = word.split() def justify(SCREAMING_SNAKE_CASE : Optional[Any] , SCREAMING_SNAKE_CASE : ...
718
"""simple docstring""" import os import sys import unittest SCREAMING_SNAKE_CASE__ = 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, ...
393
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { '''bert-base-uncased''': '''https://huggingface.co/b...
40
import math import random def UpperCamelCase ( snake_case__ : float , snake_case__ : bool = False ) -> float: if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value __UpperCAmelCase = 0.02 def UpperCamelCase ...
40
1
import cmath import math def snake_case__ ( lowerCAmelCase_, lowerCAmelCase_, lowerCAmelCase_, lowerCAmelCase_ ): """simple docstring""" SCREAMING_SNAKE_CASE =math.radians(SCREAMING_SNAKE_CASE_ ) SCREAMING_SNAKE_CASE =math.radians(SCREAMING_SNA...
703
import unittest import numpy as np from transformers import DistilBertConfig, 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(): import jax.numpy as jnp from transf...
252
0
"""simple docstring""" import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): imp...
516
'''simple docstring''' import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def __lowerCamelCase ( SCREAMING_SNAK...
421
0
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_available() an...
613
# 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 required by app...
613
1
"""simple docstring""" import re import string import numpy as np import datasets a__ : Dict = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ a__ : List[str] ...
589
"""simple docstring""" from string import ascii_uppercase a__ : Any = {char: i for i, char in enumerate(ascii_uppercase)} a__ : str = dict(enumerate(ascii_uppercase)) def A__ ( __lowerCamelCase, __lowerCamelCase ): """simple docstring"...
589
1
"""simple docstring""" import argparse import json from tqdm import tqdm def lowerCamelCase_( ) -> Any: '''simple docstring''' _lowerCamelCase : Dict = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=_l...
386
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import...
386
1
'''simple docstring''' import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() class ...
209
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAtte...
153
0
import unittest import numpy as np import requests 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_av...
495
def UpperCamelCase ( lowercase_ = 10_00 ) -> int: '''simple docstring''' return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
495
1
'''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,...
8
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __snake_case : list[int] , __snake_case : list[int] , __snake_case : int ) -> tuple[float, list[float]]: __A : int = list(range(len(__snake...
8
1
import os # Precomputes a list of the 100 first triangular numbers __lowerCamelCase = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def UpperCamelCase__ ( ) -> List[Any]: """simple docstring""" _a : Optional[Any] = os.path.dirname(os.path.realpa...
307
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWi...
307
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase__ = { """configuration_mvp""": ["""MVP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MvpConfig""", """MvpOnnxConfig"""], """tokenization_mvp""": ["""...
225
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase__ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: ...
225
1
'''simple docstring''' import operator def snake_case ( snake_case : list , snake_case : bool = False , snake_case : list | None = None ) -> list: """simple docstring""" lowerCAmelCase = operator.lt if reverse else operator.gt lowerCAmelCase = s...
719
'''simple docstring''' import torch def snake_case ( ) -> List[str]: """simple docstring""" if torch.cuda.is_available(): lowerCAmelCase = torch.cuda.device_count() else: lowerCAmelCase = 0 print(F'Successfully ran on {num_gpus} GPUs' ) if __...
514
0
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenizat...
642
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline __UpperCAmelCase = logging.get_logger(__name__) clas...
642
1
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( lowercase_ : str , lowercase_ : List[str] , lowercase_ : Tuple , lowercase_ : int ) -> List[str]: '''simple docstring''' lowercase =[] lowercase , lowerca...
714
'''simple docstring''' import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def UpperCamelCase ( lowercase_ : List[str] , lowercase_ : Optional[Any] , ...
145
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=lowerCAmelCase_ ): A_ = ["transformers", "torch", "note_seq"] def __init__( self , *__a , **__a ): '''simple docstring''' req...
476
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_...
476
1
'''simple docstring''' from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def a__ ( lowerCAmelCase__ = True , *lowerCAmelCase__ , **lowerCAmelCase__ ) -> Union[str, Any]: ...
312
'''simple docstring''' import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
312
1
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version ...
253
import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker from di...
253
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs i...
491
"""simple docstring""" def __snake_case ( SCREAMING_SNAKE_CASE: str ): """simple docstring""" _lowerCAmelCase = 0 # if input_string is "aba" than new_input_string become "a|b|a" _lowerCAmelCase = '' _lowerCAmelCase = '' ...
491
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _snake_case : Optional[int] = logging.get_logger(__na...
22
'''simple docstring''' from collections.abc import Generator from math import sin def snake_case_ (UpperCamelCase : bytes ): '''simple docstring''' if len(UpperCamelCase ) != 32: raise ValueError('''Input must be of length 32''' ) ...
22
1
"""simple docstring""" from collections.abc import Sequence from queue import Queue class a_ : def __init__( self : List[Any] , snake_case__ : Any , snake_case__ : Optional[int] , snake_case__ : Optional[int] , snake_case__ : ...
674
"""simple docstring""" import copy import os import cva import numpy as np from matplotlib import pyplot as plt class a_ : def __init__( self : Optional[int] ): lowerCAmelCase__ = """""" lowerCAmelCase__ = """""" lowerCAmelCase__ = [...
674
1
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea import ...
100
"""simple docstring""" import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline f...
589
0
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerFast f...
402
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __a: Optional[Any] = logging.get_logger(__name__) __a: str = { '''google/bit-50''': '''https://...
402
1
'''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, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandi...
78
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformer...
297
0
from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...toke...
700
# limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : Optional[Any] , __...
247
0
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCAmelCase ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" _lowerCamelCase = ['''image_processor''', '''to...
58
from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention, TFBaseMode...
652
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_...
514
'''simple docstring''' def snake_case ( snake_case : int ) -> Tuple: """simple docstring""" lowerCAmelCase = 0 lowerCAmelCase = len(snake_case ) for i in range(n - 1 ): for j in range(i + 1 , snake_case ): if arr[i] > arr[j]: ...
514
1
def lowerCamelCase__ ( _lowercase , _lowercase = " " ): '''simple docstring''' UpperCAmelCase_ : int = [] UpperCAmelCase_ : List[str] = 0 for index, char in enumerate(_UpperCamelCase ): if char == separator: split_words.append(strin...
30
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def lowerCamelCase ( ) -> Optional[int]: '''simple docstring''' __UpperCAmelCase : Any = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]"...
139
0
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np lowercase__ : Union[str, Any] = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 lowercase__ : Optional[Any] = typing.Union[np.floataa, int, float]...
139
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTe...
139
1
from __future__ import annotations def lowercase ( _lowerCAmelCase ): # preprocessing the first row for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first column for i in range(1 , len(_lowerCAmelCase ) ): matrix[i][0] ...
392
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": snake_case__ : Tuple = pd.read_csv('''sample_data.csv''', header=None) ...
392
1
_lowerCAmelCase : Union[str, Any] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" def UpperCAmelCase_ ( snake_case__ ) -> bytes: """simple docstring""" if not isinstance(snake_case__ , snake_case__ ): lowerCAmelCase__ ...
604
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeling...
604
1
"""simple docstring""" from __future__ import annotations class a : def __init__( self : Optional[int] , __lowerCAmelCase : list[list[int]] ): _UpperCAmelCase = TypeError( """Matrices must be formed from a list of zero or more lists containing at ""...
277
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDi...
277
1
_SCREAMING_SNAKE_CASE : Any = { '''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'...
472
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPanoramaPipeline, UNe...
472
1
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowercase_ ...
20
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split snake_case = datasets.load_iris() snake_case = np.array(data["""data"""]) snake_case = np.array(data["""target"""]) snake_case = data["""...
62
0
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDe...
701
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class snake_case__ : def __init__( self : Any ): '''simple docstring''' UpperCAmelCase : List[Any] = {} def __lowerCA...
292
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase_ = { 'configuration_xlm_roberta_xl': [ 'XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMRobertaXLConfig...
560
"""simple docstring""" import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
560
1
'''simple docstring''' import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin fr...
39
'''simple docstring''' import os import sys import unittest lowerCAmelCase : str = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_m...
39
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase :int = logging.get_logger(__name__) _lowerCAmelCase :Optional[Any] ...
251
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { '''vocab_file''': '''vocab.json''', '''merges_file''': '''merges.t...
276
0
'''simple docstring''' def _A ( _lowerCAmelCase = 1_000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
454
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCamelCase = {"""tokenization_bertweet""": ["""BertweetTokenizer"""]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys lowerCamelCase = _LazyModule(__name...
454
1
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__ : Any = logging.get_logger(__name__) UpperCamelCase__ : Any = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/van-base/blob/ma...
105
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
105
1
from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_pipeline_mixin...
488
# 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 required by ap...
488
1
"""simple docstring""" def SCREAMING_SNAKE_CASE ( _lowerCamelCase : int | float | str ) -> tuple[int, int]: try: _lowerCAmelCase : List[str] = float(_lowerCamelCase ) except ValueError: raise ValueError("""Please enter a valid number""" ) _lowerCAmelCase : int...
213
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. 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 ...
213
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medium/re...
589
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokeni...
589
1
'''simple docstring''' def _a( UpperCamelCase__ : list, UpperCamelCase__ : list, UpperCamelCase__ : int ): '''simple docstring''' if len(UpperCamelCase__ ) != len(UpperCamelCase__ ): raise ValueError('''The length o...
296
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_ima...
296
1
'''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 from tr...
672
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
1