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
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase__( UpperCamelCase__ : List[Any] , UpperCamelCase__ : Option...
371
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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__: Any = logging.get_logger(__name__) a__: Optional[int] = { 'microsoft/trocr-base-handwritten': ( 'https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json' ...
350
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
0
from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake a__: List[str] = numpy.array([0, 0]) a__: Any = numpy.array([0.5, 0.8_66_02_54]) a__: Tuple = numpy.array([1, 0]) a__: int = [VECTOR...
351
# 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
0
"""simple docstring""" def UpperCamelCase__( UpperCamelCase__ : Union[str, Any] )->Union[str, Any]: A__ = len(_snake_case ) A__ = sum(_snake_case ) A__ = [[False for x in range(s + 1 )] for y in range(n + 1 )] for i...
352
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
0
"""simple docstring""" from math import sqrt def UpperCamelCase__( UpperCamelCase__ : Optional[int] )->int: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
353
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
0
from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE__ ( metaclass=UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = ['''note_seq'''] def __init__( self,*__lowerCamelCase,**__lowerCamelCase ): requires_backends(self,['''note_seq'''] )...
354
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
0
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from accel...
355
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
0
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...
356
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
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE__ ( __lowerCamelCase ): __SCREAMING_SNAKE_CASE = ['image_processor', 'tokenizer'] __SCREAMIN...
357
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
0
def UpperCamelCase__( UpperCamelCase__ : Tuple = 4_00_00_00 )->Optional[Any]: A__ = [] A__ , A__ = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(UpperCamelCase__ ) A__ , A__ = ...
358
# 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
0
a__: Any = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" a__: int = [{"type": "code", "co...
359
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
0
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def UpperCamelCase ( self ): ...
360
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
0
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher, ...
361
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
0
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterM...
362
# 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
0
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def UpperCamelCase__( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray )->Dict: return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(UpperCamelCase__ ...
363
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
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
364
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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a__: List[Any] = logging.get_logger(__name__) a__: List[Any] = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/conf...
365
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
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class SCREAMING_SNAKE_CASE__ ( unittest.TestCase , lowerCamelCase_ ): def UpperCamelCase ( self ): A__ = load_tool('''text-classification'...
366
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
0
from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class SCREAMING_SNAKE_CASE__ ( A_ ): __SCREAMING_SNAKE_CASE = '''openai/whisper-base''' __SCREAMING_SNAKE_CASE = ( '''This is a tool that transcr...
367
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
0
from __future__ import annotations a__: Optional[int] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class SCREAMING_SNAKE_CASE__ : def __init__( self...
368
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
0
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def UpperCamelCase__( UpperCamelCase__ : Optional[int] )->List[Any]: A__ = [ "encoder.version", "decoder.version...
369
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
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from a...
370
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
0
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNet...
371
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
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availab...
350
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
0
import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPa...
351
# 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
0
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.util...
352
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
0
"""simple docstring""" import random def UpperCamelCase__( UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : Optional[int] )->Union[str, Any]: A__ , A__ , A__ = [], [], [] for element in data: if element < pivot: ...
353
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
0
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand a__: str = logging.get_logger(__name__) # pylint: disable=invalid-name def UpperCamelCase__( Upper...
354
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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__: List[str] = logging.get_logger(__name__) a__: int = { 'tanreinama/GPTSAN-2.8B-spout_is_uniform': ( 'https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.js...
355
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
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers...
356
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
0
"""simple docstring""" def UpperCamelCase__( UpperCamelCase__ : Tuple , UpperCamelCase__ : Tuple )->int: A__ = [0 for i in range(r + 1 )] # nc0 = 1 A__ = 1 for i in range(1 , n + 1 ): # to compute cur...
357
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
0
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS, ...
358
# 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
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def UpperCamelCase ( self ): debug_launcher(test_script.main ) def U...
359
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
0
from __future__ import annotations a__: int = list[list[int]] # assigning initial values to the grid a__: Optional[int] = [ [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, 8, 0], [9, 0, 0, 8, 6, 3, 0...
360
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
0
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert....
361
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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__: str = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available(): rai...
362
# 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
0
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( __SCREAMING_SNAKE_CASE ): __SCREAMING_SNAKE_CASE = (EulerDiscreteScheduler,) __SCREAM...
363
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
0
import argparse import json from tqdm import tqdm def UpperCamelCase__( )->Tuple: A__ = argparse.ArgumentParser() # Required parameters parser.add_argument( '''--src_path''' , type=_a , default='''biencoder-nq-dev.json''' , hel...
364
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
0
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import lo...
365
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
0
from itertools import product def UpperCamelCase__( UpperCamelCase__ : int , UpperCamelCase__ : int )->Any: A__ = sides_number A__ = max_face_number * dice_number A__ = [0] * (max_total + 1) A__ = 1 ...
366
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
0
import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
367
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
0
def UpperCamelCase__( UpperCamelCase__ : Tuple )->bool: if num < 0: return False A__ = num A__ = 0 while num > 0: A__ = rev_num * 10 + (num % 10) num //= 10 return num_copy ...
368
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
0
from typing import List from .keymap import KEYMAP, get_character def UpperCamelCase__( UpperCamelCase__ : str )->Union[str, Any]: def decorator(UpperCamelCase__ : Dict ): A__ = getattr(_lowerCamelCase , '''handle_key''' , [] ) ...
369
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
0
import inspect import unittest from transformers import MobileNetVaConfig 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 ConfigT...
370
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
0
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fas...
371
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
0
import numpy as np import datasets a__: str = '\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance.\nIt was introduced by P...
350
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
0
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = (PNDMScheduler,) __SCREAMING_SNAKE_CASE = (('''num_inference_...
351
# 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
0
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class SCREAMING_SNAKE_CASE__ ( _lowerCamelCase , _lowerCamelCa...
352
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
0
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenizatio...
353
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
0
from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy a__: Any = logging.get_logger(__name__) class ...
354
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
0
from heapq import heappop, heappush import numpy as np def UpperCamelCase__( UpperCamelCase__ : Tuple , UpperCamelCase__ : str , UpperCamelCase__ : Optional[int] , UpperCamelCase__ : Optional[Any] , )->tuple[float | int, list[tuple[int, int]]]: ...
355
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
0
import argparse import os # New Code # import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from ...
356
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
0
"""simple docstring""" import string import numpy def UpperCamelCase__( UpperCamelCase__ : List[Any] , UpperCamelCase__ : str )->Dict: return b if a == 0 else greatest_common_divisor(b % a , A_ ) class SCREAMING_SNAKE_CASE__ : __SCREAMING...
357
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
0
import sys a__: Any = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648950445244523161731856403098...
358
# 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
0
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get...
359
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
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.tes...
360
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
0
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def UpperCamelCase__( )->Tuple: A__ = 9, 14 # noqa: F841 A__ = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7,...
361
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
0
from argparse import ArgumentParser from accelerate.commands.config import get_config_parser from accelerate.commands.env import env_command_parser from accelerate.commands.launch import launch_command_parser from accelerate.commands.test import test_command_parser from accelerate.commands.tpu import...
362
# 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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a__: List[str] = {"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_available(): ...
363
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
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .token...
364
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
0
"""simple docstring""" import math def UpperCamelCase__( UpperCamelCase__ : int )->Union[str, Any]: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives...
365
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
0
a__: List[Any] = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a__: str = { 'm': 0, ...
366
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
0
from queue import PriorityQueue from typing import Any import numpy as np def UpperCamelCase__( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : str , UpperCamelCase__ : Optional[Any] , UpperCamelCase__ ...
367
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
0
import argparse import os import re a__: Union[str, Any] = 'src/transformers/models/auto' # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict a__: int = re.compile(r'[A-Z_]+_MAPPING(\s+|_[A-Z_]+\s+)=...
368
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
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from tra...
369
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
0
import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput a__: Union[str, Any] = 'scheduler_config.json' class SCR...
370
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
0
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
371
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
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def UpperCamelCase__( UpperCamelCase__ : bytes , UpperCamelCase__ : int )->int: A__ = f"{sampling_rate}" A__ = """1""" ...
350
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
0
from manim import * class SCREAMING_SNAKE_CASE__ ( __lowercase ): def UpperCamelCase ( self ): A__ = Rectangle(height=0.5,width=0.5 ) A__ = Rectangle(height=0.46,width=0.46 ).set_stroke(width=0 ) A__ ...
351
# 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
0
"""simple docstring""" import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets a__: List[str] = """ @inproceedings{xu-etal-2016-optimizing, title = {Optimizing Statistical Machine Translation...
352
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
0
"""simple docstring""" import baseaa def UpperCamelCase__( UpperCamelCase__ : str )->int: return baseaa.baaencode(string.encode('''utf-8''' ) ) def UpperCamelCase__( UpperCamelCase__ : bytes )->Any: return baseaa.baadecode(UpperCamelCase__ ).decode...
353
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
0
def UpperCamelCase__( UpperCamelCase__ : Any = 10_00 )->Any: A__ , A__ = 1, 1 A__ = 2 while True: A__ = 0 A__ = fa + fa A__ , A__ = fa, f index += 1 ...
354
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
0
import numpy as np a__: Tuple = [ ['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__ ...
355
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
0
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class SCREAMING_SNAKE_CASE__ : pass
356
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
0
"""simple docstring""" import gc import threading import time import psutil import torch class SCREAMING_SNAKE_CASE__ : def __init__( self ): A__ = psutil.Process() A__ = False def UpperCamelCase ( se...
357
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
0
import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerForOb...
358
# 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
0
import unittest import torch from torch import nn from diffusers.models.activations import get_activation class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def UpperCamelCase ( self ): A__ = get_activation('''swish''' ) self.assertIsInstance(...
359
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
0
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available,...
360
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
0
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify,...
361
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
0
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def UpperCamelCase__( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Dict )->List[str]: A__ ...
362
# 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
0
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_...
363
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
0
from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE__ ( metaclass=a__ ): __SCREAMING_SNAKE_CASE = ["onnx"] def __init__( self,*__lowerCamelCase,**__lowerCamelCase ): requires_backends(self,['''onnx'''] ) @classme...
364
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
0
"""simple docstring""" from timeit import timeit def UpperCamelCase__( UpperCamelCase__ : int )->int: if number < 0: raise ValueError('''the value of input must not be negative''' ) A__ = 0 while number: number ...
365
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
0
from decimal import Decimal, getcontext from math import ceil, factorial def UpperCamelCase__( UpperCamelCase__ : Union[str, Any] )->List[Any]: if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise TypeError('''Undefined for non-integers''' ...
366
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
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a__: Optional[Any] = logging.get_logger(__name_...
367
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
0
from __future__ import annotations def UpperCamelCase__( UpperCamelCase__ : List[Any] )->bool: A__ = str(lowerCAmelCase_ ) return len(lowerCAmelCase_ ) == 9 and set(lowerCAmelCase_ ) == set('''123456789''' ) def UpperCamelCase__( )->int | None: ...
368
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
0
import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import To...
369
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
0
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": a__: List[Any] = pd.read_csv('sample_data.csv', header=None) a__: ...
370
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
0
import warnings from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__: Optional[Any] = logging.get_logger(__name__) a__: Lis...
371
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
0
import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class SCREAMING_SNAKE_CASE__ ...
350
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
0
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMSch...
351
# 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
0
"""simple docstring""" from collections import Counter from timeit import timeit def UpperCamelCase__( UpperCamelCase__ : str = "" , )->bool: return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ) < 2 def UpperCam...
352
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
0
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassific...
353
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
0
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
354
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
0
def UpperCamelCase__( UpperCamelCase__ : str )->bool: if not all(x.isalpha() for x in string ): raise ValueError('''String must only contain alphabetic characters.''' ) A__ = sorted(string.lower() ) return len(UpperCamelCase__ ) == len(set(Upp...
355
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
0
from __future__ import annotations def UpperCamelCase__( UpperCamelCase__ : str , UpperCamelCase__ : list[str] | None = None , UpperCamelCase__ : dict[str, float] | None = None , UpperCamelCase__ : bool = False , )->tuple[int, float, str]: A__ ...
356
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
0
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration...
357
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
0
import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 ...
358
# 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
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPipeline, UNetaDC...
359
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
0
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 ......
360
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
0