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/examples
hf_public_repos/diffusers/examples/custom_diffusion/README.md
# Custom Diffusion training example [Custom Diffusion](https://arxiv.org/abs/2212.04488) is a method to customize text-to-image models like Stable Diffusion given just a few (4~5) images of a subject. The `train_custom_diffusion.py` script shows how to implement the training procedure and adapt it for stable diffusio...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/custom_diffusion/requirements.txt
accelerate torchvision transformers>=4.25.1 ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/custom_diffusion/retrieve.py
# Copyright 2023 Custom Diffusion authors. 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 appl...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/custom_diffusion/train_custom_diffusion.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 Custom Diffusion authors 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...
0
hf_public_repos/diffusers/examples/wuerstchen
hf_public_repos/diffusers/examples/wuerstchen/text_to_image/README.md
# Würstchen text-to-image fine-tuning ## Running locally with PyTorch Before running the scripts, make sure to install the library's training dependencies: **Important** To make sure you can successfully run the latest versions of the example scripts, we highly recommend **installing from source** and keeping the i...
0
hf_public_repos/diffusers/examples/wuerstchen
hf_public_repos/diffusers/examples/wuerstchen/text_to_image/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 wandb huggingface-cli bitsandbytes deepspeed peft>=0.6.0
0
hf_public_repos/diffusers/examples/wuerstchen
hf_public_repos/diffusers/examples/wuerstchen/text_to_image/train_text_to_image_prior.py
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
0
hf_public_repos/diffusers/examples/wuerstchen
hf_public_repos/diffusers/examples/wuerstchen/text_to_image/modeling_efficient_net_encoder.py
import torch.nn as nn from torchvision.models import efficientnet_v2_l, efficientnet_v2_s from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.models.modeling_utils import ModelMixin class EfficientNetEncoder(ModelMixin, ConfigMixin): @register_to_config def __init__(self,...
0
hf_public_repos/diffusers/examples/wuerstchen
hf_public_repos/diffusers/examples/wuerstchen/text_to_image/train_text_to_image_lora_prior.py
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/unconditional_image_generation/README.md
## Training an unconditional diffusion model Creating a training image set is [described in a different document](https://huggingface.co/docs/datasets/image_process#image-datasets). ### Installing the dependencies Before running the scripts, make sure to install the library's training dependencies: **Important** T...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/unconditional_image_generation/requirements.txt
accelerate>=0.16.0 torchvision datasets
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/unconditional_image_generation/test_unconditional.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/unconditional_image_generation/train_unconditional.py
import argparse import inspect import logging import math import os import shutil from datetime import timedelta from pathlib import Path import accelerate import datasets import torch import torch.nn.functional as F from accelerate import Accelerator, InitProcessGroupKwargs from accelerate.logging import get_logger f...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/inference/README.md
# Inference Examples **The inference examples folder is deprecated and will be removed in a future version**. **Officially supported inference examples can be found in the [Pipelines folder](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines)**. - For `Image-to-Image text-guided generation wit...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/inference/image_to_image.py
import warnings from diffusers import StableDiffusionImg2ImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/inference/inpainting.py
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/reinforcement_learning/run_diffuser_locomotion.py
import d4rl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline config = { "n_samples": 64, "horizon": 32, "num_inference_steps": 20, "n_guide_steps": 2, # can set to 0 for faster sampling, does not use value network "scale_grad_by_std": True, "scale": 0.1,...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/reinforcement_learning/README.md
# Overview These examples show how to run [Diffuser](https://arxiv.org/abs/2205.09991) in Diffusers. There are two ways to use the script, `run_diffuser_locomotion.py`. The key option is a change of the variable `n_guide_steps`. When `n_guide_steps=0`, the trajectories are sampled from the diffusion model, but not ...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/research_projects/README.md
# Research projects This folder contains various research projects using 🧨 Diffusers. They are not really maintained by the core maintainers of this library and often require a specific version of Diffusers that is indicated in the requirements file of each folder. Updating them to the most recent version of the libr...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/intel_opts/README.md
## Diffusers examples with Intel optimizations **This research project is not actively maintained by the diffusers team. For any questions or comments, please make sure to tag @hshen14 .** This aims to provide diffusers examples with Intel optimizations such as Bfloat16 for training/fine-tuning acceleration and 8-bit...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/intel_opts/inference_bf16.py
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline parser = argparse.ArgumentParser("Stable Diffusion script with intel optimization", add_help=False) parser.add_argument("--dpm", action="store_true", help="Enable DPMSol...
0
hf_public_repos/diffusers/examples/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/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/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/textual_inversion/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.21.0 ftfy tensorboard Jinja2 intel_extension_for_pytorch>=1.13
0
hf_public_repos/diffusers/examples/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/textual_inversion/textual_inversion_bf16.py
import argparse import itertools import math import os import random from pathlib import Path import intel_extension_for_pytorch as ipex import numpy as np import PIL import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger ...
0
hf_public_repos/diffusers/examples/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/README.md
# Distillation for quantization on Textual Inversion models to personalize text2image [Textual inversion](https://arxiv.org/abs/2208.01618) is a method to personalize text2image models like stable diffusion on your own images._By using just 3-5 images new concepts can be taught to Stable Diffusion and the model person...
0
hf_public_repos/diffusers/examples/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/textual_inversion.py
import argparse import itertools import math import os import random from pathlib import Path from typing import Iterable import numpy as np import PIL import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.utils import ProjectConfiguration, set_se...
0
hf_public_repos/diffusers/examples/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/text2images.py
import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNet2DConditionModel def parse_args(): parser = argparse.ArgumentParser() ...
0
hf_public_repos/diffusers/examples/research_projects/intel_opts
hf_public_repos/diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/requirements.txt
accelerate torchvision transformers>=4.25.0 ftfy tensorboard modelcards neural-compressor
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/diffusion_dpo/README.md
# Diffusion Model Alignment Using Direct Preference Optimization This directory provides LoRA implementations of Diffusion DPO proposed in [DiffusionModel Alignment Using Direct Preference Optimization](https://arxiv.org/abs/2311.12908) by Bram Wallace, Meihua Dang, Rafael Rafailov, Linqi Zhou, Aaron Lou, Senthil Puru...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/diffusion_dpo/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 ftfy tensorboard Jinja2 peft wandb
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/diffusion_dpo/train_diffusion_dpo.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 bram-w, 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/lic...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/diffusion_dpo/train_diffusion_dpo_sdxl.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 bram-w, 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/lic...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/colossalai/train_dreambooth_colossalai.py
import argparse import math import os from pathlib import Path import colossalai import torch import torch.nn.functional as F import torch.utils.checkpoint from colossalai.context.parallel_mode import ParallelMode from colossalai.core import global_context as gpc from colossalai.logging import disable_existing_loggers...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/colossalai/inference.py
import torch from diffusers import StableDiffusionPipeline model_id = "path-to-your-trained-model" pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda") prompt = "A photo of sks dog in a bucket" image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0] imag...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/colossalai/README.md
# [DreamBooth](https://github.com/huggingface/diffusers/tree/main/examples/dreambooth) by [colossalai](https://github.com/hpcaitech/ColossalAI.git) [DreamBooth](https://arxiv.org/abs/2208.12242) is a method to personalize text2image models like stable diffusion given just a few(3~5) images of a subject. The `train_dre...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/colossalai/requirement.txt
diffusers torch torchvision ftfy tensorboard Jinja2 transformers
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/README_sdxl.md
# ControlNet-XS with Stable Diffusion XL ControlNet-XS was introduced in [ControlNet-XS](https://vislearn.github.io/ControlNet-XS/) by Denis Zavadski and Carsten Rother. It is based on the observation that the control model in the [original ControlNet](https://huggingface.co/papers/2302.05543) can be made much smaller...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/pipeline_controlnet_xs.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/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/infer_sdxl_controlnetxs.py
# !pip install opencv-python transformers accelerate import argparse import cv2 import numpy as np import torch from controlnetxs import ControlNetXSModel from PIL import Image from pipeline_controlnet_xs import StableDiffusionControlNetXSPipeline from diffusers.utils import load_image parser = argparse.ArgumentPar...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/pipeline_controlnet_xs_sd_xl.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/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/README.md
# ControlNet-XS ControlNet-XS was introduced in [ControlNet-XS](https://vislearn.github.io/ControlNet-XS/) by Denis Zavadski and Carsten Rother. It is based on the observation that the control model in the [original ControlNet](https://huggingface.co/papers/2302.05543) can be made much smaller and still produce good r...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/infer_sd_controlnetxs.py
# !pip install opencv-python transformers accelerate import argparse import cv2 import numpy as np import torch from controlnetxs import ControlNetXSModel from PIL import Image from pipeline_controlnet_xs import StableDiffusionControlNetXSPipeline from diffusers.utils import load_image parser = argparse.ArgumentPar...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnetxs/controlnetxs.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/research_projects
hf_public_repos/diffusers/examples/research_projects/onnxruntime/README.md
## Diffusers examples with ONNXRuntime optimizations **This research project is not actively maintained by the diffusers team. For any questions or comments, please contact Prathik Rao (prathikr), Sunghoon Choi (hanbitmyths), Ashwini Khade (askhade), or Peng Wang (pengwa) on github with any questions.** This aims to ...
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/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/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/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/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/textual_inversion/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 ftfy tensorboard modelcards
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/README.md
## Training examples Creating a training image set is [described in a different document](https://huggingface.co/docs/datasets/image_process#image-datasets). ### Installing the dependencies Before running the scripts, make sure to install the library's training dependencies: **Important** To make sure you can succ...
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/requirements.txt
accelerate>=0.16.0 torchvision datasets tensorboard
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py
import argparse import inspect import logging import math import os from pathlib import Path import accelerate import datasets import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration from datasets import...
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/text_to_image/README.md
# Stable Diffusion text-to-image fine-tuning The `train_text_to_image.py` script shows how to fine-tune stable diffusion model on your own dataset. ___Note___: ___This script is experimental. The script fine-tunes the whole model and often times the model overfits and runs into issues like catastrophic forgetting. I...
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/text_to_image/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 datasets ftfy tensorboard modelcards
0
hf_public_repos/diffusers/examples/research_projects/onnxruntime
hf_public_repos/diffusers/examples/research_projects/onnxruntime/text_to_image/train_text_to_image.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/research_projects
hf_public_repos/diffusers/examples/research_projects/realfill/train_realfill.py
import argparse import copy import itertools import logging import math import os import random import shutil from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint import torchvision.transforms.v2 as transforms_v2 import transformers from accelerate impo...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/realfill/README.md
# RealFill [RealFill](https://arxiv.org/abs/2309.16668) is a method to personalize text2image inpainting models like stable diffusion inpainting given just a few(1~5) images of a scene. The `train_realfill.py` script shows how to implement the training procedure for stable diffusion inpainting. ## Running locally wi...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/realfill/requirements.txt
diffusers==0.20.1 accelerate==0.23.0 transformers==4.36.0 peft==0.5.0 torch==2.0.1 torchvision>=0.16 ftfy==6.1.1 tensorboard==2.14.0 Jinja2==3.1.3
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/realfill/infer.py
import argparse import os import torch from PIL import Image, ImageFilter from transformers import CLIPTextModel from diffusers import DPMSolverMultistepScheduler, StableDiffusionInpaintPipeline, UNet2DConditionModel parser = argparse.ArgumentParser(description="Inference") parser.add_argument( "--model_path", ...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/sdxl_flax/README.md
# Stable Diffusion XL for JAX + TPUv5e [TPU v5e](https://cloud.google.com/blog/products/compute/how-cloud-tpu-v5e-accelerates-large-scale-ai-inference) is a new generation of TPUs from Google Cloud. It is the most cost-effective, versatile, and scalable Cloud TPU to date. This makes them ideal for serving and scaling ...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/sdxl_flax/sdxl_single.py
# Show best practices for SDXL JAX import time import jax import jax.numpy as jnp import numpy as np from flax.jax_utils import replicate # Let's cache the model compilation, so that it doesn't take as long the next time around. from jax.experimental.compilation_cache import compilation_cache as cc from diffusers im...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/sdxl_flax/sdxl_single_aot.py
import time import jax import jax.numpy as jnp import numpy as np from flax.jax_utils import replicate from jax import pmap # Let's cache the model compilation, so that it doesn't take as long the next time around. from jax.experimental.compilation_cache import compilation_cache as cc from diffusers import FlaxStabl...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/rdm/README.md
## Diffusers examples with ONNXRuntime optimizations **This research project is not actively maintained by the diffusers team. For any questions or comments, please contact Isamu Isozaki(isamu-isozaki) on github with any questions.** The aim of this project is to provide retrieval augmented diffusion models to diffus...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/rdm/retriever.py
import os from typing import List import faiss import numpy as np import torch from datasets import Dataset, load_dataset from PIL import Image from transformers import CLIPFeatureExtractor, CLIPModel, PretrainedConfig from diffusers import logging logger = logging.get_logger(__name__) # pylint: disable=invalid-na...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/rdm/pipeline_rdm.py
import inspect from typing import Callable, List, Optional, Union import torch from PIL import Image from retriever import Retriever, normalize_images, preprocess_images from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionP...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_subject_dreambooth/README.md
# Multi Subject DreamBooth training [DreamBooth](https://arxiv.org/abs/2208.12242) is a method to personalize text2image models like stable diffusion given just a few(3~5) images of a subject. This `train_multi_subject_dreambooth.py` script shows how to implement the training procedure for one or more subjects and ada...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_subject_dreambooth/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_subject_dreambooth/train_multi_subject_dreambooth.py
import argparse import itertools import json import logging import math import uuid import warnings from os import environ, listdir, makedirs from os.path import basename, join from pathlib import Path from typing import List import datasets import numpy as np import torch import torch.nn.functional as F import torch....
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_token_textual_inversion/multi_token_clip.py
""" The main idea for this code is to provide a way for users to not need to bother with the hassle of multiple tokens for a concept by typing a photo of <concept>_0 <concept>_1 ... and so on and instead just do a photo of <concept> which gets translated to the above. This needs to work for both inference and training....
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_token_textual_inversion/README.md
## [Deprecated] Multi Token Textual Inversion **IMPORTART: This research project is deprecated. Multi Token Textual Inversion is now supported natively in [the official textual inversion example](https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion#running-locally-with-pytorch).** The author ...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_token_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/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_token_textual_inversion/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_token_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/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_token_textual_inversion/requirements_flax.txt
transformers>=4.25.1 flax optax torch torchvision ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/instructpix2pix_lora/train_instruct_pix2pix_lora.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/research_projects
hf_public_repos/diffusers/examples/research_projects/instructpix2pix_lora/README.md
# InstructPix2Pix text-to-edit-image fine-tuning This extended LoRA training script was authored by [Aiden-Frost](https://github.com/Aiden-Frost). This is an experimental LoRA extension of [this example](https://github.com/huggingface/diffusers/blob/main/examples/instruct_pix2pix/train_instruct_pix2pix.py). This script...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/controlnet/train_controlnet_webdataset.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/research_projects
hf_public_repos/diffusers/examples/research_projects/dreambooth_inpaint/train_dreambooth_inpaint.py
import argparse import itertools import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration, set...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/dreambooth_inpaint/train_dreambooth_inpaint_lora.py
import argparse import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration, set_seed from huggin...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/dreambooth_inpaint/README.md
# Dreambooth for the inpainting model This script was added by @thedarkzeno . Please note that this script is not actively maintained, you can open an issue and tag @thedarkzeno or @patil-suraj though. ```bash export MODEL_NAME="runwayml/stable-diffusion-inpainting" export INSTANCE_DIR="path-to-instance-images" expo...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/dreambooth_inpaint/requirements.txt
diffusers==0.9.0 accelerate>=0.16.0 torchvision transformers>=4.21.0 ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_subject_dreambooth_inpainting/train_multi_subject_dreambooth_inpainting.py
import argparse import copy import itertools import logging import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils impor...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_subject_dreambooth_inpainting/README.md
# Multi Subject Dreambooth for Inpainting Models Please note that this project is not actively maintained. However, you can open an issue and tag @gzguevara. [DreamBooth](https://arxiv.org/abs/2208.12242) is a method to personalize text2image models like stable diffusion given just a few(3~5) images of a subject. Thi...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/multi_subject_dreambooth_inpainting/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 datasets>=2.16.0 wandb>=0.16.1 ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/lora/README.md
# Stable Diffusion text-to-image fine-tuning This extended LoRA training script was authored by [haofanwang](https://github.com/haofanwang). This is an experimental LoRA extension of [this example](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py). We further support...
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/lora/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 datasets ftfy tensorboard Jinja2 git+https://github.com/huggingface/peft.git
0
hf_public_repos/diffusers/examples/research_projects
hf_public_repos/diffusers/examples/research_projects/lora/train_text_to_image_lora.py
# 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/LICENSE-2.0 # # Unless r...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/README_sdxl.md
# Stable Diffusion XL text-to-image fine-tuning The `train_text_to_image_sdxl.py` script shows how to fine-tune Stable Diffusion XL (SDXL) on your own dataset. 🚨 This script is experimental. The script fine-tunes the whole model and often times the model overfits and runs into issues like catastrophic forgetting. It...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/requirements_sdxl.txt
accelerate>=0.22.0 torchvision transformers>=4.25.1 ftfy tensorboard Jinja2 datasets peft==0.7.0
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/train_text_to_image_lora_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/text_to_image/test_text_to_image.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/text_to_image/README.md
# Stable Diffusion text-to-image fine-tuning The `train_text_to_image.py` script shows how to fine-tune stable diffusion model on your own dataset. ___Note___: ___This script is experimental. The script fine-tunes the whole model and often times the model overfits and runs into issues like catastrophic forgetting. I...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/train_text_to_image_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/text_to_image/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 datasets ftfy tensorboard Jinja2 peft==0.7.0
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/test_text_to_image_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/text_to_image/train_text_to_image_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 torch import torch.utils.checkpoint import transformers from datasets import load_dataset from flax import jax_utils from flax.training import train_stat...
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/requirements_flax.txt
transformers>=4.25.1 datasets flax optax torch torchvision ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples
hf_public_repos/diffusers/examples/text_to_image/train_text_to_image.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/text_to_image/train_text_to_image_lora.py
# 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/LICENSE-2.0 # # Unless r...
0
hf_public_repos/diffusers/examples/kandinsky2_2
hf_public_repos/diffusers/examples/kandinsky2_2/text_to_image/README.md
# Kandinsky2.2 text-to-image fine-tuning Kandinsky 2.2 includes a prior pipeline that generates image embeddings from text prompts, and a decoder pipeline that generates the output image based on the image embeddings. We provide `train_text_to_image_prior.py` and `train_text_to_image_decoder.py` scripts to show you ho...
0
hf_public_repos/diffusers/examples/kandinsky2_2
hf_public_repos/diffusers/examples/kandinsky2_2/text_to_image/requirements.txt
accelerate>=0.16.0 torchvision transformers>=4.25.1 datasets ftfy tensorboard Jinja2
0
hf_public_repos/diffusers/examples/kandinsky2_2
hf_public_repos/diffusers/examples/kandinsky2_2/text_to_image/train_text_to_image_prior.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