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""" def lowercase ( _snake_case : int , _snake_case : int ) ->str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) __snake_case : Tuple = str(bin(_snake_case ) ...
102
from __future__ import annotations import numpy as np def a__ ( snake_case ): """simple docstring""" return np.maximum(0 , snake_case ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
303
0
"""simple docstring""" import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accelerate.util...
203
"""simple docstring""" import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_model...
203
1
"""simple docstring""" import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.nump...
40
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import i...
264
0
import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> List[Any]: '''simple docstring''' if "cls_token" in name: lowerCAmelCase ...
323
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
323
1
'''simple docstring''' # 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 ...
37
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxT...
313
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a ...
46
'''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_tenso...
46
1
"""simple docstring""" from __future__ import annotations def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): if days_between_payments <= 0: raise ValueError("days_between_payments must be > 0" ) if daily_interest_rate < 0: raise ValueError("daily_interest_rate mus...
61
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase ={ "configuration_time_series_transformer": [ "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimeSeriesTransforme...
67
0
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import Array...
371
from __future__ import annotations def A(__a: dict , __a: str ): lowerCAmelCase_ , lowerCAmelCase_ = set(__a ), [start] while stack: lowerCAmelCase_ = stack.pop() explored.add(__a ) # Differences from BFS: # 1) pop last element instead of firs...
22
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/co...
203
"""simple docstring""" import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBe...
203
1
"""simple docstring""" import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration lowercase__ = 50_0000 lowercase__ , lowercase__ = os.path.split(__file__) lowercase_...
12
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def __A ( lowerCamelCase_ ): """simple docstring""" if "cls_token" in name: SCREAMING_SNAKE_CASE :...
323
'''simple docstring''' # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..contr...
323
1
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger a_ = '<<<<<<< This should probably be modified because it mentions: ' a_ = '=======\n>>>>>>>\n' a_ = [ 'TextEncoderConfig'...
50
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTes...
50
1
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils...
46
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=_UpperCAmelCase ) class lowercase ( _UpperCAmelCase ): _SCREAMING_SNAKE_CASE = field(def...
46
1
"""simple docstring""" import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCamelCase__( a_ , unittest.TestCase ): lowerCAmelCase__ ...
350
"""simple docstring""" __lowerCamelCase = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" __lowerCamelCase = [{"type": "code", "content": INST...
154
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files" ,[ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "dataset_infos.json"], ...
312
'''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 ...
22
0
"""simple docstring""" # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position lowerCamelCase_ = '''2.13.1''' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version...
253
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase_ = logging.get_logger...
253
1
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration UpperCAmelCase_ = 500_000 UpperCAmelCase_ , UpperCAmelCase_ = os.path.split(__file__) UpperCAmelCase_ = os.path.join(RESULTS_BASEPATH, 'results', RESU...
12
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('>=', FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.checkpoint....
12
1
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def _lowerCamelCase ( lowerCamelCase_ : str , lowerCamelCase_ : List[str] , lowerCamelCase_ : int ): """simple docstring""" UpperCAmelCase_ :...
274
'''simple docstring''' def _lowerCamelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int ): """simple docstring""" return int(input_a == input_a == 0 ) def _lowerCamelCase ( ): """simple docstring""" print('Truth Table of NOR Gate:' ...
274
1
from __future__ import annotations class lowerCAmelCase : def __init__( self : str , UpperCAmelCase : int ) -> None: lowerCamelCase__ : int = data lowerCamelCase__ : Node | None = None lowerCamelCase__ : Node | None = Non...
50
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 from ...test_modeling_comm...
50
1
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class UpperCAmelCase__ : """simple docstring""" def __init__( self : Optional[int] ) -> Union[str, Any]: SCREAMING_SNAKE_CASE__ = '' SCREAMING_SNAKE_CASE__ = '' ...
350
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Any = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/ed...
218
0
'''simple docstring''' def _lowerCamelCase ( lowercase : bytes ) -> str: return "".join([hex(lowercase )[2:].zfill(2 ).upper() for byte in list(lowercase )] ) def _lowerCamelCase ( lowercase : str ) -> bytes: # Check data validity, fol...
63
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __A : Optional[Any] = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetConfig']} try: i...
154
0
import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin __A : Any = '▁' __A : Un...
367
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__": __A : Optional[int] = pd.read_csv('sample_data.csv', header=None) __A : Optional[Any] = ...
49
0
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMSchedule...
253
lowerCAmelCase : Optional[Any] = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' lowerCAmelCase ...
253
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tok...
263
"""simple docstring""" from __future__ import annotations from typing import Any def A ( snake_case :list ) -> int: if not postfix_notation: return 0 __UpperCamelCase = {'+', '-', '*', '/'} __UpperCamelCase = [] for token in postfix_notation: if token in operations...
263
1
def __lowerCamelCase ( __a :float , __a :float ) -> float: """simple docstring""" if mass < 0: raise ValueError("""The mass of a body cannot be negative""" ) return 0.5 * mass * abs(__a ) * abs(__a ) if __name__ == "__main__": im...
274
from math import ceil def __lowerCamelCase ( __a :int = 1_0_0_1 ) -> int: """simple docstring""" A__ = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): A__ = 2 * i + 1 A__ = 2 * i A__ =...
274
1
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": __lowerCamelCase : Optional[int] = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', default=None, typ...
204
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @require_sent...
204
1
import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def UpperCamelCase_( _snake_case : Dict , _snake_case...
218
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time _lowerCAmelCase : Optional[Any] = Lock() def UpperCamelCase_( _snake_case : List[str] , _snake_case : Optional[int] , _s...
218
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class a__ ( unittest.TestCase ): def ...
180
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : Any = logging.get_logger(__name__) lowercase__ : int = { "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json", ...
180
1
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _lowercase ( __UpperCAmelCase): """simple docstring""" A__ = '''''' A__ ...
184
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer __snake_case :str = logging.get_logger(__name__) __snake_case ...
49
0
import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffusers.uti...
367
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": _A : List[Any] =argparse.ArgumentParser() pars...
129
0
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tens...
263
"""simple docstring""" def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int ): if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase : List[str] = str(bin(UpperCamelCase__ ) ...
263
1
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_ :Tuple = { '''kssteven/ibert-roberta...
354
import itertools import math def A ( a_ ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not pri...
245
0
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def _SCREAMING_SNAKE_CASE ( lowercase : np.ndarray , lowercase : np.ndarray , lowercase : np.ndarray , lowercase : int , lowercase : int ): ...
204
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : Optional[Any] = { "configuration_whisper": ["WHISPER_PR...
204
1
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_util...
354
"""simple docstring""" import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.mode...
144
0
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-g...
180
from math import isqrt def snake_case ( snake_case__ :int) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(snake_case__) + 1)) def snake_case ( snake_case__ :int = 10**6) -> int: _A = 0 _A = 1 ...
180
1
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ = logging.get_logger(__name__) A_ = { '''huggingface/informer-tourism-monthly''': ( '''https://huggingf...
362
"""simple docstring""" import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py A_ ...
296
0
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _UpperCamelCase ( __A , __A , __A = 1 / sqrt(2 ) ) -> IIRFilter: '''simple docstring''' UpperCamelCase__ = tau * frequency / ...
80
def lowerCAmelCase__ ( ): '''simple docstring''' lowerCAmelCase__ : Optional[int] = [] lowerCAmelCase__ : List[str] = 1 while len(lowerCamelCase_) < 1E6: constant.append(str(lowerCamelCase_)) i += 1 lowerCAmelCase__ : ...
129
0
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowercase: str = logging.get_logger(__name__) ...
31
'''simple docstring''' from __future__ import annotations def SCREAMING_SNAKE_CASE__( _UpperCamelCase : int | float | str , _UpperCamelCase : int | float | str ) -> list[str]: '''simple docstring''' if nth_term == "": return [""] ...
31
1
'''simple docstring''' from manim import * class snake_case ( lowercase ): """simple docstring""" def snake_case ( self ): """simple docstring""" lowerCamelCase_ = Rectangle(height=0.5 , width=0.5 ) lowerCamelCase_...
55
from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def __lowercase ( _A , _A ...
245
0
'''simple docstring''' import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class __lowercase : '''simple...
217
'''simple docstring''' import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX...
217
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE__ = { 'configuration_transfo_xl': ['TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TransfoXLConfig'], 'tokenization...
150
"""simple docstring""" from sklearn.metrics import fa_score import datasets A__ : List[str] = '\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n' A__ : List[Any] = ...
144
0
from string import ascii_uppercase UpperCamelCase = {char: i for i, char in enumerate(ascii_uppercase)} UpperCamelCase = dict(enumerate(ascii_uppercase)) def __lowerCamelCase ( snake_case__ ,snake_case__ ) -> str: """simple docstring""" ...
125
UpperCamelCase = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} UpperCamelCase = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def __lowerCamelCase ( snake_case__ ,snake_case__ ,snake_case__ ) -> list[int]: """simple docstring""" ...
125
1
'''simple docstring''' import math def snake_case_ ( __SCREAMING_SNAKE_CASE : int ): """simple docstring""" if not isinstance(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ): lowercase_ : Union[str, Any] = ...
93
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
296
0
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
1
'''simple docstring''' def UpperCamelCase_ ( _UpperCAmelCase : list , _UpperCAmelCase : int = 0 ) -> list: """simple docstring""" _UpperCAmelCase : str = length or len(_UpperCAmelCase ) _UpperCAmelCase : Tuple = ...
31
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCamelCase_ ( _UpperCAmelCase : di...
31
1
import math from collections.abc import Iterator from itertools import takewhile def lowerCAmelCase_ ( _lowercase : int) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 ...
368
from __future__ import annotations def lowerCAmelCase_ ( _lowercase : float , _lowercase : float , _lowercase : float , ) -> tuple[str, float]: """simple docstring""" if (stress, tangential_force, area).count(0)...
266
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://hu...
217
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { "SenseTime/deformable-detr": "https://huggingface.co/sensetime/deformable-detr/r...
217
1
"""simple docstring""" import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, ...
128
"""simple docstring""" from ...processing_utils import ProcessorMixin class _a ( _lowerCAmelCase ): UpperCamelCase = ['''image_processor''', '''feature_extractor'''] UpperCamelCase = '''TvltImageProcessor''' UpperCamelCase = '''TvltFe...
128
1
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version im...
125
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartFor...
125
1
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class A ( UpperCAmelCase_ ): def lowercase_ (self : int , __UpperCAmelCase : str ) -> str: """simple docstring""" ...
143
from __future__ import annotations import unittest from transformers import DistilBertConfig, 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, random_attention_m...
143
1
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block @...
88
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class UpperCAmelCase_ ( unittest.TestCase ): '''simple docstring''' def ...
88
1
from collections import deque from .hash_table import HashTable class A ( A_ ): def __init__(self , *lowerCAmelCase , **lowerCAmelCase ): super().__init__(*lowerCAmelCase , **lowerCAmelCase ) def _A (self , lowerCAmelCase , lowerCAmel...
304
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig lowerCAmelCase = { '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/config.json''', '''albert-large-v1''': '''https://huggingface...
304
1
"""simple docstring""" from __future__ import annotations class a : """simple docstring""" def __init__( self: int , UpperCamelCase: List[Any]=None ): """simple docstring""" A__ = data A__ = ...
335
"""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_image_inputs i...
266
0
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_av...
230
"""simple docstring""" SCREAMING_SNAKE_CASE = "Alexander Joslin" import operator as op from .stack import Stack def _SCREAMING_SNAKE_CASE ( lowercase_ ) -> int: A__ = {"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub} A__ = Stack() A__ = Stack() for i in...
230
1
from __future__ import annotations UpperCAmelCase : Union[str, Any] ={ """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], ...
128
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils...
128
1
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configurat...
356
"""simple docstring""" import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( ...
234
0
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert.tokenization...
143
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand lowerCAmelCase__ : str = ( '''4S 3H 2C 7S 5H''', '''9D 8H 2C 6S 7H''', '''2D 6D 9D TH 7D''', '''TC 8C 2S JH 6C''', '''JH 8S TH AH QH''', '''TS KS 5S 9S ...
143
1
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __lowerCamelCase ( lowerCamelCase__ : np.ndarray , lowerCamelCase__ : np.ndarray ): '''simple docstring''' return math.sqrt(sum(pow(a - b , 2 ) for...
66
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin Upper...
66
1
'''simple docstring''' import tensorflow as tf from ...tf_utils import shape_list class snake_case__ ( tf.keras.layers.Layer): def __init__( self : Dict , _A : Dict , _A : str , _A : Optional[int] , _A : Union...
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
"""simple docstring""" from __future__ import annotations from math import pi def snake_case_ ( lowerCAmelCase_ : float , lowerCAmelCase_ : float , lowerCAmelCase_ : float ): if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("""O...
371
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) lowerCamelCase : str = { '''facebook/nllb-moe-54B''': '''https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json''', } class ...
306
0
from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_chann...
230
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging A__ = logging.get_logger(__name__) ...
230
1
def __A ( __lowerCamelCase = 5000_0000 ) -> int: a = set() a = int((limit - 24) ** (1 / 2) ) a = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in range(3 , prime_square_limit + 1 ...
347
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase : Optional[Any] = { "configuration_wav2vec2": ["WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP...
347
1
class _A : def __init__( self : str , __SCREAMING_SNAKE_CASE : List[str] , __SCREAMING_SNAKE_CASE : Dict , __SCREAMING_SNAKE_CASE : int): '''simple docstring''' __a = None __a =...
49
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
0
'''simple docstring''' from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {'''vocab_file...
52
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rando...
52
1
"""simple docstring""" 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...
66
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_d...
66
1
from __future__ import annotations import math def __lowerCamelCase ( __lowerCAmelCase : int ) -> list[int]: if num <= 0: snake_case = F'''{num}: Invalid input, please enter a positive integer.''' raise ValueError(a__ ) snake_ca...
359
'''simple docstring''' import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common...
3
0
from __future__ import annotations import math def _a ( a :Dict ) -> list[int]: if num <= 0: a = F"""{num}: Invalid input, please enter a positive integer.""" raise ValueError(snake_case__ ) a = [True] * (num + 1) a = [] a = ...
0
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils im...
306
0
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __magic_name__ ( _UpperCamelCase ): lowerCAmelCase : List[Any] = ['image_processor', 'tokenizer'] lowerCAmelCas...
356
'''simple docstring''' def __lowerCamelCase ( lowerCAmelCase_ ) -> list: if any(not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) or x < 0 for x in sequence ): raise TypeError('Sequence must be list of non-negative integers' ) for _ in range(len(lowerCAmelCase_ ) ): ...
107
0
"""simple docstring""" def _a ( _SCREAMING_SNAKE_CASE = 50_000_000 ) -> int: snake_case_ = set() snake_case_ = int((limit - 24) ** (1 / 2) ) snake_case_ = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in rang...
347
"""simple docstring""" import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import Flax...
347
1
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __U...
161
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase__ ...
161
1
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_atten...
52
import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceF...
52
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase : Union[str, Any] ={ '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], ...
196
from __future__ import annotations def SCREAMING_SNAKE_CASE ( __lowerCAmelCase , __lowerCAmelCase ) -> list[int]: UpperCamelCase__ : Optional[Any] = 0 UpperCamelCase__ : Any = len(__lowerCAmelCase ) - 1 while i < ...
196
1
"""simple docstring""" # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 ...
54
'''simple docstring''' import os import sys import unittest lowercase : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E40...
3
0
'''simple docstring''' import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowercase__ ( lowercase , unittest.TestCase ): lowercase__ = ...
236
'''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 snak...
236
1
"""simple docstring""" def UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ) ->int: """simple docstring""" def get_matched_characters(UpperCAmelCase , UpperCAmelCase ) -> str: a_ = [] a_ = min(len(_stra ) , len(_stra ) ) // 2 ...
243
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) __lowerCAmelCase : str = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class snake_case__ (_Up...
107
0
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": __UpperCAmelCase = input('''Enter image url: ''').strip() print(f"""Downloading image from {url} ...""") __UpperCAmelCase = BeautifulSoup(requests.get(url).content, '''html.parser''...
42
from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class lowerCamelCase__ ( _a , _a ): @register_to_config def __init__( self : str , _a : ...
42
1
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_see...
161
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a__ : List[Any] = { "configuration_vision_text_dual_encoder": ["Vis...
161
1
'''simple docstring''' import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A : List[str] ={ '''facebook/mask2former-swin-small-coco-instance'''...
129
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) _A : str ={ '''sample_size''': 32, '''in_channels''': 3, '''out_channels'...
129
1
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class __a ( __UpperCamelCase ): def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ ) -> Any: '''simple docstring''' lowercase__: Any = ...
196
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_available(): from...
196
1
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn ...
345
'''simple docstring''' from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils im...
345
1
from __future__ import annotations def UpperCAmelCase__ ( lowerCamelCase ): if len(lowerCamelCase ) == 0: return array lowercase , lowercase :Optional[Any] = min(lowerCamelCase ), max(lowerCamelCase ) # Compute the variables lowercase :Optional[int] ...
236
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Tuple = { "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json", "susnato/ernie-m-large_pytorch": "https://huggingfa...
236
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase : str = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], """con...
148
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 UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) def _A ( SCREAMING_SNAKE_CASE :...
148
1
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class __UpperCAmelCase ( ctypes.Structure ): # _fields is a specific attr expected by ctypes __l...
42
'''simple docstring''' from __future__ import annotations import string from itertools import cycle, product from pathlib import Path lowercase : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) lowercase : list[int] = [ord(letter)...
42
1
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _A ( UpperCamelCase_ : list[list[float]]) -> list[list[float]]: '''simple docstring''' __lowercase = Decimal # Check if the provided matrix has 2 rows a...
144
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowerCAmelCase ( lowercase ): """simple docstring""" def __init__( self : List[str], UpperCAmelCase__ ...
144
1
def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' lowerCAmelCase__ : Optional[int] = int(lowerCamelCase_) if decimal in (0, 1): # Exit cases for the recursion return str(lowerCamelCase_) lowerCAmelCase__ , lowerCAmelCase__ : ...
129
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline __snake_case : Dict =logging.get_logger(__name__) ...
129
1
"""simple docstring""" import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMixin class snake_case_( a__ , a__ ): __UpperCame...
361
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case__ : Tuple = { '''configuration_maskformer''': ['''MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MaskFormerCon...
314
0
import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 # Here to h...
345
import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_model...
345
1
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline A : Any = logging.get_logger(__name_...
369
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
0
"""simple docstring""" from collections import Counter from timeit import timeit def UpperCamelCase__ ( lowercase__ : str = "" , ): return sum(c % 2 for c in Counter(input_str.replace(" " , "" ).lower() ).values() ) < 2 def UpperCamelCase__ ...
148
"""simple docstring""" import sys from collections import defaultdict class lowerCamelCase__ : def __init__( self ): """simple docstring""" snake_case : Dict = [] def lowerCamelCase_ ( self , SCREAMING_SNAKE_CASE ):...
148
1
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_common import ...
353
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() and ...
121
0
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def _snake_case ( ) -> Optional[Any]: lowerCamelCase_ : Tuple =ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) lowerCamelCase_...
144
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def _snake_case ( lowerCamelCase__ : T...
144
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 _a : Any = logging.get_logger(__name__) _a : Dict = {"""vocab_file""": """vocab....
363
'''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_tenso...
46
0
"""simple docstring""" import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ...
69
import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, BertTokenizerFast, CT...
314
0
"""simple docstring""" from __future__ import annotations def UpperCAmelCase_ (_lowerCAmelCase : list[float] ): if len(UpperCAmelCase__ ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i in nums ): raise...
371
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging lowercase : Optional[int] = ...
171
0
def _a ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ): return base * power(_UpperCAmelCase , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("""Raise base to the power of exponent using recursion...""") Up...
92
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A__: str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Optional...
276
0
import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_pytesseract...
360
import inspect import unittest from transformers import DecisionTransformerConfig, 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 i...
63
0
def a__ ( UpperCAmelCase : Optional[Any] = 1_000_000 ) -> int: UpperCAmelCase : Dict = limit + 1 UpperCAmelCase : List[Any] = [0] * limit for first_term in range(1 , UpperCAmelCase ): for n in range(UpperCAmelCase , UpperCAmelCase , UpperCAmelCase...
336
UpperCAmelCase__ : Optional[Any] = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def lowerCamelCase__ ( a , a , a ) -> list[str]: _A: Union[str, Any] ...
121
0
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class _lowerCAmelCase : def __init__(self ): A_ : Dict = {} def _a (self , lowercase , lowercase , lowercase=1 ): ...
135
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationT...
135
1
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig...
79
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=_UpperCAmelCase ) class lowercase ( _UpperCAmelCase ): _SCREAMING_SNAKE_CASE = field(def...
46
0
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib _SCREAMING_SNAKE_CASE...
88
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
1