Text-to-Image
Diffusers
English
controllable text-to-image generation
diffusion models
3D layout control
occlusion reasoning
Instructions to use va1bhavagrawa1/seethrough3d with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use va1bhavagrawa1/seethrough3d with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("va1bhavagrawa1/seethrough3d", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Commit Β·
5da6d82
1
Parent(s): 2793fa3
updated README
Browse files- README.md +11 -5
- assets/teaser_camera_ready.png +3 -0
- dataset/download.py +17 -0
- dataset/setup_data.sh +2 -0
- inference/config.py +3 -4
- train/train.sh +2 -2
README.md
CHANGED
|
@@ -20,7 +20,7 @@ tags: # Add extra tags which would make the repo sear
|
|
| 20 |
|
| 21 |
|
| 22 |
<div align="center">
|
| 23 |
-
<img src="assets/teaser_camera_ready.
|
| 24 |
</div>
|
| 25 |
|
| 26 |
## π Getting Started
|
|
@@ -43,7 +43,7 @@ pip install -e .
|
|
| 43 |
|
| 44 |
Inference of this model requires ~38 GB VRAM on the GPU. Note that the inference runs Blender in EEVEE mode, which runs faster on workstation GPUs like the NVIDIA RTX A6000, compared to data center GPUs like the NVIDIA H100.
|
| 45 |
|
| 46 |
-
### π
|
| 47 |
|
| 48 |
We use [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) as the base model. To download the SeeThrough3D LoRA checkpoint,
|
| 49 |
```bash
|
|
@@ -56,7 +56,7 @@ cd checkpoints
|
|
| 56 |
### π€ Gradio Interface
|
| 57 |
|
| 58 |
It is best to perform inference using the π€ Gradio interface, which makes it easy to specify 3D layouts. To launch the interface, run
|
| 59 |
-
```
|
| 60 |
cd inference
|
| 61 |
conda activate st3d
|
| 62 |
python3 app.py
|
|
@@ -79,15 +79,21 @@ The inference notebook is located at `infer.ipynb`. It is able to load a scene s
|
|
| 79 |
|
| 80 |
## π Training
|
| 81 |
|
| 82 |
-
### π
|
|
|
|
| 83 |
|
| 84 |
```bash
|
| 85 |
cd dataset
|
| 86 |
-
|
|
|
|
| 87 |
```
|
| 88 |
|
|
|
|
|
|
|
| 89 |
### π Run Training
|
| 90 |
|
|
|
|
|
|
|
| 91 |
We train the model for a single epoch at resolution 512, effective batch size of 2 (~25K steps). This requires 2x 80 GB GPUs (one image per GPU).
|
| 92 |
```bash
|
| 93 |
cd train
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
<div align="center">
|
| 23 |
+
<img src="assets/teaser_camera_ready.png" width="50%">
|
| 24 |
</div>
|
| 25 |
|
| 26 |
## π Getting Started
|
|
|
|
| 43 |
|
| 44 |
Inference of this model requires ~38 GB VRAM on the GPU. Note that the inference runs Blender in EEVEE mode, which runs faster on workstation GPUs like the NVIDIA RTX A6000, compared to data center GPUs like the NVIDIA H100.
|
| 45 |
|
| 46 |
+
### π Download the Pre-Trained Checkpoint
|
| 47 |
|
| 48 |
We use [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) as the base model. To download the SeeThrough3D LoRA checkpoint,
|
| 49 |
```bash
|
|
|
|
| 56 |
### π€ Gradio Interface
|
| 57 |
|
| 58 |
It is best to perform inference using the π€ Gradio interface, which makes it easy to specify 3D layouts. To launch the interface, run
|
| 59 |
+
```bash
|
| 60 |
cd inference
|
| 61 |
conda activate st3d
|
| 62 |
python3 app.py
|
|
|
|
| 79 |
|
| 80 |
## π Training
|
| 81 |
|
| 82 |
+
### π Download the Dataset
|
| 83 |
+
By default, the data is downloaded in the `dataset` directory. To change the download location, edit the `LOCAL_DIR` variable in `dataset/download.py`.
|
| 84 |
|
| 85 |
```bash
|
| 86 |
cd dataset
|
| 87 |
+
conda activate st3d
|
| 88 |
+
./setup_data.sh
|
| 89 |
```
|
| 90 |
|
| 91 |
+
We are working on making the data compatible with π€ datasets library for ease of visualization and streaming, see [`va1bhavagrawa1/seethrough3d-data`](https://huggingface.co/datasets/va1bhavagrawa1/seethrough3d-data/tree/main)
|
| 92 |
+
|
| 93 |
### π Run Training
|
| 94 |
|
| 95 |
+
Edit `train/train.sh` to specify the downloaded dataset path.
|
| 96 |
+
|
| 97 |
We train the model for a single epoch at resolution 512, effective batch size of 2 (~25K steps). This requires 2x 80 GB GPUs (one image per GPU).
|
| 98 |
```bash
|
| 99 |
cd train
|
assets/teaser_camera_ready.png
ADDED
|
Git LFS Details
|
dataset/download.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import hf_hub_download
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
LOCAL_DIR = "."
|
| 5 |
+
|
| 6 |
+
repo_id = "va1bhavagrawa1/seethrough3d-data"
|
| 7 |
+
file_in_repo = "seethrough3d_data.tar" # change this
|
| 8 |
+
|
| 9 |
+
local_path = hf_hub_download(
|
| 10 |
+
repo_id=repo_id,
|
| 11 |
+
filename=file_in_repo,
|
| 12 |
+
repo_type="dataset",
|
| 13 |
+
local_dir=LOCAL_DIR, # current directory
|
| 14 |
+
local_dir_use_symlinks=False # makes a real copy (not symlink)
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
print("Downloaded to:", os.path.abspath(local_path))
|
dataset/setup_data.sh
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
python3 download.py
|
| 2 |
+
tar -xvf seethrough3d_data.tar
|
inference/config.py
CHANGED
|
@@ -16,10 +16,9 @@ SAVED_SCENES_DIR = os.path.join(BASE_DIR, "saved_scenes")
|
|
| 16 |
PRETRAINED_MODEL_NAME_OR_PATH = "black-forest-labs/FLUX.1-dev"
|
| 17 |
|
| 18 |
# The root directory where LoRA fine-tunes are stored
|
| 19 |
-
LORA_WEIGHTS_ROOT =
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
INFERENCE_EMBEDS_DIR = "/archive/vaibhav.agrawal/a-bev-of-the-latents/inference_embeds_flux2"
|
| 23 |
|
| 24 |
# Available Checkpoint weights (dropdown options)
|
| 25 |
CHECKPOINT_NAMES = [
|
|
|
|
| 16 |
PRETRAINED_MODEL_NAME_OR_PATH = "black-forest-labs/FLUX.1-dev"
|
| 17 |
|
| 18 |
# The root directory where LoRA fine-tunes are stored
|
| 19 |
+
LORA_WEIGHTS_ROOT = os.path.join(os.path.dirname(BASE_DIR), "checkpoints")
|
| 20 |
+
if not os.path.exists(LORA_WEIGHTS_ROOT):
|
| 21 |
+
raise FileNotFoundError(f"LoRA weights root directory not found: {LORA_WEIGHTS_ROOT}")
|
|
|
|
| 22 |
|
| 23 |
# Available Checkpoint weights (dropdown options)
|
| 24 |
CHECKPOINT_NAMES = [
|
train/train.sh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
export MODEL_DIR="black-forest-labs/FLUX.1-dev" # your flux path
|
| 2 |
-
export OUTPUT_DIR="
|
| 3 |
export CONFIG="./default_config.yaml"
|
| 4 |
-
export TRAIN_DATA="
|
| 5 |
export LOG_PATH="$OUTPUT_DIR/log"
|
| 6 |
|
| 7 |
accelerate launch --config_file $CONFIG train.py \
|
|
|
|
| 1 |
export MODEL_DIR="black-forest-labs/FLUX.1-dev" # your flux path
|
| 2 |
+
export OUTPUT_DIR="../checkpoints" # your save path
|
| 3 |
export CONFIG="./default_config.yaml"
|
| 4 |
+
export TRAIN_DATA="../dataset/seethrough3d_data/train.jsonl" # your data jsonl file
|
| 5 |
export LOG_PATH="$OUTPUT_DIR/log"
|
| 6 |
|
| 7 |
accelerate launch --config_file $CONFIG train.py \
|