Skip to content

Commit

Permalink
Support ResAdapter with SDXL-Lightning demo in huggingface
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaxiangc committed Mar 12, 2024
1 parent 6221715 commit 215609d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 31 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AutoML, ByteDance Inc.
![GitHub Org's stars](https://img.shields.io/github/stars/bytedance%2Fres-adapter)

[![Replicate](https://img.shields.io/badge/Demo-Replicate.com-purple)](https://replicate.com/bytedance/res-adapter)
<!-- [![Hugging Face](https://img.shields.io/badge/Demo-%F0%9F%A4%97%20Hugging%20Face-66cdaa)](https://huggingface.co/spaces/ChenyangSi/FreeU) -->
[![Hugging Face](https://img.shields.io/badge/Demo-%F0%9F%A4%97%20Hugging%20Face-66cdaa)](https://huggingface.co/spaces/ameerazam08/Res-Adapter-GPU-Demo)



Expand All @@ -37,7 +37,8 @@ The above images are generated by ResAdapter with [dreamlike-diffusion-1.0](http


## 🚀 Release
- `[2024/03/12]` We support [gradio demo](https://replicate.com/bytedance/res-adapter) in `replicate.com` (by [@chenxiwh](https://github.com/chenxwh))
- `[2024/03/12]` We support [gradio demo with SDXL-Lightning](https://replicate.com/bytedance/res-adapter) in `huggingface.com` (by [@Ameer Azam](https://github.com/AMEERAZAM08))
- `[2024/03/12]` We support [gradio demo with SDXL-Lightning](https://replicate.com/bytedance/res-adapter) in `replicate.com` (by [@chenxiwh](https://github.com/chenxwh))
- `[2024/03/12]` We release the [resadapter-sdv15](https://huggingface.co/jiaxiangc/res-adapter/tree/main/sd1.5) that supports `128~1024` resolution.
- `[2024/03/05]` We release the paper about [resadapter](https://arxiv.org/abs/2403.02084) to arxiv.
- `[2024/03/04]` We release the inference codes and [resadapter-sdv15-i](https://huggingface.co/jiaxiangc/res-adapter/tree/main/sd1.5-i) that supports `128~512`, and [resadapter-xl-i](https://huggingface.co/jiaxiangc/res-adapter/tree/main/sdxl-i) that supports `256~1024`.
Expand Down Expand Up @@ -110,21 +111,27 @@ images = pipe(
save_image(images, f"resadapter_{width}.png", normalize=True, padding=0)
```

## 🎉 Use ResAdapter in Gradio
## 🎉 Support ResAdapter in Gradio

<!-- 🔥 We are happy to provide two demos in `replicate.com` and `huggingface.com`. -->
🔥 [Update at 2024/03/12] We are happy to provide demos in `replicate.com`.
🔥 [Update at 2024/03/12] We are happy to provide two demos in `replicate.com` and `huggingface.com`.

Relicate demo: [bytedance/res-adapter](https://replicate.com/bytedance/res-adapter), by ([@chenxiwh](https://github.com/chenxwh))

Huggingface demo: [ameerazam08/Res-Adapter-GPU-Demo](https://huggingface.co/spaces/ameerazam08/Res-Adapter-GPU-Demo), (by [@Ameer Azam](https://github.com/AMEERAZAM08))

<!-- 2. Huggingface demo: [jiaxiangc/ReAdapter-SDXL-Lightning]() in huggingface, which is developed by -->
<div align=center>
<img src="assets/misc/replicate_demo.jpeg" width="56.4%"><img src="assets/misc/huggingface_demo.jpeg" width="43.6%">

## 🎉 Use ResAdapter in ComfyUI
Left: ResAdapter with SDXL-Lightning in `Replicate.com`, Right: ResAdapter with SDXL-Lightning in `Huggingface.com`

We will support ComfyUI within a week.
</div>


<!-- 2. Huggingface demo: [jiaxiangc/ReAdapter-SDXL-Lightning]() in huggingface, which is developed by -->

## 🎉 Support ResAdapter in ComfyUI

We will support ComfyUI within a week.


## ⏬ Installation
Expand Down
12 changes: 7 additions & 5 deletions models/res_adapter/gradio-demo/app.py → app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import PIL.Image

import spaces
# import spaces
import torch
from diffusers import (
StableDiffusionXLPipeline,
Expand Down Expand Up @@ -35,7 +35,8 @@



base = "stabilityai/stable-diffusion-xl-base-1.0"
# base = "stabilityai/stable-diffusion-xl-base-1.0"
base = "/mnt/bn/automl-aigc/chengjiaxiang/models/diffusers/dreamshaper-xl-1-0"
repo = "ByteDance/SDXL-Lightning"
ckpt = "sdxl_lightning_4step_unet.safetensors" # Use the correct ckpt for your step setting!

Expand Down Expand Up @@ -66,7 +67,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
return seed


@spaces.GPU(enable_queue=True)
# @spaces.GPU(enable_queue=True)
def generate(
prompt: str,
negative_prompt: str = "",
Expand Down Expand Up @@ -128,6 +129,7 @@ def generate(

examples = [
"A girl smiling",
"A boy smiling",
"A realistic photograph of an astronaut in a jungle, cold color palette, detailed, 8k",

]
Expand Down Expand Up @@ -195,14 +197,14 @@ def generate(
minimum=256,
maximum=MAX_IMAGE_SIZE,
step=32,
value=1024,
value=512,
)
height = gr.Slider(
label="Height",
minimum=256,
maximum=MAX_IMAGE_SIZE,
step=32,
value=1024,
value=512,
)
with gr.Row():
guidance_scale_base = gr.Slider(
Expand Down
Binary file added assets/misc/huggingface_demo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/misc/replicate_demo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions models/res_adapter/gradio-demo/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions models/res_adapter/gradio-demo/requirements.txt

This file was deleted.

0 comments on commit 215609d

Please sign in to comment.