lehduong/OneDiffusion

★ 666⑂ 19

Official implementation of OneDiffusion paper (CVPR 2025)

About lehduong/OneDiffusion

lehduong/OneDiffusion is an open-source project on GitHub, mainly written in Python. Official implementation of OneDiffusion paper (CVPR 2025) It currently holds 666 stars and 19 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Image Projects board and on the AI AI Image Projects list.

GitHub Repository Details

Repository lehduong/OneDiffusion · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

One Diffusion to Generate Them All

https://github.com/lehduong/OneDiffusion/blob/HEAD/Build https://github.com/lehduong/OneDiffusion/blob/HEAD/Build https://github.com/lehduong/OneDiffusion/blob/HEAD/License https://github.com/lehduong/OneDiffusion/blob/HEAD/Build

News | Quick start | Prompt guide & Supported tasks | Qualitative results | License | Citation

https://github.com/lehduong/OneDiffusion/blob/HEAD/Teaser Image

This is official repo of OneDiffusion, a versatile, large-scale diffusion model that seamlessly supports bidirectional image synthesis and understanding across diverse tasks.

For more detail, read our paper here.

News

Installation

conda create -n onediffusion_env python=3.8 &&
conda activate onediffusion_env &&
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118 &&
pip install "git+https://github.com/facebookresearch/pytorch3d.git" &&
pip install -r requirements.txt

Quick start

Check inference.py for more detailed. For text-to-image, you can use below code snipe.

import torch
from onediffusion.diffusion.pipelines.onediffusion import OneDiffusionPipeline

device = torch.device('cuda:0')

pipeline = OneDiffusionPipeline.from_pretrained("lehduong/OneDiffusion").to(device=device, dtype=torch.bfloat16)

NEGATIVE_PROMPT = "monochrome, greyscale, low-res, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation"

output = pipeline( prompt="[[text2image]] A bipedal black cat wearing a huge oversized witch hat, a wizards robe, casting a spell,in an enchanted forest. The scene is filled with fireflies and moss on surrounding rocks and trees", negative_prompt=NEGATIVE_PROMPT, num_inference_steps=50, guidance_scale=4, height=1024, width=1024, ) output.images[0].save('text2image_output.jpg')

You can run the gradio demo with:

python gradio_demo.py --captioner molmo # [molmo, llava, disable]
The demo provides guidance and helps format the prompt properly for each task. Note that the above required memory can change if you use higher resolution or more input images.

Qualitative Results

1. Text-to-Image

https://github.com/lehduong/OneDiffusion/blob/HEAD/Text-to-Image results

2. ID customization

https://github.com/lehduong/OneDiffusion/blob/HEAD/ID customization

https://github.com/lehduong/OneDiffusion/blob/HEAD/ID customization non-human subject

3. Multiview generation

Single image to multiview:

https://github.com/lehduong/OneDiffusion/blob/HEAD/Image to multiview

https://github.com/lehduong/OneDiffusion/blob/HEAD/image to multiview

Text to multiview:

https://github.com/lehduong/OneDiffusion/blob/HEAD/Text to multiview image

4. Condition-to-Image and vice versa

https://github.com/lehduong/OneDiffusion/blob/HEAD/Condition and Image

5. Subject-driven generation

We finetuned the model on Subject-200K dataset (along with all other tasks) for additional 40k steps. The model is now capable of subject-driven generation.

https://github.com/lehduong/OneDiffusion/blob/HEAD/Subject driven generation

6. Text-guide image editing

We finetuned the model on OmniEdit dataset for additional 30K steps.

https://github.com/lehduong/OneDiffusion/blob/HEAD/Text-guide editing

7. Zero-shot Task combinations

We found that the model can handle multiple tasks in a zero-shot setting by combining condition images and task tokens without any fine-tuning, as shown in the examples below. However, its performance on these combined tasks might not be robust, and the model’s behavior may change if the order of task tokens or captions is altered. For example, when using both image inpainting and ID customization together, the target prompt and the caption of the masked image must be identical. If you plan to use such combinations, we recommend fine-tuning the model on these tasks to achieve better performance and simpler usage.

https://github.com/lehduong/OneDiffusion/blob/HEAD/Subject driven generation

License

The model is trained on several non-commercially licensed datasets (e.g., DL3DV, Unsplash), thus, model weights are released under a CC BY-NC license as described in LICENSE.

Citation

@misc{le2024diffusiongenerate,
      title={One Diffusion to Generate Them All}, 
      author={Duong H. Le and Tuan Pham and Sangho Lee and Christopher Clark and Aniruddha Kembhavi and Stephan Mandt and Ranjay Krishna and Jiasen Lu},
      year={2024},
      eprint={2411.16318},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2411.16318}, 
}

GitHub Stars & Activity

666Stars
19Forks
0Open issues
PythonLanguage

GitHub Popularity

GitHub stars666
Forks19
Open issues0
Primary languagePython
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

ultralytics / ultralytics

Python★ 61,829⑂ 11,787
2

ultralytics / yolov5

Python★ 58,057⑂ 17,469
3

roboflow / supervision

Python★ 50,960⑂ 4,848
4

lucidrains / vit-pytorch

Python★ 25,514⑂ 3,495
5

junyanz / pytorch-CycleGAN-and-pix2pix

Python★ 25,244⑂ 6,567
6

graphdeco-inria / gaussian-splatting

Python★ 23,930⑂ 3,434
7

pytorch / vision

Python★ 17,921⑂ 7,265
8

cvat-ai / cvat

Python★ 16,758⑂ 3,871

More AI Rankings