Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8d6360937 | |||
| b67ca19367 | |||
| 9941f1f61b | |||
| 46a9db0336 | |||
| 370146e4e0 | |||
| 5cd45c24bf |
@@ -69,6 +69,7 @@ jobs:
|
|||||||
- diffusers-flax-tpu
|
- diffusers-flax-tpu
|
||||||
- diffusers-onnxruntime-cpu
|
- diffusers-onnxruntime-cpu
|
||||||
- diffusers-onnxruntime-cuda
|
- diffusers-onnxruntime-cuda
|
||||||
|
- diffusers-doc-builder
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
package: diffusers
|
package: diffusers
|
||||||
notebook_folder: diffusers_doc
|
notebook_folder: diffusers_doc
|
||||||
languages: en ko zh ja pt
|
languages: en ko zh ja pt
|
||||||
|
custom_container: diffusers/diffusers-doc-builder
|
||||||
secrets:
|
secrets:
|
||||||
token: ${{ secrets.HUGGINGFACE_PUSH }}
|
token: ${{ secrets.HUGGINGFACE_PUSH }}
|
||||||
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
||||||
|
|||||||
@@ -20,3 +20,4 @@ jobs:
|
|||||||
install_libgl1: true
|
install_libgl1: true
|
||||||
package: diffusers
|
package: diffusers
|
||||||
languages: en ko zh ja pt
|
languages: en ko zh ja pt
|
||||||
|
custom_container: diffusers/diffusers-doc-builder
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
FROM ubuntu:20.04
|
||||||
|
LABEL maintainer="Hugging Face"
|
||||||
|
LABEL repository="diffusers"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get -y update \
|
||||||
|
&& apt-get install -y software-properties-common \
|
||||||
|
&& add-apt-repository ppa:deadsnakes/ppa
|
||||||
|
|
||||||
|
RUN apt install -y bash \
|
||||||
|
build-essential \
|
||||||
|
git \
|
||||||
|
git-lfs \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
libsndfile1-dev \
|
||||||
|
python3.10 \
|
||||||
|
python3-pip \
|
||||||
|
libgl1 \
|
||||||
|
python3.10-venv && \
|
||||||
|
rm -rf /var/lib/apt/lists
|
||||||
|
|
||||||
|
# make sure to use venv
|
||||||
|
RUN python3.10 -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
# pre-install the heavy dependencies (these can later be overridden by the deps from setup.py)
|
||||||
|
RUN python3.10 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
|
||||||
|
python3.10 -m uv pip install --no-cache-dir \
|
||||||
|
torch \
|
||||||
|
torchvision \
|
||||||
|
torchaudio \
|
||||||
|
invisible_watermark \
|
||||||
|
--extra-index-url https://download.pytorch.org/whl/cpu && \
|
||||||
|
python3.10 -m uv pip install --no-cache-dir \
|
||||||
|
accelerate \
|
||||||
|
datasets \
|
||||||
|
hf-doc-builder \
|
||||||
|
huggingface-hub \
|
||||||
|
Jinja2 \
|
||||||
|
librosa \
|
||||||
|
numpy \
|
||||||
|
scipy \
|
||||||
|
tensorboard \
|
||||||
|
transformers \
|
||||||
|
matplotlib \
|
||||||
|
setuptools==69.5.1
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
||||||
@@ -69,6 +69,7 @@ Please also check out our [Community Scripts](https://github.com/huggingface/dif
|
|||||||
| UFOGen Scheduler | Scheduler for UFOGen Model (compatible with Stable Diffusion pipelines) | [UFOGen Scheduler](#ufogen-scheduler) | - | [dg845](https://github.com/dg845) |
|
| UFOGen Scheduler | Scheduler for UFOGen Model (compatible with Stable Diffusion pipelines) | [UFOGen Scheduler](#ufogen-scheduler) | - | [dg845](https://github.com/dg845) |
|
||||||
| Stable Diffusion XL IPEX Pipeline | Accelerate Stable Diffusion XL inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [Stable Diffusion XL on IPEX](#stable-diffusion-xl-on-ipex) | - | [Dan Li](https://github.com/ustcuna/) |
|
| Stable Diffusion XL IPEX Pipeline | Accelerate Stable Diffusion XL inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [Stable Diffusion XL on IPEX](#stable-diffusion-xl-on-ipex) | - | [Dan Li](https://github.com/ustcuna/) |
|
||||||
| Stable Diffusion BoxDiff Pipeline | Training-free controlled generation with bounding boxes using [BoxDiff](https://github.com/showlab/BoxDiff) | [Stable Diffusion BoxDiff Pipeline](#stable-diffusion-boxdiff) | - | [Jingyang Zhang](https://github.com/zjysteven/) |
|
| Stable Diffusion BoxDiff Pipeline | Training-free controlled generation with bounding boxes using [BoxDiff](https://github.com/showlab/BoxDiff) | [Stable Diffusion BoxDiff Pipeline](#stable-diffusion-boxdiff) | - | [Jingyang Zhang](https://github.com/zjysteven/) |
|
||||||
|
| FRESCO V2V Pipeline | Implementation of [[CVPR 2024] FRESCO: Spatial-Temporal Correspondence for Zero-Shot Video Translation](https://arxiv.org/abs/2403.12962) | [FRESCO V2V Pipeline](#fresco) | - | [Yifan Zhou](https://github.com/SingleZombie) |
|
||||||
|
|
||||||
To load a custom pipeline you just need to pass the `custom_pipeline` argument to `DiffusionPipeline`, as one of the files in `diffusers/examples/community`. Feel free to send a PR with your own pipelines, we will merge them quickly.
|
To load a custom pipeline you just need to pass the `custom_pipeline` argument to `DiffusionPipeline`, as one of the files in `diffusers/examples/community`. Feel free to send a PR with your own pipelines, we will merge them quickly.
|
||||||
|
|
||||||
@@ -4035,6 +4036,93 @@ onestep_image = pipe(prompt, num_inference_steps=1).images[0]
|
|||||||
multistep_image = pipe(prompt, num_inference_steps=4).images[0]
|
multistep_image = pipe(prompt, num_inference_steps=4).images[0]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### FRESCO
|
||||||
|
|
||||||
|
This is the Diffusers implementation of zero-shot video-to-video translation pipeline [FRESCO](https://github.com/williamyang1991/FRESCO) (without Ebsynth postprocessing and background smooth). To run the code, please install gmflow. Then modify the path in `gmflow_dir`. After that, you can run the pipeline with:
|
||||||
|
|
||||||
|
```py
|
||||||
|
from PIL import Image
|
||||||
|
import cv2
|
||||||
|
import torch
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from diffusers import ControlNetModel,DDIMScheduler, DiffusionPipeline
|
||||||
|
import sys
|
||||||
|
gmflow_dir = "/path/to/gmflow"
|
||||||
|
sys.path.insert(0, gmflow_dir)
|
||||||
|
|
||||||
|
def video_to_frame(video_path: str, interval: int):
|
||||||
|
vidcap = cv2.VideoCapture(video_path)
|
||||||
|
success = True
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
res = []
|
||||||
|
while success:
|
||||||
|
count += 1
|
||||||
|
success, image = vidcap.read()
|
||||||
|
if count % interval != 1:
|
||||||
|
continue
|
||||||
|
if image is not None:
|
||||||
|
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
||||||
|
res.append(image)
|
||||||
|
if len(res) >= 8:
|
||||||
|
break
|
||||||
|
|
||||||
|
vidcap.release()
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
input_video_path = 'https://github.com/williamyang1991/FRESCO/raw/main/data/car-turn.mp4'
|
||||||
|
output_video_path = 'car.gif'
|
||||||
|
|
||||||
|
# You can use any fintuned SD here
|
||||||
|
model_path = 'SG161222/Realistic_Vision_V2.0'
|
||||||
|
|
||||||
|
prompt = 'a red car turns in the winter'
|
||||||
|
a_prompt = ', RAW photo, subject, (high detailed skin:1.2), 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3, '
|
||||||
|
n_prompt = '(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, mutated hands and fingers:1.4), (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated, ugly, disgusting, amputation'
|
||||||
|
|
||||||
|
input_interval = 5
|
||||||
|
frames = video_to_frame(
|
||||||
|
input_video_path, input_interval)
|
||||||
|
|
||||||
|
control_frames = []
|
||||||
|
# get canny image
|
||||||
|
for frame in frames:
|
||||||
|
image = cv2.Canny(frame, 50, 100)
|
||||||
|
np_image = np.array(image)
|
||||||
|
np_image = np_image[:, :, None]
|
||||||
|
np_image = np.concatenate([np_image, np_image, np_image], axis=2)
|
||||||
|
canny_image = Image.fromarray(np_image)
|
||||||
|
control_frames.append(canny_image)
|
||||||
|
|
||||||
|
# You can use any ControlNet here
|
||||||
|
controlnet = ControlNetModel.from_pretrained(
|
||||||
|
"lllyasviel/sd-controlnet-canny").to('cuda')
|
||||||
|
|
||||||
|
pipe = DiffusionPipeline.from_pretrained(
|
||||||
|
model_path, controlnet=controlnet, custom_pipeline='fresco_v2v').to('cuda')
|
||||||
|
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
|
||||||
|
|
||||||
|
generator = torch.manual_seed(0)
|
||||||
|
frames = [Image.fromarray(frame) for frame in frames]
|
||||||
|
|
||||||
|
output_frames = pipe(
|
||||||
|
prompt + a_prompt,
|
||||||
|
frames,
|
||||||
|
control_frames,
|
||||||
|
num_inference_steps=20,
|
||||||
|
strength=0.75,
|
||||||
|
controlnet_conditioning_scale=0.7,
|
||||||
|
generator=generator,
|
||||||
|
negative_prompt=n_prompt
|
||||||
|
).images
|
||||||
|
|
||||||
|
output_frames[0].save(output_video_path, save_all=True,
|
||||||
|
append_images=output_frames[1:], duration=100, loop=0)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
# Perturbed-Attention Guidance
|
# Perturbed-Attention Guidance
|
||||||
|
|
||||||
[Project](https://ku-cvlab.github.io/Perturbed-Attention-Guidance/) / [arXiv](https://arxiv.org/abs/2403.17377) / [GitHub](https://github.com/KU-CVLAB/Perturbed-Attention-Guidance)
|
[Project](https://ku-cvlab.github.io/Perturbed-Attention-Guidance/) / [arXiv](https://arxiv.org/abs/2403.17377) / [GitHub](https://github.com/KU-CVLAB/Perturbed-Attention-Guidance)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,7 @@ from ..utils import (
|
|||||||
is_transformers_available,
|
is_transformers_available,
|
||||||
is_xformers_available,
|
is_xformers_available,
|
||||||
)
|
)
|
||||||
|
from ..utils.testing_utils import get_python_version
|
||||||
from . import BaseDiffusersCLICommand
|
from . import BaseDiffusersCLICommand
|
||||||
|
|
||||||
|
|
||||||
@@ -105,6 +106,11 @@ class EnvironmentCommand(BaseDiffusersCLICommand):
|
|||||||
|
|
||||||
xformers_version = xformers.__version__
|
xformers_version = xformers.__version__
|
||||||
|
|
||||||
|
if get_python_version() >= (3, 10):
|
||||||
|
platform_info = f"{platform.freedesktop_os_release().get('PRETTY_NAME', None)} - {platform.platform()}"
|
||||||
|
else:
|
||||||
|
platform_info = platform.platform()
|
||||||
|
|
||||||
is_notebook_str = "Yes" if is_notebook() else "No"
|
is_notebook_str = "Yes" if is_notebook() else "No"
|
||||||
|
|
||||||
is_google_colab_str = "Yes" if is_google_colab() else "No"
|
is_google_colab_str = "Yes" if is_google_colab() else "No"
|
||||||
@@ -152,7 +158,7 @@ class EnvironmentCommand(BaseDiffusersCLICommand):
|
|||||||
|
|
||||||
info = {
|
info = {
|
||||||
"🤗 Diffusers version": version,
|
"🤗 Diffusers version": version,
|
||||||
"Platform": f"{platform.freedesktop_os_release().get('PRETTY_NAME', None)} - {platform.platform()}",
|
"Platform": platform_info,
|
||||||
"Running on a notebook?": is_notebook_str,
|
"Running on a notebook?": is_notebook_str,
|
||||||
"Running on Google Colab?": is_google_colab_str,
|
"Running on Google Colab?": is_google_colab_str,
|
||||||
"Python version": platform.python_version(),
|
"Python version": platform.python_version(),
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ class FromSingleFileMixin:
|
|||||||
deprecate("original_config_file", "1.0.0", deprecation_message)
|
deprecate("original_config_file", "1.0.0", deprecation_message)
|
||||||
original_config = original_config_file
|
original_config = original_config_file
|
||||||
|
|
||||||
resume_download = kwargs.pop("resume_download", False)
|
resume_download = kwargs.pop("resume_download", None)
|
||||||
force_download = kwargs.pop("force_download", False)
|
force_download = kwargs.pop("force_download", False)
|
||||||
proxies = kwargs.pop("proxies", None)
|
proxies = kwargs.pop("proxies", None)
|
||||||
token = kwargs.pop("token", None)
|
token = kwargs.pop("token", None)
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class FromOriginalModelMixin:
|
|||||||
"`from_single_file` cannot accept both `config` and `original_config` arguments. Please provide only one of these arguments"
|
"`from_single_file` cannot accept both `config` and `original_config` arguments. Please provide only one of these arguments"
|
||||||
)
|
)
|
||||||
|
|
||||||
resume_download = kwargs.pop("resume_download", False)
|
resume_download = kwargs.pop("resume_download", None)
|
||||||
force_download = kwargs.pop("force_download", False)
|
force_download = kwargs.pop("force_download", False)
|
||||||
proxies = kwargs.pop("proxies", None)
|
proxies = kwargs.pop("proxies", None)
|
||||||
token = kwargs.pop("token", None)
|
token = kwargs.pop("token", None)
|
||||||
|
|||||||
Reference in New Issue
Block a user