python_code
stringlengths
0
290k
repo_name
stringclasses
30 values
file_path
stringlengths
6
125
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
examples/community/sd_text2img_k_diffusion.py
import inspect from typing import Callable, List, Optional, Union import torch from diffusers.configuration_utils import FrozenDict from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipeline_utils import DiffusionPipeline from diffusers.pipelines.stable_diffusion import StableDiffusionPi...
diffusers-ft-main
examples/community/multilingual_stable_diffusion.py
import inspect import re from typing import Callable, List, Optional, Union import numpy as np import torch import PIL from diffusers.configuration_utils import FrozenDict from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipeline_utils import DiffusionPipeline from diffusers.pipelines.s...
diffusers-ft-main
examples/community/lpw_stable_diffusion.py
import inspect import os import random import re from dataclasses import dataclass from typing import Callable, Dict, List, Optional, Union import torch from diffusers.configuration_utils import FrozenDict from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipeline_utils import DiffusionP...
diffusers-ft-main
examples/community/wildcard_stable_diffusion.py
import inspect from typing import Callable, List, Optional, Union import torch from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, UNet2DConditionModel, ) from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion import Stable...
diffusers-ft-main
examples/community/speech_to_image_diffusion.py
#!/usr/bin/env python3 import torch from diffusers import DiffusionPipeline class UnetSchedulerOneForwardPipeline(DiffusionPipeline): def __init__(self, unet, scheduler): super().__init__() self.register_modules(unet=unet, scheduler=scheduler) def __call__(self): image = torch.randn...
diffusers-ft-main
examples/community/one_step_unet.py
from typing import Optional, Tuple, Union import torch from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, UNet2DConditionModel from diffusers.pipeline_utils import ImagePipelineOutput from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.scheduling_ddpm imp...
diffusers-ft-main
examples/community/bit_diffusion.py
import inspect import re from typing import Callable, List, Optional, Union import numpy as np import torch import PIL from diffusers.onnx_utils import OnnxRuntimeModel from diffusers.pipeline_utils import DiffusionPipeline from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput from diffusers....
diffusers-ft-main
examples/community/lpw_stable_diffusion_onnx.py
""" modeled after the textual_inversion.py / train_dreambooth.py and the work of justinpinkney here: https://github.com/justinpinkney/stable-diffusion/blob/main/notebooks/imagic.ipynb """ import inspect import warnings from typing import List, Optional, Union import numpy as np import torch import torch.nn.fun...
diffusers-ft-main
examples/community/imagic_stable_diffusion.py
import inspect from typing import List, Optional, Union import torch from torch import nn from torch.nn import functional as F from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, UNet2DConditionModel, ) from diffusers.pipelines.stable_d...
diffusers-ft-main
examples/community/clip_guided_stable_diffusion.py
""" modified based on diffusion library from Huggingface: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py """ import inspect from typing import Callable, List, Optional, Union import torch from diffusers.models import AutoencoderKL, UNet2DCo...
diffusers-ft-main
examples/community/seed_resize_stable_diffusion.py
from typing import Any, Callable, Dict, List, Optional, Union import torch import PIL.Image from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionImg2ImgPipeline, StableDiffusionInpaintPipelineLegacy, StableDiffusio...
diffusers-ft-main
examples/community/stable_diffusion_mega.py
import inspect from typing import Callable, List, Optional, Tuple, Union import numpy as np import torch import PIL from diffusers.configuration_utils import FrozenDict from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipeline_utils import DiffusionPipeline from diffusers.pipelines.stab...
diffusers-ft-main
examples/community/img2img_inpainting.py
""" modified based on diffusion library from Huggingface: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py """ import inspect import warnings from typing import List, Optional, Union import torch from diffusers.models import AutoencoderKL, UN...
diffusers-ft-main
examples/community/composable_stable_diffusion.py
import inspect import time from pathlib import Path from typing import Callable, List, Optional, Union import numpy as np import torch from diffusers.configuration_utils import FrozenDict from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipeline_utils import DiffusionPipeline from diffu...
diffusers-ft-main
examples/community/interpolate_stable_diffusion.py
from typing import Callable, List, Optional, Union import torch import PIL from diffusers.configuration_utils import FrozenDict from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipeline_utils import DiffusionPipeline from diffusers.pipelines.stable_diffusion import StableDiffusionInpain...
diffusers-ft-main
examples/community/text_inpainting.py
import d4rl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline config = dict( n_samples=64, horizon=32, num_inference_steps=20, n_guide_steps=2, scale_grad_by_std=True, scale=0.1, eta=0.0, t_grad_cutoff=2, device="cpu", ) if __name__ == "__mai...
diffusers-ft-main
examples/rl/run_diffuser_locomotion.py
import d4rl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline config = dict( n_samples=64, horizon=32, num_inference_steps=20, n_guide_steps=0, scale_grad_by_std=True, scale=0.1, eta=0.0, t_grad_cutoff=2, device="cpu", ) if __name__ == "__mai...
diffusers-ft-main
examples/rl/run_diffuser_gen_trajectories.py
import argparse import torch import OmegaConf from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def convert_ldm_original(checkpoint_path, config_path, output_path): config = OmegaConf.load(config_path) state_dict = torch.load(checkpoint_path, map_location="cpu")["model"] keys = lis...
diffusers-ft-main
scripts/conversion_ldm_uncond.py
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint. # *Only* converts the UNet, VAE, and Text Encoder. # Does not convert optimizer state or any other thing. import argparse import os.path as osp import torch # =================# # UNet Conversion # # =================# unet_con...
diffusers-ft-main
scripts/convert_diffusers_to_original_stable_diffusion.py
diffusers-ft-main
scripts/__init__.py
import argparse import json import torch from diffusers import AutoencoderKL, DDPMPipeline, DDPMScheduler, UNet2DModel, VQModel def shave_segments(path, n_shave_prefix_segments=1): """ Removes segments. Positive values shave the first segments, negative shave the last segments. """ if n_shave_prefix...
diffusers-ft-main
scripts/convert_ddpm_original_checkpoint_to_diffusers.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
scripts/convert_ldm_original_checkpoint_to_diffusers.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
scripts/convert_stable_diffusion_checkpoint_to_onnx.py
import json import os import torch from diffusers import UNet1DModel os.makedirs("hub/hopper-medium-v2/unet/hor32", exist_ok=True) os.makedirs("hub/hopper-medium-v2/unet/hor128", exist_ok=True) os.makedirs("hub/hopper-medium-v2/value_function", exist_ok=True) def unet(hor): if hor == 128: down_block_...
diffusers-ft-main
scripts/convert_models_diffuser_to_diffusers.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
scripts/convert_ncsnpp_original_checkpoint_to_diffusers.py
import random import torch from diffusers import UNet2DModel from huggingface_hub import HfApi api = HfApi() results = {} # fmt: off results["google_ddpm_cifar10_32"] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1.3433, -1.1743, -3.7467, 1.2342, -2.2485, 0.4636, 0.8076, -0.7991, 0.3969, 0.849...
diffusers-ft-main
scripts/generate_logits.py
#!/usr/bin/env python3 import argparse import math import os from copy import deepcopy import torch from torch import nn from audio_diffusion.models import DiffusionAttnUnet1D from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNet1DModel from diffusion import sampling MODELS_MAP = { "gwf-440k": { ...
diffusers-ft-main
scripts/convert_dance_diffusion_to_diffusers.py
""" This script ports models from VQ-diffusion (https://github.com/microsoft/VQ-Diffusion) to diffusers. It currently only supports porting the ITHQ dataset. ITHQ dataset: ```sh # From the root directory of diffusers. # Download the VQVAE checkpoint $ wget https://facevcstandard.blob.core.windows.net/v-zhictang/Impr...
diffusers-ft-main
scripts/convert_vq_diffusion_to_diffusers.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
scripts/convert_versatile_diffusion_to_diffusers.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
scripts/convert_original_stable_diffusion_to_diffusers.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
scripts/change_naming_configs_and_checkpoints.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
diffusers-ft-main
src/diffusers/configuration_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
diffusers-ft-main
src/diffusers/pipeline_flax_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
src/diffusers/modeling_flax_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
src/diffusers/modeling_flax_pytorch_utils.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/dependency_versions_check.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
src/diffusers/optimization.py
from .utils import ( is_flax_available, is_inflect_available, is_onnx_available, is_scipy_available, is_torch_available, is_transformers_available, is_unidecode_available, ) __version__ = "0.9.0" from .configuration_utils import ConfigMixin from .onnx_utils import OnnxRuntimeModel from .u...
diffusers-ft-main
src/diffusers/__init__.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
src/diffusers/hub_utils.py
import copy import os import random import numpy as np import torch def enable_full_determinism(seed: int): """ Helper function for reproducible behavior during distributed training. See - https://pytorch.org/docs/stable/notes/randomness.html for pytorch """ # set seed first set_seed(seed) ...
diffusers-ft-main
src/diffusers/training_utils.py
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify the `_deps` dict in setup.py # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "black": "black==22.8", "datasets": "datasets", "filelock": "filelock", "flake8": "flake8>=3.8.3", "flax...
diffusers-ft-main
src/diffusers/dependency_versions_table.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
diffusers-ft-main
src/diffusers/modeling_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers-ft-main
src/diffusers/dynamic_modules_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
diffusers-ft-main
src/diffusers/onnx_utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
diffusers-ft-main
src/diffusers/pipeline_utils.py
from .rl import ValueGuidedRLPipeline
diffusers-ft-main
src/diffusers/experimental/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/experimental/rl/value_guided_sampling.py
from .value_guided_sampling import ValueGuidedRLPipeline
diffusers-ft-main
src/diffusers/experimental/rl/__init__.py
from ..utils import is_flax_available, is_onnx_available, is_torch_available, is_transformers_available if is_torch_available(): from .dance_diffusion import DanceDiffusionPipeline from .ddim import DDIMPipeline from .ddpm import DDPMPipeline from .latent_diffusion import LDMSuperResolutionPipeline ...
diffusers-ft-main
src/diffusers/pipelines/__init__.py
from .pipeline_repaint import RePaintPipeline
diffusers-ft-main
src/diffusers/pipelines/repaint/__init__.py
# Copyright 2022 ETH Zurich Computer Vision Lab and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
diffusers-ft-main
src/diffusers/pipelines/repaint/pipeline_repaint.py
# flake8: noqa from .pipeline_stochastic_karras_ve import KarrasVePipeline
diffusers-ft-main
src/diffusers/pipelines/stochastic_karras_ve/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/ddim/pipeline_ddim.py
# flake8: noqa from .pipeline_ddim import DDIMPipeline
diffusers-ft-main
src/diffusers/pipelines/ddim/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass # Copied from diffusers.pipelines.stable_diffusion.__init__.StableDiffusionPipelineOutput with Sta...
diffusers-ft-main
src/diffusers/pipelines/alt_diffusion/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py
from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class TransformationModelOutput(ModelOutput): """ Base class for tex...
diffusers-ft-main
src/diffusers/pipelines/alt_diffusion/modeling_roberta_series.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py
# flake8: noqa from .pipeline_latent_diffusion_uncond import LDMPipeline
diffusers-ft-main
src/diffusers/pipelines/latent_diffusion_uncond/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion_safe/safety_checker.py
from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class SafetyConfig(object): WEAK = { "sld_warmup_steps": 15, ...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion_safe/__init__.py
import inspect import warnings from typing import Callable, List, Optional, Union import numpy as np import torch from packaging import version from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer from ...configuration_utils import FrozenDict from ...models import AutoencoderKL, UNet2DConditio...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
diffusers-ft-main
src/diffusers/pipelines/vq_diffusion/__init__.py
# Copyright 2022 Microsoft and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
diffusers-ft-main
src/diffusers/pipelines/vq_diffusion/pipeline_vq_diffusion.py
import inspect from typing import Optional, Tuple, Union import numpy as np import torch import torch.utils.checkpoint import PIL from ...models import UNet2DModel, VQModel from ...pipeline_utils import DiffusionPipeline, ImagePipelineOutput from ...schedulers import ( DDIMScheduler, DPMSolverMultistepSchedu...
diffusers-ft-main
src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py
# flake8: noqa from ...utils import is_transformers_available from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline if is_transformers_available(): from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline
diffusers-ft-main
src/diffusers/pipelines/latent_diffusion/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py
# flake8: noqa from .pipeline_dance_diffusion import DanceDiffusionPipeline
diffusers-ft-main
src/diffusers/pipelines/dance_diffusion/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py
# flake8: noqa from .pipeline_score_sde_ve import ScoreSdeVePipeline
diffusers-ft-main
src/diffusers/pipelines/score_sde_ve/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/safety_checker_flax.py
import inspect from typing import Callable, List, Optional, Union import numpy as np import torch import PIL from transformers import CLIPFeatureExtractor, CLIPTokenizer from ...configuration_utils import FrozenDict from ...onnx_utils import OnnxRuntimeModel from ...pipeline_utils import DiffusionPipeline from ...sc...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint_legacy.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/safety_checker.py
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, is_flax_available, is_onnx_available, is_torch_available, is_transformers_available, is_transformers_version, ) @dataclass class ...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/pndm/pipeline_pndm.py
# flake8: noqa from .pipeline_pndm import PNDMPipeline
diffusers-ft-main
src/diffusers/pipelines/pndm/__init__.py
from typing import Optional, Tuple, Union import numpy as np import torch import torch.nn as nn from ...configuration_utils import ConfigMixin, register_to_config from ...modeling_utils import ModelMixin from ...models.attention import DualTransformer2DModel, Transformer2DModel from ...models.embeddings import Timest...
diffusers-ft-main
src/diffusers/pipelines/versatile_diffusion/modeling_text_unet.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py
from ...utils import is_torch_available, is_transformers_available, is_transformers_version if is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0.dev0"): from .modeling_text_unet import UNetFlatConditionModel from .pipeline_versatile_diffusion import VersatileDiffus...
diffusers-ft-main
src/diffusers/pipelines/versatile_diffusion/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py
import inspect from typing import Callable, List, Optional, Union import torch import PIL.Image from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer, CLIPVisionModel from ...models import AutoencoderKL, UNet2DConditionModel from ...pipeline_utils import DiffusionPipeline from ...schedulers imp...
diffusers-ft-main
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion.py
# flake8: noqa from .pipeline_ddpm import DDPMPipeline
diffusers-ft-main
src/diffusers/pipelines/ddpm/__init__.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers-ft-main
src/diffusers/pipelines/ddpm/pipeline_ddpm.py
# coding=utf-8 # Copyright 2020 Optuna, Hugging Face # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
diffusers-ft-main
src/diffusers/utils/logging.py