code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor __UpperCamelCase = logging.get_logger(__name__) class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' de...
357
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __UpperCamelCase = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxCon...
38
0
"""simple docstring""" from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import ...
358
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils i...
38
0
"""simple docstring""" from __future__ import annotations from math import pi def lowercase (SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float ) -> dict[str, float]: if (inductance, frequency, react...
359
"""simple docstring""" import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __UpperCamelCase = models.Se...
38
0
import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class lowerCAmelCase ( ctypes.Structure ): '''simple docstring''' SCREAMING_SNAKE_CASE_ : List[Any] = [("""size""...
360
"""simple docstring""" class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ ) -> None: SCREAMING_SNAKE_CASE = size SCREAMING_SNAKE_CASE = [0] * size SCREAMING_SNAKE_CAS...
38
0
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # noqa:...
361
"""simple docstring""" from collections import deque from .hash_table import HashTable class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' def __init__( self , *lowerCAmelCase__ , **lowerCAmelCase__ ) -> Dict: super()...
38
0
"""simple docstring""" from __future__ import annotations def lowercase (SCREAMING_SNAKE_CASE_ : list[int] ) -> bool: return len(set(SCREAMING_SNAKE_CASE_ ) ) == len(SCREAMING_SNAKE_CASE_ ) if __name__ == "__main__": import doctest doctest.testmod...
362
"""simple docstring""" from __future__ import annotations def lowercase (SCREAMING_SNAKE_CASE_ : list[int] ) -> bool: return len(set(SCREAMING_SNAKE_CASE_ ) ) == len(SCREAMING_SNAKE_CASE_ ) if __name__ == "__main__": import doctest doctest.testmod()
38
0
"""simple docstring""" import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_devi...
363
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e impo...
38
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase = { '''configuration_xlm_roberta_xl''': [ '''XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMRobertaX...
364
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligne...
38
0
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance __UpperCamelCase = 6378137.0 __UpperCamelCase = 6356752.314245 __UpperCamelCase = 6378137 def lowercase (SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ :...
365
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> bool: SCREAMING_SNAKE_CASE = int(number**0.5 ) return number == sq * sq def ...
38
0
"""simple docstring""" import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class lowerCAme...
366
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = {'''vocab_file''': '''vocab.json'''} __Upp...
38
0
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> bool: SCREAMING_SNAKE_CASE = int(number**0.5 ) return number == sq * sq def ...
367
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ ) -> None: if len(lowerCAme...
38
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', ...
368
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class lowerCAmelCase ( lowerCamelCase_ ): '''simp...
38
0
"""simple docstring""" import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import requ...
369
"""simple docstring""" import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbos...
38
0
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch impo...
370
"""simple docstring""" 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''': ['''OP...
38
0
"""simple docstring""" from itertools import permutations def lowercase (SCREAMING_SNAKE_CASE_ : tuple ) -> bool: if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: ...
371
"""simple docstring""" import warnings 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...
38
0
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = {'''vocab_file''': '''vocab.json'''} __Upp...
350
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from a...
38
0
"""simple docstring""" import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines...
351
"""simple docstring""" from math import sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> int: SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE_ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE...
38
0
"""simple docstring""" import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink...
352
"""simple docstring""" import operator as op def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> int: SCREAMING_SNAKE_CASE = [] SCREAMING_SNAKE_CASE = lambda SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : int(x / y ) # noqa: E731 i...
38
0
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : int = 10_00 ) -> int: SCREAMING_SNAKE_CASE = 3 SCREAMING_SNAKE_CASE = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a eli...
353
"""simple docstring""" import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def lower...
38
0
from __future__ import annotations import bisect def lowercase (SCREAMING_SNAKE_CASE_ : list[int] , SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int = 0 , SCREAMING_SNAKE_CASE_ : int = -1 ) -> int: if hi < 0: SCREAMING_S...
354
"""simple docstring""" import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) def lowercase (SCREAMING_SNAKE_C...
38
0
"""simple docstring""" from collections.abc import Sequence def lowercase (SCREAMING_SNAKE_CASE_ : Sequence[float] , SCREAMING_SNAKE_CASE_ : bool = False ) -> float: if not arr: return 0 SCREAMING_SNAKE_CASE = 0 if allow_emp...
355
"""simple docstring""" from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> List[str]: # A local function to see if a dot lands in the circle. d...
38
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCamelCase = { '''configuration...
356
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFM...
38
0
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_...
357
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __UpperCamelCase = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxCon...
38
0
"""simple docstring""" import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
358
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils i...
38
0
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : int = 10 ) -> str: if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) or n < 0: raise ValueError('Invalid input' ) SCREAMING_SNAKE_CASE = 10**n SCREA...
359
"""simple docstring""" import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __UpperCamelCase = models.Se...
38
0
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration __UpperCamelCase = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', '''layers.'''), ('''...
360
"""simple docstring""" class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ ) -> None: SCREAMING_SNAKE_CASE = size SCREAMING_SNAKE_CASE = [0] * size SCREAMING_SNAKE_CAS...
38
0
"""simple docstring""" import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def lowercase (SCREAMING_SNAKE_CASE_ : Optional[int] , SCREAMING_SNAKE_CASE_ : str ...
361
"""simple docstring""" from collections import deque from .hash_table import HashTable class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' def __init__( self , *lowerCAmelCase__ , **lowerCAmelCase__ ) -> Dict: super()...
38
0
"""simple docstring""" from __future__ import annotations __UpperCamelCase = list[list[int]] # assigning initial values to the grid __UpperCamelCase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, ...
362
"""simple docstring""" from __future__ import annotations def lowercase (SCREAMING_SNAKE_CASE_ : list[int] ) -> bool: return len(set(SCREAMING_SNAKE_CASE_ ) ) == len(SCREAMING_SNAKE_CASE_ ) if __name__ == "__main__": import doctest doctest.testmod()
38
0
"""simple docstring""" import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import ...
363
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e impo...
38
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { '''...
364
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligne...
38
0
import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import ( ...
365
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> bool: SCREAMING_SNAKE_CASE = int(number**0.5 ) return number == sq * sq def ...
38
0
"""simple docstring""" from __future__ import annotations import queue class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ ) -> Optional[Any]: SCREAMING_SNAKE_CASE = data SCREAMING_SNA...
366
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = {'''vocab_file''': '''vocab.json'''} __Upp...
38
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __UpperCamelCase = loggi...
367
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ ) -> None: if len(lowerCAme...
38
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __UpperCamelCase = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '...
368
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class lowerCAmelCase ( lowerCamelCase_ ): '''simp...
38
0
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> int: if exponent == 1: return base if exponent % 2 == 0: SCREAMING_SNAKE_CASE = _modexp...
369
"""simple docstring""" import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbos...
38
0
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) def lowercase (SCREAMING_SNAKE_CASE_ : List[str] ) ->...
370
"""simple docstring""" 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''': ['''OP...
38
0
"""simple docstring""" import warnings 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...
371
"""simple docstring""" import warnings 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...
38
0
"""simple docstring""" import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class lowerCAmelCase ( unittest.TestCase ): '''si...
350
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from a...
38
0
"""simple docstring""" import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = '''T5Config...
351
"""simple docstring""" from math import sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> int: SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE_ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE...
38
0
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils i...
352
"""simple docstring""" import operator as op def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> int: SCREAMING_SNAKE_CASE = [] SCREAMING_SNAKE_CASE = lambda SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : int(x / y ) # noqa: E731 i...
38
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_ima...
353
"""simple docstring""" import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def lower...
38
0
import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def lowercase (SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : List[str] , SCREA...
354
"""simple docstring""" import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) def lowercase (SCREAMING_SNAKE_C...
38
0
"""simple docstring""" from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' SCREAMING_SNAKE_CASE_ : List[Any] = """openai/whis...
355
"""simple docstring""" from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> List[str]: # A local function to see if a dot lands in the circle. d...
38
0
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : str ) -> bool: SCREAMING_SNAKE_CASE = [int(SCREAMING_SNAKE_CASE_ ) for i in ip_va_address.split('.' ) if i.isdigit()] return len(SCREAMING_SNAKE_CASE_ ) == 4 and all(0 <= int(SCREAMING_SNAKE...
356
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFM...
38
0
"""simple docstring""" from sklearn.metrics import mean_squared_error import datasets __UpperCamelCase = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and G...
357
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __UpperCamelCase = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxCon...
38
0
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' SCREAMING_SNAKE_CASE_ : Any = (DDIMParallelScheduler,) SCREAMING_SNAKE_CA...
358
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils i...
38
0
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor fro...
359
"""simple docstring""" import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __UpperCamelCase = models.Se...
38
0
import copy import re class lowerCAmelCase : '''simple docstring''' SCREAMING_SNAKE_CASE_ : List[Any] = """hp""" SCREAMING_SNAKE_CASE_ : List[str] = {} SCREAMING_SNAKE_CASE_ : Tuple = None @classm...
360
"""simple docstring""" class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ ) -> None: SCREAMING_SNAKE_CASE = size SCREAMING_SNAKE_CASE = [0] * size SCREAMING_SNAKE_CAS...
38
0
"""simple docstring""" import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __UpperCamelCase = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BL...
361
"""simple docstring""" from collections import deque from .hash_table import HashTable class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' def __init__( self , *lowerCAmelCase__ , **lowerCAmelCase__ ) -> Dict: super()...
38
0
"""simple docstring""" 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''': ['''OP...
362
"""simple docstring""" from __future__ import annotations def lowercase (SCREAMING_SNAKE_CASE_ : list[int] ) -> bool: return len(set(SCREAMING_SNAKE_CASE_ ) ) == len(SCREAMING_SNAKE_CASE_ ) if __name__ == "__main__": import doctest doctest.testmod()
38
0
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva __UpperCamelCase = '''''' __UpperCamelCase = '''''' __UpperCamelCase = '''''' __UpperCamelCase = 1 # (0 is vertical, 1 is horizontal) def low...
363
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e impo...
38
0
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
364
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligne...
38
0
def lowercase (SCREAMING_SNAKE_CASE_ : int = 50 ) -> int: SCREAMING_SNAKE_CASE = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range...
365
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> bool: SCREAMING_SNAKE_CASE = int(number**0.5 ) return number == sq * sq def ...
38
0
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from d...
366
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = {'''vocab_file''': '''vocab.json'''} __Upp...
38
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __UpperCamelCase = { '''configuration_bridgetower''': [ '''BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
367
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class lowerCAmelCase : '''simple docstring''' def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ ) -> None: if len(lowerCAme...
38
0
"""simple docstring""" from math import isqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(SCREAMING_SNAKE_CASE_ ) + 1 ) ) def lowercase (SCREAMING_SNAKE_CASE_ : int = 10**6 ) -...
368
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class lowerCAmelCase ( lowerCamelCase_ ): '''simp...
38
0
"""simple docstring""" from __future__ import annotations __UpperCamelCase = tuple[int, int, int] __UpperCamelCase = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase __UpperCamelCase = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' # --------------------...
369
"""simple docstring""" import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbos...
38
0
def lowercase (SCREAMING_SNAKE_CASE_ : int = 10_00 ) -> int: return sum(e for e in range(3 , SCREAMING_SNAKE_CASE_ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f'''{solution() = }''')
370
"""simple docstring""" 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''': ['''OP...
38
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor __UpperCamelCase = logging.get_logger(__name__) class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' def __...
371
"""simple docstring""" import warnings 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...
38
0
import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is_flax_av...
39
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device a__: Union[str, Any] = False class SCREAMING_SNAKE_CASE_...
39
1
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, requir...
39
# Algorithm for the pigeonhole sorting def UpperCamelCase__( UpperCamelCase__ : int )->str: A__ = min(UpperCamelCase__ ) # min() finds the minimum value A__ = max(UpperCamelCase__ ) # max() finds the maximum value A__ = max_v...
39
1
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup a__: List[Any] = 'https://www.indeed.co.in/jobs?q=mobile+app+development&l=' def UpperCamelCase__( UpperCamelCase__ : str = "mumbai" )->Generator[tuple[str...
39
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path a__: str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) a__: list[int] = [ord(letter) for letter in string.ascii_lowercase] a__:...
39
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def UpperCamelCase__( UpperCamelCase__ : Dict )->An...
39
from __future__ import annotations from collections.abc import Iterator from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self,__lowerCamelCase ): A__ = data A__ = None class SCREAMING_SNAKE_CASE__ : ...
39
1
# Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
39
def UpperCamelCase__( UpperCamelCase__ : int , UpperCamelCase__ : int )->float: return base * power(UpperCamelCase__ , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') a__:...
39
1
from collections.abc import Generator from math import sin def UpperCamelCase__( UpperCamelCase__ : bytes )->bytes: if len(UpperCamelCase__ ) != 32: raise ValueError('''Input must be of length 32''' ) A__ = b'''''' for i in [3, 2, 1, 0]:...
39
import os import sys a__: int = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassificat...
39
1
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ......
39
a__: dict[str, float] = { "km/h": 1.0, "m/s": 3.6, "mph": 1.60_93_44, "knot": 1.8_52, } a__: dict[str, float] = { "km/h": 1.0, "m/s": 0.2_77_77_77_78, "mph": 0.6_21_37_11_92, "knot": 0.5_39_95_68_03, } def UpperCamelCase__( UpperCamelCas...
39
1
import numpy as np a__: Dict = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class SCREAMING_SNAKE_CASE__ : def __init__( self ): A__ ...
39
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def UpperCamelCase ( self ): A__ = [ '''safety_checker/pytorch_model.bin''', ...
39
1
from ... import PretrainedConfig a__: Optional[int] = { 'sijunhe/nezha-cn-base': 'https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json', } class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = NEZHA_PRETRAINED_CONFI...
39
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_...
39
1
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class SCREAMING_SNAKE_CASE__ : __SCREAMING_SNAKE_CASE = 42 __SCREAMING_SNAKE_CASE = None __SCREAMING_SNAKE_CASE = None a__: Dict ...
39
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = '''MCTCTFeatureExtractor''' __SCREAMING_SNAKE_CASE = '''AutoTokenizer''' ...
39
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize...
39
def UpperCamelCase__( )->Dict: A__ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] A__ = 6 A__ = 1 A__ = 19_01 A__ = 0 while year < 20_01: day += 7 if (year % ...
39
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set_v...
39
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
39
1
from __future__ import annotations def UpperCamelCase__( UpperCamelCase__ : tuple[int, int] , UpperCamelCase__ : int )->list[tuple[int, int]]: A__ , A__ = position A__ = [ (y + 1, x + 2), (y - 1, x + 2), ...
39
# 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 # # Unl...
39
1
def UpperCamelCase__( UpperCamelCase__ : int = 10**12 )->int: A__ = 1 A__ = 0 A__ = 1 A__ = 1 while numerator <= 2 * min_total - 1: prev_numerator += 2 * numerator numerator += 2 ...
39
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE__ ( UpperCamelCas...
39
1
from functools import reduce a__: Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896...
39
import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @requ...
39
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__: int = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', 'CLIPSegVision...
39
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class SCREAMING_SNAKE_CASE__ ( tf.keras.optimizers.sched...
39
1
import numpy as np def UpperCamelCase__( UpperCamelCase__ : np.array )->np.array: return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
39
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a__: List[Any] = logging.get_logger(__name__) a__: Optional[Any] = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/microsoft/unispeec...
39
1
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def UpperCamelCase__( )->tuple[list[int], int]: A__ = [randint(-10_00 , 10_00 ) for i in range(10 )] A__ = randint(-50_00 ...
39
def UpperCamelCase__( UpperCamelCase__ : str )->str: A__ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def UpperCamelCase__( UpperCamelCase__ ...
39
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a__: Any = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_torch_...
39
def UpperCamelCase__( UpperCamelCase__ : int = 1_00 )->int: A__ = (n * (n + 1) // 2) ** 2 A__ = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(F"{solution() = }")
39
1
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def UpperCamelCase ( self ): A__ = [ '''safety_checker/pytorch_model.bin''', ...
39
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae import Decoder, Deco...
39
1
from ...configuration_utils import PretrainedConfig class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = '''bert-generation''' def __init__( self,__lowerCamelCase=5_0358,__lowerCamelCase=1024,__lowerCamelCase=24,__lowerCamelCase=16,__lo...
39
from __future__ import annotations import time import numpy as np a__: Optional[Any] = [8, 5, 9, 7] a__: Dict = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] a__: List[Any] = [ [3, 2, 1, 4], [0, 2, 5, 2], ...
39
1
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.mo...
39
import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel a__: int = { 'gwf-44...
39
1
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def UpperCamelCase__( )->Union[str, Any]: with offline(OfflineSimulationMode.CONNECTION_TIMES_...
39
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device a__: Union[str, Any] = False class SCREAMING_SNAKE_CASE_...
39
1
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE__ ( UpperCamelCas...
39
# Algorithm for the pigeonhole sorting def UpperCamelCase__( UpperCamelCase__ : int )->str: A__ = min(UpperCamelCase__ ) # min() finds the minimum value A__ = max(UpperCamelCase__ ) # max() finds the maximum value A__ = max_v...
39
1
import inspect import os import re from transformers.configuration_utils import PretrainedConfig from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstri...
39
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path a__: str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) a__: list[int] = [ord(letter) for letter in string.ascii_lowercase] a__:...
39
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__: Optional[Any] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CON...
39
from __future__ import annotations from collections.abc import Iterator from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self,__lowerCamelCase ): A__ = data A__ = None class SCREAMING_SNAKE_CASE__ : ...
39
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 ...
39
def UpperCamelCase__( UpperCamelCase__ : int , UpperCamelCase__ : int )->float: return base * power(UpperCamelCase__ , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') a__:...
39
1
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
39
import os import sys a__: int = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassificat...
39
1
from string import ascii_uppercase a__: List[Any] = {str(ord(c) - 55): c for c in ascii_uppercase} def UpperCamelCase__( UpperCamelCase__ : int , UpperCamelCase__ : int )->str: if isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise Type...
39
a__: dict[str, float] = { "km/h": 1.0, "m/s": 3.6, "mph": 1.60_93_44, "knot": 1.8_52, } a__: dict[str, float] = { "km/h": 1.0, "m/s": 0.2_77_77_77_78, "mph": 0.6_21_37_11_92, "knot": 0.5_39_95_68_03, } def UpperCamelCase__( UpperCamelCas...
39
1
def UpperCamelCase__( UpperCamelCase__ : str )->str: A__ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def UpperCamelCase__( UpperCamelCase__ ...
39
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def UpperCamelCase ( self ): A__ = [ '''safety_checker/pytorch_model.bin''', ...
39
1
def UpperCamelCase__( UpperCamelCase__ : Any )->Tuple: A__ = [0] * len(UpperCamelCase__ ) A__ = [] A__ = [] A__ = 0 for values in graph.values(): for i in values: indegree[i...
39
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_...
39
1
import math import sys def UpperCamelCase__( UpperCamelCase__ : str )->str: A__ = '''''' try: with open(UpperCamelCase__ , '''rb''' ) as binary_file: A__ = binary_file.read() for dat in data: ...
39
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = '''MCTCTFeatureExtractor''' __SCREAMING_SNAKE_CASE = '''AutoTokenizer''' ...
39
1
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 a__: List[Any] ...
39
def UpperCamelCase__( )->Dict: A__ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] A__ = 6 A__ = 1 A__ = 19_01 A__ = 0 while year < 20_01: day += 7 if (year % ...
39
1
a__: dict[tuple[int, int, int], int] = {} def UpperCamelCase__( UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int )->int: # if we are absent twice, or late 3 consecutive days, # no further prize strings are possible ...
39
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
39
1
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, ...
39
# 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 # # Unl...
39
1
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
39
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE__ ( UpperCamelCas...
39
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) a__: List[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViT...
39
import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @requ...
39
1
from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): pass class SCREAMING_SNAKE_CASE__ : def __init__( self,__lowerCamelCase ): A__ = data A__ = None ...
39
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class SCREAMING_SNAKE_CASE__ ( tf.keras.optimizers.sched...
39
1
from __future__ import annotations def UpperCamelCase__( UpperCamelCase__ : list[float] , UpperCamelCase__ : Optional[Any] )->List[Any]: print(f"Vertex\tShortest Distance from vertex {src}" ) for i, d in enumerate(UpperCamelCase__ ): print(f"{i}\t\...
39
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a__: List[Any] = logging.get_logger(__name__) a__: Optional[Any] = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/microsoft/unispeec...
39
1
import comet # From: unbabel-comet import torch import datasets a__: Union[str, Any] = datasets.logging.get_logger(__name__) a__: List[str] = '\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon},\n tit...
39
def UpperCamelCase__( UpperCamelCase__ : str )->str: A__ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def UpperCamelCase__( UpperCamelCase__ ...
39
1
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 ...
39
def UpperCamelCase__( UpperCamelCase__ : int = 1_00 )->int: A__ = (n * (n + 1) // 2) ** 2 A__ = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(F"{solution() = }")
39
1