repo_id
stringlengths
15
89
file_path
stringlengths
27
180
content
stringlengths
1
2.23M
__index_level_0__
int64
0
0
hf_public_repos/diffusers
hf_public_repos/diffusers/examples/README.md
<!--- Copyright 2023 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 applicable law or a...
0
hf_public_repos/diffusers
hf_public_repos/diffusers/examples/test_examples_utils.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0
hf_public_repos/diffusers
hf_public_repos/diffusers/examples/conftest.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/README_sdxl.md
# Latent Consistency Distillation Example: [Latent Consistency Models (LCMs)](https://arxiv.org/abs/2310.04378) is a method to distill a latent diffusion model to enable swift inference with minimal steps. This example demonstrates how to use latent consistency distillation to distill SDXL for inference with few times...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/train_lcm_distill_sdxl_wds.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/README.md
# Latent Consistency Distillation Example: [Latent Consistency Models (LCMs)](https://arxiv.org/abs/2310.04378) is a method to distill a latent diffusion model to enable swift inference with minimal steps. This example demonstrates how to use latent consistency distillation to distill stable-diffusion-v1.5 for inferen...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 ftfy tensorboard Jinja2 webdataset
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/train_lcm_distill_lora_sdxl_wds.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/train_lcm_distill_lora_sdxl.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 The LCM team and 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.apach...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/train_lcm_distill_sd_wds.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/train_lcm_distill_lora_sd_wds.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/consistency_distillation/test_lcm_lora.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/README_sdxl.md
## Textual Inversion fine-tuning example for SDXL ``` export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0" export DATA_DIR="./cat" accelerate launch textual_inversion_sdxl.py \ --pretrained_model_name_or_path=$MODEL_NAME \ --train_data_dir=$DATA_DIR \ --learnable_property="object" \ --placeholder_toke...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/README.md
## Textual Inversion fine-tuning example [Textual inversion](https://arxiv.org/abs/2208.01618) is a method to personalize text2image models like stable diffusion on your own images using just 3-5 examples. The `textual_inversion.py` script shows how to implement the training procedure and adapt it for stable diffusion...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/textual_inversion.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/test_textual_inversion_sdxl.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/textual_inversion_flax.py
import argparse import logging import math import os import random from pathlib import Path import jax import jax.numpy as jnp import numpy as np import optax import PIL import torch import torch.utils.checkpoint import transformers from flax import jax_utils from flax.training import train_state from flax.training.co...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/textual_inversion_sdxl.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/test_textual_inversion.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/textual_inversion/requirements_flax.txt
transformers>=4.25.1 flax optax torch torchvision ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/lpw_stable_diffusion_xl.py
## ---------------------------------------------------------- # A SDXL pipeline can take unlimited weighted prompt # # Author: Andrew Zhu # Github: https://github.com/xhinker # Medium: https://medium.com/@xhinker ## ----------------------------------------------------------- import inspect import os from typing import...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/clip_guided_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 torchvision import transforms from transformers import CLIPImageProcessor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, Diffu...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/marigold_depth_estimation.py
# Copyright 2023 Bingxin Ke, ETH Zurich 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 # # U...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/masked_stable_diffusion_img2img.py
from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import PIL.Image import torch from diffusers import StableDiffusionImg2ImgPipeline from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput class MaskedStableDiffusionImg2ImgPipeline(StableDiffusionImg2ImgPipeline...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/dps_pipeline.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/ddim_noise_comparative_analysis.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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_animatediff_controlnet.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/sd_text2img_k_diffusion.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_controlnet_inpaint.py
# Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/ import inspect from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch import torch.nn.functional as F from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from di...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/rerender_a_video.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/llm_grounded_diffusion.py
# Copyright 2023 Long Lian, the GLIGEN Authors, 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
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_tensorrt_inpaint.py
# # Copyright 2023 The HuggingFace Inc. team. # SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_mega.py
from typing import Any, Callable, Dict, List, Optional, Union import PIL.Image import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionImg...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/interpolate_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 transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict from diffusers.m...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/lpw_stable_diffusion.py
import inspect import re from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import PIL.Image import torch from packaging import version from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.configuration_utils imp...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/speech_to_image_diffusion.py
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/README.md
# Community Examples > **For more information about community pipelines, please have a look at [this issue](https://github.com/huggingface/diffusers/issues/841).** **Community** examples consist of both inference and training examples that have been added by the community. Please have a look at the following table to...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/tiled_upscaling.py
# Copyright 2023 Peter Willemsen <peter@codebuffet.co>. 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 requ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/one_step_unet.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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_fabric.py
# Copyright 2023 FABRIC authors 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 re...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/sde_drag.py
import math import tempfile from typing import List, Optional import numpy as np import PIL.Image import torch from accelerate import Accelerator from torchvision import transforms from tqdm.auto import tqdm from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DiffusionPipeline, ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/text_inpainting.py
from typing import Callable, List, Optional, Union import PIL.Image import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDic...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_ipex.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/iadb.py
from typing import List, Optional, Tuple, Union import torch from diffusers import DiffusionPipeline from diffusers.configuration_utils import ConfigMixin from diffusers.pipelines.pipeline_utils import ImagePipelineOutput from diffusers.schedulers.scheduling_utils import SchedulerMixin class IADBScheduler(Scheduler...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_controlnet_img2img.py
# Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/ import inspect from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, Co...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_tensorrt_img2img.py
# # Copyright 2023 The HuggingFace Inc. team. # SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_stable_diffusion_xl_controlnet_adapter.py
# Copyright 2023 TencentARC 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 requir...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/regional_prompting_stable_diffusion.py
import math from typing import Dict, Optional import torch import torchvision.transforms.functional as FF from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer from diffusers import StableDiffusionPipeline from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipelines....
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/run_onnx_controlnet.py
import argparse import inspect import os import time import warnings from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import PIL.Image import torch from PIL import Image from transformers import CLIPTokenizer from diffusers import OnnxRuntimeModel, StableDiffusionImg2ImgPipeline, UniPC...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_controlnet_reference.py
# Inspired by: https://github.com/Mikubill/sd-webui-controlnet/discussions/1236 and https://github.com/Mikubill/sd-webui-controlnet/discussions/1280 from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from diffusers import StableDiffusionControlNetPipe...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_xl_reference.py
# Based on stable_diffusion_reference.py from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from diffusers import StableDiffusionXLPipeline from diffusers.models.attention import BasicTransformerBlock from diffusers.models.unet_2d_blocks import ( ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_stable_diffusion_xl_controlnet_adapter_inpaint.py
# Copyright 2023 Jake Babbidge, TencentARC 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 # ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_reference.py
# Inspired by: https://github.com/Mikubill/sd-webui-controlnet/discussions/1236 and https://github.com/Mikubill/sd-webui-controlnet/discussions/1280 from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from diffusers import StableDiffusionPipeline from ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/unclip_image_interpolation.py
import inspect from typing import List, Optional, Union import PIL.Image import torch from torch.nn import functional as F from transformers import ( CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, Imag...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_stable_diffusion_upscale_ldm3d.py
# Copyright 2023 The Intel Labs Team Authors 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 ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/gluegen.py
import inspect from typing import Any, Dict, List, Optional, Union import torch import torch.nn as nn from transformers import AutoModel, AutoTokenizer, CLIPImageProcessor from diffusers import DiffusionPipeline from diffusers.image_processor import VaeImageProcessor from diffusers.loaders import LoraLoaderMixin from...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_sdxl_style_aligned.py
# Copyright 2024 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/checkpoint_merger.py
import glob import os from typing import Dict, List, Union import safetensors.torch import torch from huggingface_hub import snapshot_download from huggingface_hub.utils import validate_hf_hub_args from diffusers import DiffusionPipeline, __version__ from diffusers.schedulers.scheduling_utils import SCHEDULER_CONFIG_...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_repaint.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/run_tensorrt_controlnet.py
import argparse import atexit import inspect import os import time import warnings from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import PIL.Image import pycuda.driver as cuda import tensorrt as trt import torch from PIL import Image from pycuda.tools import make_default_context from ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/latent_consistency_img2img.py
# Copyright 2023 Stanford University Team 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 # #...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_zero1to3.py
# A diffuser version implementation of Zero1to3 (https://github.com/cvlab-columbia/zero123), ICCV 2023 # by Xin Kong import inspect from typing import Any, Callable, Dict, List, Optional, Union import kornia import numpy as np import PIL.Image import torch from packaging import version from transformers import CLIPFe...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_comparison.py
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, UNet2D...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/wildcard_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 transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDic...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/ip_adapter_face_id.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/imagic_stable_diffusion.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 PIL.Image import torch im...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_prompt2prompt.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/bit_diffusion.py
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNet2DConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.scheduling_ddpm im...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/mixture_tiling.py
import inspect from copy import deepcopy from enum import Enum from typing import List, Optional, Tuple, Union import torch from tqdm.auto import tqdm from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipelines.pipeline_utils import DiffusionPipeline from diffusers.pipelines.stable_diffu...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/latent_consistency_txt2img.py
# Copyright 2023 Stanford University Team 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 # #...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/multilingual_stable_diffusion.py
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, MBart50TokenizerFast, MBartForConditionalGeneration, pipeline, ) from diffusers import DiffusionPipeline from diffusers.configuration_util...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/composable_stable_diffusion.py
# Copyright 2023 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...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/img2img_inpainting.py
import inspect from typing import Callable, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict from diffusers.models import ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_tensorrt_txt2img.py
# # Copyright 2023 The HuggingFace Inc. team. # SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/magic_mix.py
from typing import Union import torch from PIL import Image from torchvision import transforms as tfms from tqdm.auto import tqdm from transformers import CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/lpw_stable_diffusion_onnx.py
import inspect import re from typing import Callable, List, Optional, Union import numpy as np import PIL.Image import torch from packaging import version from transformers import CLIPImageProcessor, CLIPTokenizer import diffusers from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, SchedulerMixin fro...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/clip_guided_stable_diffusion_img2img.py
import inspect from typing import List, Optional, Union import numpy as np import PIL.Image import torch from torch import nn from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoe...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/unclip_text_interpolation.py
import inspect from typing import List, Optional, Tuple, Union import torch from torch.nn import functional as F from transformers import CLIPTextModelWithProjection, CLIPTokenizer from transformers.models.clip.modeling_clip import CLIPTextModelOutput from diffusers import ( DiffusionPipeline, ImagePipelineOu...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/clip_guided_images_mixing_stable_diffusion.py
# -*- coding: utf-8 -*- import inspect from typing import Optional, Union import numpy as np import PIL.Image import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_unclip.py
import types from typing import List, Optional, Tuple, Union import torch from transformers import CLIPTextModelWithProjection, CLIPTokenizer from transformers.models.clip.modeling_clip import CLIPTextModelOutput from diffusers.models import PriorTransformer from diffusers.pipelines import DiffusionPipeline, StableDi...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_null_text_inversion.py
import inspect import os import numpy as np import torch import torch.nn.functional as nnf from PIL import Image from torch.optim.adam import Adam from tqdm import tqdm from diffusers import StableDiffusionPipeline from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput def retrieve_timesteps...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/mixture_canvas.py
import re from copy import deepcopy from dataclasses import asdict, dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import torch from numpy import exp, pi, sqrt from torchvision.transforms.functional import resize from tqdm.auto import tqdm from transformers import CLIPFeatu...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/pipeline_demofusion_sdxl.py
import inspect import os import random import warnings from typing import Any, Callable, Dict, List, Optional, Tuple, Union import matplotlib.pyplot as plt import torch import torch.nn.functional as F from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers.image_processor imp...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/seed_resize_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 transformers import CLIPImageProcessor, CLIPText...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/stable_diffusion_controlnet_inpaint_img2img.py
# Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/ import inspect from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import PIL.Image import torch import torch.nn.functional as F from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/latent_consistency_interpolate.py
import inspect from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers.image_processor import VaeImageProcessor from diffusers.loaders import FromSingleFileMixin, LoraLoaderMixin, TextualInve...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/community/edict_pipeline.py
from typing import Optional import torch from PIL import Image from tqdm.auto import tqdm from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DiffusionPipeline, UNet2DConditionModel from diffusers.image_processor import VaeImageProcessor from diffusers.utils impor...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/instruct_pix2pix/README_sdxl.md
# InstructPix2Pix SDXL training example ***This is based on the original InstructPix2Pix training example.*** [Stable Diffusion XL](https://huggingface.co/papers/2307.01952) (or SDXL) is the latest image generation model that is tailored towards more photorealistic outputs with more detailed imagery and composition c...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/instruct_pix2pix/test_instruct_pix2pix.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/instruct_pix2pix/train_instruct_pix2pix.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/instruct_pix2pix/README.md
# InstructPix2Pix training example [InstructPix2Pix](https://arxiv.org/abs/2211.09800) is a method to fine-tune text-conditioned diffusion models such that they can follow an edit instruction for an input image. Models fine-tuned using this method take the following as inputs: <p align="center"> <img src="https:/...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/instruct_pix2pix/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 datasets ftfy tensorboard
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 Harutatsu Akiyama and 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....
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/t2i_adapter/README_sdxl.md
# T2I-Adapter training example for Stable Diffusion XL (SDXL) The `train_t2i_adapter_sdxl.py` script shows how to implement the [T2I-Adapter training procedure](https://hf.co/papers/2302.08453) for [Stable Diffusion XL](https://huggingface.co/papers/2307.01952). ## Running locally with PyTorch ### Installing the dep...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/t2i_adapter/README.md
We don't yet support training T2I-Adapters on Stable Diffusion yet. For training T2I-Adapters on Stable Diffusion XL, refer [here](./README_sdxl.md).
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/t2i_adapter/train_t2i_adapter_sdxl.py
#!/usr/bin/env python # coding=utf-8 # 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/LI...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/t2i_adapter/test_t2i_adapter.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/t2i_adapter/requirements.txt
transformers>=4.25.1 accelerate>=0.16.0 safetensors datasets torchvision ftfy tensorboard wandb
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/custom_diffusion/test_custom_diffusion.py
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 or ag...
0