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 lowerCAmelCase_ ( snake_case_ ): if not isinstance(snake_case_,snake_case_ ): _A : Any = f'''Input value of [number={number}] must be an integer''' raise TypeError(snake_case_ ) if number < 0: ...
365
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowerCAmelCase_ ( snake_case_ ...
343
0
import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowercase ( UpperCamelCase__,unittest.TestCase ): _a = PhobertTokenizer _...
366
from __future__ import annotations from collections.abc import Callable _snake_case = list[list[float | int]] def lowerCAmelCase_ ( snake_case_,snake_case_ ): _A : int = len(snake_case_ ) _A : Matrix = [[0 for _ in range(size + 1 ...
343
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...fe...
367
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _snake_case = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def lowerCAmelCase_ ( snake_case_ = "mumbai" ): _A : Optional[Any] = ...
343
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = "▁" _snake_case = {"vocab_file": "se...
368
from __future__ import annotations from decimal import Decimal from numpy import array def lowerCAmelCase_ ( snake_case_ ): _A : Tuple = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation only works for 2x2 mat...
343
0
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preproc...
369
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor impo...
343
0
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, ...
370
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCAmelCase_ ( snake_case_,snake_case_=None ): _A : Any = None if token is not None: _A : ...
343
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = { "configuration_git": ["GIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GitConfig", "GitVisionConfig"], "processing_git": ["GitProcessor"], } try: if not is_torch_available(): ...
371
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase ( unittest.TestCase ): def a__ ( self ) -> List[str]: debug_launcher(test_script.main ) ...
343
0
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging _snak...
350
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _snake...
343
0
from __future__ import annotations def lowerCAmelCase_ ( snake_case_,snake_case_ = None,snake_case_ = None ): if start is None: _A : List[str] = 0 if end is None: _A : List[str] = len(snake_case_ ) - 1 if ...
351
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( snake_case_,snake_case_ ): # Load checkp...
343
0
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_list_of_images, to_numpy_array, vali...
352
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 lowercase (...
343
0
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoi...
353
from random import randint from tempfile import TemporaryFile import numpy as np def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_ ): _A : Tuple = 0 if start < end: _A : Tuple = randint(snake_case_,snake_case_ ) ...
343
0
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _snake_case = logging.getLogger() def lowerCAmelCase_ ...
354
from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { "MIT/ast-finetuned-audioset-10-10-0.4593": ( "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json" ), } class ...
343
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = { "configuration_mctct": ["MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MCTCTConfig"], "feature_extraction_mctct": ["MCTCTFeatureExtractor"], "processing_mctct": ["MCTCTPro...
355
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _snake_case = logging.getLogger() def lowerCAmelCase_ ...
343
0
def lowerCAmelCase_ ( snake_case_,snake_case_ ): _A : int = len(snake_case_ ) _A : str = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed by not taking any element ...
356
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_...
343
0
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 import AudioPipelineOutpu...
357
def lowerCAmelCase_ ( snake_case_ = 1000 ): _A : List[Any] = 3 _A : Tuple = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a a += 1 ...
343
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _snake_case = { "configuration_blenderbot_small": [ "BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARC...
358
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...t...
343
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { "MIT/ast-finetuned-audioset-10-10-0.4593": ( "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json" ), } class ...
359
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _snake_case = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], "tokenization_roc_bert": ["RoCBertTokenizer"], } try: ...
343
0
"""simple docstring""" from __future__ import annotations _snake_case = list[tuple[int, int]] _snake_case = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, ...
360
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( ...
343
0
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 ja...
361
# 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 # # Unless required by...
343
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case = { "configuration_owlvit": [ "OWLVIT_PRETRAINED_CONFI...
362
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _snake_case = logging.get_logger(__name__) _snake_case = {"voc...
343
0
_snake_case = 8.3_1_4_4_6_2 # Unit - J mol-1 K-1 def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_ ): if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid inputs. Enter positive value.""" ) return moles * kelvin * UNIVERSAL_GAS_CONSTANT / vol...
363
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as ort...
343
0
def lowerCAmelCase_ ( ): return [ a * b * (1000 - a - b) for a in range(1,999 ) for b in range(snake_case_,999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print(f"""{solution() = }""")
364
from __future__ import annotations def lowerCAmelCase_ ( snake_case_ ): create_state_space_tree(snake_case_,[],0,[0 for i in range(len(snake_case_ ) )] ) def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_,snake_case_,): if index == len(snake...
343
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_d...
365
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowerCAmelCase_ ( snake_case_ ...
343
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DUM...
366
from __future__ import annotations from collections.abc import Callable _snake_case = list[list[float | int]] def lowerCAmelCase_ ( snake_case_,snake_case_ ): _A : int = len(snake_case_ ) _A : Matrix = [[0 for _ in range(size + 1 ...
343
0
def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_,snake_case_ ): global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: _A : List[str] = mf_knapsack(i - 1,snake_case_,snake_case_,snake_case_ ) else: _A : List[st...
367
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _snake_case = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def lowerCAmelCase_ ( snake_case_ = "mumbai" ): _A : Optional[Any] = ...
343
0
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.numpy as jnp from jax import jit from transformer...
368
from __future__ import annotations from decimal import Decimal from numpy import array def lowerCAmelCase_ ( snake_case_ ): _A : Tuple = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation only works for 2x2 mat...
343
0
"""simple docstring""" import numpy as np class lowercase : def __init__( self ) -> Optional[int]: _A : List[str] = (0, 0) _A : Union[str, Any] = None _A : Optional[Any] = 0 ...
369
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor impo...
343
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _snake_case = logging.get_logger(__name__) class lowercase ( UpperCamelCase__ ): def __init__( self , *_a , **_a ) -> None: warnings.warn( ...
370
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCAmelCase_ ( snake_case_,snake_case_=None ): _A : Any = None if token is not None: _A : ...
343
0
import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTokenizer, JumanppTokeni...
371
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase ( unittest.TestCase ): def a__ ( self ) -> List[str]: debug_launcher(test_script.main ) ...
343
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils import logging logging...
350
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _snake...
343
0
import numpy as np def lowerCAmelCase_ ( snake_case_ ): return 1 / (1 + np.exp(-vector )) def lowerCAmelCase_ ( snake_case_ ): return vector * sigmoid(snake_case_ ) if __name__ == "__main__": import doctest doctest.testmod()
351
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( snake_case_,snake_case_ ): # Load checkp...
343
0
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DD...
352
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 lowercase (...
343
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...t...
353
from random import randint from tempfile import TemporaryFile import numpy as np def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_ ): _A : Tuple = 0 if start < end: _A : Tuple = randint(snake_case_,snake_case_ ) ...
343
0
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _snake_case = logging.get_logger(__name__) _snake_case = OrderedDict( [ # Base model mapping ...
354
from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { "MIT/ast-finetuned-audioset-10-10-0.4593": ( "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json" ), } class ...
343
0
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def lowerCAmelCase_ ( snake_case_ ): # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikipedia.org/wiki/CJK_Unified_Ideograph...
355
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _snake_case = logging.getLogger() def lowerCAmelCase_ ...
343
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase ( unittest.TestCase ): def a__ ( self ) -> List[str]: debug_launcher(test_script.main ) ...
356
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_...
343
0
from __future__ import annotations from collections.abc import Callable _snake_case = list[list[float | int]] def lowerCAmelCase_ ( snake_case_,snake_case_ ): _A : int = len(snake_case_ ) _A : Matrix = [[0 for _ in range(size + 1 ...
357
def lowerCAmelCase_ ( snake_case_ = 1000 ): _A : List[Any] = 3 _A : Tuple = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a a += 1 ...
343
0
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCAmelCase_ ( snake_case_,snake_case_=None ): _A : Any = None if token is not None: _A : ...
358
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...t...
343
0
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_ ): # Initialise PyTorch mode...
359
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _snake_case = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], "tokenization_roc_bert": ["RoCBertTokenizer"], } try: ...
343
0
"""simple docstring""" import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_...
360
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( ...
343
0
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifi...
361
# 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 # # Unless required by...
343
0
def lowerCAmelCase_ ( snake_case_,snake_case_ ): if len(snake_case_ ) != len(snake_case_ ): raise ValueError("""String lengths must match!""" ) _A : str = 0 for chara, chara in zip(snake_case_,snake_case_ ): if chara !=...
362
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _snake_case = logging.get_logger(__name__) _snake_case = {"voc...
343
0
def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_ ): def update_area_of_max_square(snake_case_,snake_case_ ) -> int: # BASE CASE if row >= rows or col >= cols: return 0 _A : Tuple = update_area_of_max_square(sn...
363
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as ort...
343
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _snake...
364
from __future__ import annotations def lowerCAmelCase_ ( snake_case_ ): create_state_space_tree(snake_case_,[],0,[0 for i in range(len(snake_case_ ) )] ) def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_,snake_case_,): if index == len(snake...
343
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor _snake_case = logging.get_logger(__name__) class lowercase ( UpperCamelCase__ ): def __init__( self , *_a , **_a ) -> None: ...
365
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowerCAmelCase_ ( snake_case_ ...
343
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 fro...
366
from __future__ import annotations from collections.abc import Callable _snake_case = list[list[float | int]] def lowerCAmelCase_ ( snake_case_,snake_case_ ): _A : int = len(snake_case_ ) _A : Matrix = [[0 for _ in range(size + 1 ...
343
0
def lowerCAmelCase_ ( snake_case_,snake_case_ = " " ): _A : List[Any] = [] _A : Optional[Any] = 0 for index, char in enumerate(snake_case_ ): if char == separator: split_words.append(string[last_index:index] ) _A : str...
367
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _snake_case = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def lowerCAmelCase_ ( snake_case_ = "mumbai" ): _A : Optional[Any] = ...
343
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig _snake_case = logging.get_logger(__name__) _snake_case = { "Intel/dpt-large": "https://huggingface.co/Intel/dpt-large/resolve/main/config.json", # See all DPT models at https://hug...
368
from __future__ import annotations from decimal import Decimal from numpy import array def lowerCAmelCase_ ( snake_case_ ): _A : Tuple = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation only works for 2x2 mat...
343
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( snake_case_,snake_case_ ): _A : int = sorted(numsa + numsa ) _A : Optional[int] = divmod(len(snake_case_ ),2 ) if mod == 1: re...
369
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor impo...
343
0
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent _snake_case = {"UserAgent": UserAgent().random} def lowerCAmelCase_ ( snake_case_ ): _A : Tuple = script.contents[0] _A ...
370
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCAmelCase_ ( snake_case_,snake_case_=None ): _A : Any = None if token is not None: _A : ...
343
0
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowercase ( UpperCamelCase__ ): """simple docstring""" _a = "M-CLIP" def __init__( self , _a=1024 , _a=768 , **_a ) -> Optio...
371
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase ( unittest.TestCase ): def a__ ( self ) -> List[str]: debug_launcher(test_script.main ) ...
343
0
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin UpperCamelCase_ = get_tests_dir("fixtures/te...
344
def A ( __UpperCAmelCase = 100_0000 ) -> int: '''simple docstring''' UpperCAmelCase_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 ...
344
1
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json" ), } ...
344
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : List[Any] =(PNDMScheduler,) UpperCamelCase__ : Optional[Any] =(("num_inference_steps", 50),) ...
344
1
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class a_ ( _snake_case ): UpperCamelCase__ : Tuple ="EncodecFeatureExtractor" UpperCamelCase__ : List[Any] =("T5Tokenizer", "T5To...
344
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast from ..ut...
344
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_available(): raise...
344
from ..utils import DummyObject, requires_backends class a_ ( metaclass=_snake_case ): UpperCamelCase__ : Any =["torch", "scipy"] def __init__( self :List[str] , *_lowercase :List[str] , **_lowercase :Union[str, Any]) -> List[Any]: ...
344
1
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase_ = { "facebook/mask2former-swin-small-coco-instance": ( "https://huggingface.co/facebook/mask2former-swin-sm...
344
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def A ( __UpperCAmelCase ) -> Dict[str, torch.Tensor]: '''simple docstring''' UpperCAmelCase_ = [] UpperC...
344
1
def A ( __UpperCAmelCase ) -> bool: '''simple docstring''' if not all(x.isalpha() for x in string ): raise ValueError('''String must only contain alphabetic characters.''' ) UpperCAmelCase_ = sorted(string.lower() ) return len(__...
344
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
344
1
def A ( __UpperCAmelCase ) -> bool: '''simple docstring''' return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print("Program to check whether a number is a Perfect number or not...") UpperCamelC...
344
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = {"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OPTConfig"]} t...
344
1
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class a_ ( _snake_case ): def __lt__( self :Any , _lowercase :List[Any]) -> List[Any]: return self[-1] < other[-...
344
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin UpperCa...
344
1
def A ( __UpperCAmelCase ) -> Dict: '''simple docstring''' stooge(__UpperCAmelCase , 0 , len(__UpperCAmelCase ) - 1 ) return arr def A ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> List[str]: '''si...
344
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path UpperCamelCase_ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) UpperCamelCase_ = [ord(letter) for letter in string.ascii_lowercase] UpperCam...
344
1
UpperCamelCase_ = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def A ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
344
import pytest UpperCamelCase_ = "__dummy_dataset1__" UpperCamelCase_ = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \"validation\": RE...
344
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } try: ...
344
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } class a_ ( _snake_case ): ...
344
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class a_ ( _snake_case ): UpperCamelCase__ : Any ="Wav2...
344
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : Optiona...
344
1
UpperCamelCase_ = { "joule": 1.0, "kilojoule": 1_000, "megajoule": 1_000_000, "gigajoule": 1_000_000_000, "wattsecond": 1.0, "watthour": 3_600, "kilowatthour": 3_600_000, "newtonmeter": 1.0, "calorie_nutr": 4_186.8, "kilocalorie_nutr": 4_186_800.00, "electronvo...
344
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_utils import require_...
344
1
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class a_ ( _snake_case ): def __init__( self :int , _lowercase :Dict , _lowercase :List[str]=None ...
344
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, B...
344
1
import string from math import logaa def A ( __UpperCAmelCase , __UpperCAmelCase ) -> int: '''simple docstring''' UpperCAmelCase_ = document.translate( str.maketrans('''''' , '''''' , string.punctuation ) ).replace('''\n'''...
344
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 UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "facebook/lev...
344
1
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin UpperCamelCase_ = get_tests_dir("fixtures/test_sentencepiece_with_bytefallback.mo...
344
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def A ( __UpperCAmelCase , __UpperCAmelCase=() , __UpperCAmelCase=None , __UpperCAmelCase="no" , __...
344
1
import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def A ( ) -> Any: '''simple docstring''' raise RuntimeError('''CUDA out of memory.''' ) c...
344
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, ge...
344
1
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as...
344
import functools def A ( __UpperCAmelCase , __UpperCAmelCase ) -> int: '''simple docstring''' UpperCAmelCase_ = len(__UpperCAmelCase ) UpperCAmelCase_ = len(__UpperCAmelCase ) @functools.cache def min_distance(_...
344
1
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. UpperCamelCase_ = 10 def A ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __Upp...
344
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 UpperCamelCase_ = logging.get_logger(__name__) Upp...
344
1
def A ( __UpperCAmelCase , __UpperCAmelCase ) -> str: '''simple docstring''' print('''\nThe shortest path matrix using Floyd Warshall algorithm\n''' ) for i in range(__UpperCAmelCase ): for j in range(__UpperCAmelCase ): if dis...
344
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) class a_ ( _snake_case , _snake_case ): UpperCam...
344
1
from math import sqrt def A ( __UpperCAmelCase = 100_0000 ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 UpperCAmelCase_ = 42 while num_cuboids <= limit: max_cuboid_size +=...
344
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 ...
344
1
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_...
344
import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_i...
344
1
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( ...
344
def A ( __UpperCAmelCase = 100_0000 ) -> int: '''simple docstring''' UpperCAmelCase_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 ...
344
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = {"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OPTConfig"]} t...
344
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : List[Any] =(PNDMScheduler,) UpperCamelCase__ : Optional[Any] =(("num_inference_steps", 50),) ...
344
1
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node UpperCamelCase_ = 4 UpperCamelCase_ = 3 class a_ ( _snake_case ): pass...
344
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast from ..ut...
344
1
import unittest import torch from torch import nn from diffusers.models.activations import get_activation class a_ ( unittest.TestCase ): def __a ( self :Optional[Any]) -> Dict: UpperCAmelCase_ = get_activation('''swish''') self.assertI...
344
from ..utils import DummyObject, requires_backends class a_ ( metaclass=_snake_case ): UpperCamelCase__ : Any =["torch", "scipy"] def __init__( self :List[str] , *_lowercase :List[str] , **_lowercase :Union[str, Any]) -> List[Any]: ...
344
1
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Effic...
344
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def A ( __UpperCAmelCase ) -> Dict[str, torch.Tensor]: '''simple docstring''' UpperCAmelCase_ = [] UpperC...
344
1
import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = r"\n Args:\n input_ids (`torch.LongTensor` of sh...
344
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
344
1
import os from pathlib import Path def A ( ) -> List[str]: '''simple docstring''' from torch.utils.cpp_extension import load UpperCAmelCase_ = Path(__UpperCAmelCase ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' UpperCAm...
344
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = {"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OPTConfig"]} t...
344
1
from __future__ import annotations import pandas as pd def A ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: '''simple docstring''' UpperCAmelCase_ = [0] * no_of_processes UpperCAmelCase_ = [0] * no_o...
344
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin UpperCa...
344
1
from __future__ import annotations from random import choice def A ( __UpperCAmelCase ) -> Union[str, Any]: '''simple docstring''' return choice(__UpperCAmelCase ) def A ( __UpperCAmelCase , __UpperCAmelCase ) -> int: '''simple docst...
344
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path UpperCamelCase_ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) UpperCamelCase_ = [ord(letter) for letter in string.ascii_lowercase] UpperCam...
344
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase_ = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", "AltCLIPTextConfig", ...
344
import pytest UpperCamelCase_ = "__dummy_dataset1__" UpperCamelCase_ = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \"validation\": RE...
344
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_attenti...
344
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } class a_ ( _snake_case ): ...
344
1
def A ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: UpperCAmelCase_ = _modexpt(__UpperCAmelCase , exponent // 2 , __...
344
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : Optiona...
344
1
from math import factorial def A ( __UpperCAmelCase = 100 ) -> int: '''simple docstring''' return sum(map(__UpperCAmelCase , str(factorial(__UpperCAmelCase ) ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").strip...
344
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_utils import require_...
344
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, ...
344
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, B...
344
1
import itertools import string from collections.abc import Generator, Iterable def A ( __UpperCAmelCase , __UpperCAmelCase ) -> Generator[tuple[str, ...], None, None]: '''simple docstring''' UpperCAmelCase_ = iter(__UpperCAmelCase ) while True...
344
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 UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "facebook/lev...
344
1
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : List[Any] =(PNDMScheduler,) UpperCamelCase__ : Optional[Any] =(("num_inference_steps", 50),) ...
344
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def A ( __UpperCAmelCase , __UpperCAmelCase=() , __UpperCAmelCase=None , __UpperCAmelCase="no" , __...
344
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = { "configuration_bert": ["BERT_PRETRAI...
344
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, ge...
344
1
UpperCamelCase_ = "0.18.2" from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, ...
344
import functools def A ( __UpperCAmelCase , __UpperCAmelCase ) -> int: '''simple docstring''' UpperCAmelCase_ = len(__UpperCAmelCase ) UpperCAmelCase_ = len(__UpperCAmelCase ) @functools.cache def min_distance(_...
344
1
from math import factorial def A ( __UpperCAmelCase = 100 ) -> int: '''simple docstring''' return sum(int(__UpperCAmelCase ) for x in str(factorial(__UpperCAmelCase ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").stri...
344
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 UpperCamelCase_ = logging.get_logger(__name__) Upp...
344
1
from collections.abc import Sequence def A ( __UpperCAmelCase , __UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(__UpperCAmelCase ) ) def A ( __UpperCAmelCase , __UpperCAmelCase ) -> flo...
344
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) class a_ ( _snake_case , _snake_case ): UpperCam...
344
1
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseScheduler, DP...
344
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 ...
344
1
import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def A ( __UpperCAmelCase , __UpperCAmelCase ) -> Optional[Any]: ...
344
import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_i...
344
1
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) ...
344
def A ( __UpperCAmelCase = 100_0000 ) -> int: '''simple docstring''' UpperCAmelCase_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 ...
344
1
import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_comm...
344
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class a_ ( _snake_case ): UpperCamelCase__ : List[Any] =(PNDMScheduler,) UpperCamelCase__ : Optional[Any] =(("num_inference_steps", 50),) ...
344
1
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, ge...
344
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast from ..ut...
344
1
import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_i...
344
from ..utils import DummyObject, requires_backends class a_ ( metaclass=_snake_case ): UpperCamelCase__ : Any =["torch", "scipy"] def __init__( self :List[str] , *_lowercase :List[str] , **_lowercase :Union[str, Any]) -> List[Any]: ...
344
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class a_ ( _snake_case , unittest.TestCase ): Uppe...
344
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def A ( __UpperCAmelCase ) -> Dict[str, torch.Tensor]: '''simple docstring''' UpperCAmelCase_ = [] UpperC...
344
1