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/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/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/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/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/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/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/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/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/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_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/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_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/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_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/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/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/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/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/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/dreambooth/test_dreambooth_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/dreambooth/requirements.txt | accelerate>=0.16.0
torchvision
transformers>=4.25.1
ftfy
tensorboard
Jinja2
peft==0.7.0 | 0 |
hf_public_repos/diffusers/examples | hf_public_repos/diffusers/examples/dreambooth/train_dreambooth_flax.py | import argparse
import logging
import math
import os
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 flax import jax_utils
from flax.training import train_state
from flax.training.common_utils import shard
f... | 0 |
hf_public_repos/diffusers/examples | hf_public_repos/diffusers/examples/dreambooth/train_dreambooth.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/dreambooth/test_dreambooth.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/dreambooth/train_dreambooth_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 | hf_public_repos/diffusers/examples/dreambooth/README_sdxl.md | # DreamBooth training example for Stable Diffusion XL (SDXL)
[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_dreambooth_lora_sdxl.py` script shows how to implement the training procedure and adapt ... | 0 |
hf_public_repos/diffusers/examples | hf_public_repos/diffusers/examples/dreambooth/README.md | # DreamBooth training example
[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_dreambooth.py` script shows how to implement the training procedure and adapt it for stable diffusion.
## Running local... | 0 |
hf_public_repos/diffusers/examples | hf_public_repos/diffusers/examples/dreambooth/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/dreambooth/train_dreambooth_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/dreambooth/requirements_sdxl.txt | accelerate>=0.16.0
torchvision
transformers>=4.25.1
ftfy
tensorboard
Jinja2
peft==0.7.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_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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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_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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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_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/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/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/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/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/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/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/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/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/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/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/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/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/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 | hf_public_repos/diffusers/scripts/convert_original_audioldm2_to_diffusers.py | # coding=utf-8
# Copyright 2023 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... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/conversion_ldm_uncond.py | import argparse
import OmegaConf
import torch
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... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/convert_asymmetric_vqgan_to_diffusers.py | import argparse
import time
from pathlib import Path
from typing import Any, Dict, Literal
import torch
from diffusers import AsymmetricAutoencoderKL
ASYMMETRIC_AUTOENCODER_KL_x_1_5_CONFIG = {
"in_channels": 3,
"out_channels": 3,
"down_block_types": [
"DownEncoderBlock2D",
"DownEncoderBl... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/convert_original_controlnet_to_diffusers.py | # coding=utf-8
# Copyright 2023 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... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/convert_vae_diff_to_onnx.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 | hf_public_repos/diffusers/scripts/convert_dit_to_diffusers.py | import argparse
import os
import torch
from torchvision.datasets.utils import download_url
from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, Transformer2DModel
pretrained_models = {512: "DiT-XL-2-512x512.pt", 256: "DiT-XL-2-256x256.pt"}
def download_model(model_name):
"""
Downloads a pre-tr... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/convert_diffusers_to_original_stable_diffusion.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 re
import torch
from safetensors.torch import load_file, save_file
# ========... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/convert_wuerstchen.py | # Run inside root directory of official source code: https://github.com/dome272/wuerstchen/
import os
import torch
from transformers import AutoTokenizer, CLIPTextModel
from vqgan import VQModel
from diffusers import (
DDPMWuerstchenScheduler,
WuerstchenCombinedPipeline,
WuerstchenDecoderPipeline,
Wue... | 0 |
hf_public_repos/diffusers | hf_public_repos/diffusers/scripts/convert_shap_e_to_diffusers.py | import argparse
import tempfile
import torch
from accelerate import load_checkpoint_and_dispatch
from diffusers.models.prior_transformer import PriorTransformer
from diffusers.pipelines.shap_e import ShapERenderer
"""
Example - From the diffusers root directory:
Download weights:
```sh
$ wget "https://openaipubli... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.