Skip to content

Commit b4a3a29

Browse files
chopper.leejeongyw12382chiheonkMinsu ChoLeeDoYup
committed
initial commit
Co-authored-by: Yoonwoo Jeong <jeongyw12382@postech.ac.kr> Co-authored-by: Jinwoo Lee <chopper.lee@kakaobrain.com> Co-authored-by: Chiheon Kim <chiheon.kim@kakaobrain.com> Co-authored-by: Minsu Cho <mscho@postech.ac.kr> Co-authored-by: Doyup Lee <doyup@runwayml.com>
1 parent 2352f8d commit b4a3a29

File tree

211 files changed

+156575
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+156575
-0
lines changed

.github/workflows/black.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Run black
2+
on: [pull_request]
3+
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- name: Install venv
10+
run: |
11+
sudo apt-get -y install python3.10-venv
12+
- uses: psf/black@stable
13+
with:
14+
options: "--check --verbose -l88"
15+
src: "./sgm ./scripts ./main.py"

.github/workflows/test-build.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build package
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.8", "3.10"]
16+
requirements-file: ["pt2", "pt13"]
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements/${{ matrix.requirements-file }}.txt
27+
pip install .

.github/workflows/test-inference.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test inference
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
name: "Test inference"
12+
# This action is designed only to run on the Stability research cluster at this time, so many assumptions are made about the environment
13+
if: github.repository == 'stability-ai/generative-models'
14+
runs-on: [self-hosted, slurm, g40]
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: "Symlink checkpoints"
18+
run: ln -s ${{vars.SGM_CHECKPOINTS_PATH}} checkpoints
19+
- name: "Setup python"
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.10"
23+
- name: "Install Hatch"
24+
run: pip install hatch
25+
- name: "Run inference tests"
26+
run: hatch run ci:test-inference --junit-xml test-results.xml
27+
- name: Surface failing tests
28+
if: always()
29+
uses: pmeier/pytest-results-action@main
30+
with:
31+
path: test-results.xml
32+
summary: true
33+
display-options: fEX
34+
fail-on-empty: true

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "thirdparty/carvekit"]
2+
path = thirdparty/carvekit
3+
url = https://github.com/OPHoperHPO/image-background-remove-tool.git

.project-root

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# this file is required for inferring the project root directory
2+
# do not delete

