xizaoqu commited on
Commit ·
2d09b72
1
Parent(s): 89a9e96
fix oasis loading bug
Browse files- experiments/exp_base.py +14 -8
- train_stage_1.sh +2 -2
experiments/exp_base.py
CHANGED
|
@@ -296,17 +296,17 @@ class BaseLightningExperiment(BaseExperiment):
|
|
| 296 |
|
| 297 |
trainer = pl.Trainer(
|
| 298 |
accelerator="auto",
|
| 299 |
-
devices="auto",
|
| 300 |
strategy=DDPStrategy(find_unused_parameters=True) if torch.cuda.device_count() > 1 else "auto",
|
| 301 |
-
logger=self.logger or False,
|
| 302 |
callbacks=callbacks,
|
| 303 |
-
gradient_clip_val=self.cfg.training.optim.gradient_clip_val or 0.0,
|
| 304 |
val_check_interval=self.cfg.validation.val_every_n_step if self.cfg.validation.val_every_n_step else None,
|
| 305 |
limit_val_batches=self.cfg.validation.limit_batch,
|
| 306 |
check_val_every_n_epoch=self.cfg.validation.val_every_n_epoch if not self.cfg.validation.val_every_n_step else None,
|
| 307 |
-
accumulate_grad_batches=self.cfg.training.optim.accumulate_grad_batches or 1,
|
| 308 |
-
precision=self.cfg.training.precision or 32,
|
| 309 |
-
detect_anomaly=False,
|
| 310 |
num_sanity_val_steps=int(self.cfg.debug) if self.cfg.debug else 0,
|
| 311 |
max_epochs=self.cfg.training.max_epochs,
|
| 312 |
max_steps=self.cfg.training.max_steps,
|
|
@@ -316,7 +316,10 @@ class BaseLightningExperiment(BaseExperiment):
|
|
| 316 |
|
| 317 |
if self.customized_load:
|
| 318 |
if self.seperate_load:
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
| 320 |
load_custom_checkpoint(algo=self.algo.vae,checkpoint_path=self.vae_path)
|
| 321 |
else:
|
| 322 |
load_custom_checkpoint(algo=self.algo,checkpoint_path=self.ckpt_path)
|
|
@@ -382,7 +385,10 @@ class BaseLightningExperiment(BaseExperiment):
|
|
| 382 |
|
| 383 |
if self.customized_load:
|
| 384 |
if self.seperate_load:
|
| 385 |
-
|
|
|
|
|
|
|
|
|
|
| 386 |
load_custom_checkpoint(algo=self.algo.vae,checkpoint_path=self.vae_path)
|
| 387 |
else:
|
| 388 |
load_custom_checkpoint(algo=self.algo,checkpoint_path=self.ckpt_path)
|
|
|
|
| 296 |
|
| 297 |
trainer = pl.Trainer(
|
| 298 |
accelerator="auto",
|
| 299 |
+
devices="auto",
|
| 300 |
strategy=DDPStrategy(find_unused_parameters=True) if torch.cuda.device_count() > 1 else "auto",
|
| 301 |
+
logger=self.logger or False,
|
| 302 |
callbacks=callbacks,
|
| 303 |
+
gradient_clip_val=self.cfg.training.optim.gradient_clip_val or 0.0,
|
| 304 |
val_check_interval=self.cfg.validation.val_every_n_step if self.cfg.validation.val_every_n_step else None,
|
| 305 |
limit_val_batches=self.cfg.validation.limit_batch,
|
| 306 |
check_val_every_n_epoch=self.cfg.validation.val_every_n_epoch if not self.cfg.validation.val_every_n_step else None,
|
| 307 |
+
accumulate_grad_batches=self.cfg.training.optim.accumulate_grad_batches or 1,
|
| 308 |
+
precision=self.cfg.training.precision or 32,
|
| 309 |
+
detect_anomaly=False,
|
| 310 |
num_sanity_val_steps=int(self.cfg.debug) if self.cfg.debug else 0,
|
| 311 |
max_epochs=self.cfg.training.max_epochs,
|
| 312 |
max_steps=self.cfg.training.max_steps,
|
|
|
|
| 316 |
|
| 317 |
if self.customized_load:
|
| 318 |
if self.seperate_load:
|
| 319 |
+
if 'oasis500m' in self.diffusion_model_path:
|
| 320 |
+
load_custom_checkpoint(algo=self.algo.diffusion_model.model,checkpoint_path=self.diffusion_model_path)
|
| 321 |
+
else:
|
| 322 |
+
load_custom_checkpoint(algo=self.algo.diffusion_model,checkpoint_path=self.diffusion_model_path)
|
| 323 |
load_custom_checkpoint(algo=self.algo.vae,checkpoint_path=self.vae_path)
|
| 324 |
else:
|
| 325 |
load_custom_checkpoint(algo=self.algo,checkpoint_path=self.ckpt_path)
|
|
|
|
| 385 |
|
| 386 |
if self.customized_load:
|
| 387 |
if self.seperate_load:
|
| 388 |
+
if 'oasis500m' in self.diffusion_model_path:
|
| 389 |
+
load_custom_checkpoint(algo=self.algo.diffusion_model.model,checkpoint_path=self.diffusion_model_path)
|
| 390 |
+
else:
|
| 391 |
+
load_custom_checkpoint(algo=self.algo.diffusion_model,checkpoint_path=self.diffusion_model_path)
|
| 392 |
load_custom_checkpoint(algo=self.algo.vae,checkpoint_path=self.vae_path)
|
| 393 |
else:
|
| 394 |
load_custom_checkpoint(algo=self.algo,checkpoint_path=self.ckpt_path)
|
train_stage_1.sh
CHANGED
|
@@ -2,8 +2,8 @@ wandb enabled
|
|
| 2 |
|
| 3 |
# set -e
|
| 4 |
python -m main +name=train \
|
| 5 |
-
+diffusion_model_path=
|
| 6 |
-
+vae_path=
|
| 7 |
+customized_load=true \
|
| 8 |
+seperate_load=true \
|
| 9 |
+zero_init_gate=true \
|
|
|
|
| 2 |
|
| 3 |
# set -e
|
| 4 |
python -m main +name=train \
|
| 5 |
+
+diffusion_model_path=/home/zeqi001/.cache/huggingface/hub/models--Etched--oasis-500m/snapshots/4ca7d2d811f4f0c6fd1d5719bf83f14af3446c0c/oasis500m.safetensors \
|
| 6 |
+
+vae_path=/home/zeqi001/.cache/huggingface/hub/models--Etched--oasis-500m/snapshots/4ca7d2d811f4f0c6fd1d5719bf83f14af3446c0c/vit-l-20.safetensors \
|
| 7 |
+customized_load=true \
|
| 8 |
+seperate_load=true \
|
| 9 |
+zero_init_gate=true \
|