3drec/configs/nvsadapter.yaml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: "nvsadapter"
2+
tag: "${data.random_camera.height}_${rmspace:${basename:${data.image_path}},_}_prog${data.random_camera.progressive_until}"
3+
exp_root_dir: "./outputs"
4+
seed: 0
5+
6+
data_type: "single-image-datamodule"
7+
data: # threestudio/data/image.py -> SingleImageDataModuleConfig
8+
image_path: ./load/images/hamburger_rgba.png
9+
height: [128, 128, 512]
10+
width: [128, 128, 512]
11+
resolution_milestones: [2000, 5000]
12+
default_elevation_deg: 0.0
13+
default_azimuth_deg: 0.0
14+
default_camera_distance: 1.5
15+
default_fovy_deg: 49.1
16+
requires_depth: ${cmaxgt0orcmaxgt0:${system.loss.lambda_depth},${system.loss.lambda_depth_rel}}
17+
requires_normal: ${cmaxgt0:${system.loss.lambda_normal}}
18+
random_camera: # threestudio/data/uncond.py -> RandomCameraDataModuleConfig
19+
height: [64, 64, 256]
20+
width: [64, 64, 256]
21+
batch_size: [16, 16, 8] # nvs-adapter, must be times of num query
22+
resolution_milestones: ${data.resolution_milestones} # nvs-adapter
23+
eval_height: 512
24+
eval_width: 512
25+
eval_batch_size: 1
26+
elevation_range: [-10, 80]
27+
azimuth_range: [-180, 180]
28+
camera_distance_range: [ 1.5, 1.5 ]
29+
fovy_range: [49.1, 49.1] # objaverse dataset has fixed fovyq
30+
progressive_until: 0
31+
camera_perturb: 0.0
32+
center_perturb: 0.0
33+
up_perturb: 0.0
34+
light_position_perturb: 1.0
35+
light_distance_range: [7.5, 10.0]
36+
eval_elevation_deg: 15
37+
eval_camera_distance: ${data.default_camera_distance}
38+
eval_fovy_deg: ${data.default_fovy_deg}
39+
light_sample_strategy: "dreamfusion"
40+
batch_uniform_azimuth: False
41+
n_val_views: 30
42+
n_test_views: 120
43+
44+
system_type: "nvsadapter-system"
45+
system:
46+
geometry_type: "implicit-volume"
47+
geometry:
48+
radius: 1.0
49+
normal_type: "analytic"
50+
51+
# the density initialization proposed in the DreamFusion paper
52+
# does not work very well
53+
# density_bias: "blob_dreamfusion"
54+
# density_activation: exp
55+
# density_blob_scale: 5.
56+
# density_blob_std: 0.2
57+
58+
# use Magic3D density initialization instead
59+
density_bias: "blob_magic3d"
60+
density_activation: softplus
61+
density_blob_scale: 10.
62+
density_blob_std: 0.5
63+
64+
# coarse to fine hash grid encoding
65+
# to ensure smooth analytic normals
66+
pos_encoding_config:
67+
otype: HashGrid
68+
n_levels: 16
69+
n_features_per_level: 2
70+
log2_hashmap_size: 19
71+
base_resolution: 16
72+
per_level_scale: 1.447269237440378 # max resolution 4096
73+
mlp_network_config:
74+
otype: "VanillaMLP"
75+
activation: "ReLU"
76+
output_activation: "none"
77+
n_neurons: 64
78+
n_hidden_layers: 2
79+
80+
material_type: "diffuse-with-point-light-material"
81+
material:
82+
ambient_only_steps: 100000
83+
textureless_prob: 0.05
84+
albedo_activation: sigmoid
85+
86+
# background_type: "neural-environment-map-background"
87+
# background:
88+
# color_activation: sigmoid
89+
90+
background_type: "solid-color-background" # unused
91+
92+
renderer_type: "nerf-volume-renderer"
93+
renderer:
94+
radius: ${system.geometry.radius}
95+
num_samples_per_ray: 512
96+
return_comp_normal: ${gt0:${system.loss.lambda_normal_smooth}}
97+
return_normal_perturb: ${gt0:${system.loss.lambda_3d_normal_smooth}}
98+
99+
prompt_processor_type: "dummy-prompt-processor" # Zero123 doesn't use prompts
100+
prompt_processor:
101+
pretrained_model_name_or_path: ""
102+
prompt: ""
103+
104+
guidance_type: "nvsadapter-guidance"
105+
guidance:
106+
pretrained_model_name_or_path: "../checkpoints/base_query_4_step_200000.ckpt"
107+
pretrained_config: "../checkpoints/base_query_4.yaml"
108+
cond_image_path: ${data.image_path}
109+
cond_elevation_deg: ${data.default_elevation_deg}
110+
cond_azimuth_deg: ${data.default_azimuth_deg}
111+
cond_camera_distance: ${data.default_camera_distance}
112+
cond_fovy_deg: ${data.default_fovy_deg}
113+
guidance_scale: 3.0
114+
min_step_percent: 0.02
115+
max_step_percent: [0, 0.98, 0.5, 5000] # (start_iter, start_val, end_val, end_iter)
116+
#max_step_percent: 0.98
117+
num_query: 4
118+
119+
freq:
120+
ref_only_steps: 0
121+
guidance_eval: 0
122+
123+
loggers:
124+
wandb:
125+
enable: false
126+
project: "threestudio"
127+
name: None
128+
129+
loss:
130+
lambda_sds: 0.1
131+
lambda_rgb: 500.
132+
lambda_mask: 50.
133+
lambda_depth: 0. # 0.05
134+
lambda_depth_rel: 0. # [0, 0, 0.05, 100]
135+
lambda_normal: 0. # [0, 0, 0.05, 100]
136+
lambda_normal_smooth: 8.0
137+
lambda_3d_normal_smooth: 8.0
138+
lambda_orient: 1.0
139+
lambda_sparsity: 1.0 # should be tweaked for every model
140+
lambda_opaque: 0.1
141+
142+
optimizer:
143+
name: AdamW
144+
args:
145+
lr: 0.01
146+
betas: [0.9, 0.99]
147+
eps: 1.e-8
148+
149+
trainer:
150+
max_steps: 8000
151+
log_every_n_steps: 1
152+
num_sanity_val_steps: 0
153+
val_check_interval: 200
154+
enable_progress_bar: true
155+
precision: 16-mixed
156+
157+
checkpoint:
158+
save_last: true # save at each validation time
159+
save_top_k: -1
160+
every_n_train_steps: 200 # ${trainer.max_steps}

0 commit comments

Comments
 (0)