xizaoqu commited on
Commit ·
4610cb2
1
Parent(s): dd1d159
before multi-frame gen
Browse files- app.py +13 -7
- configurations/huggingface.yaml +1 -1
app.py
CHANGED
|
@@ -27,13 +27,19 @@ import requests
|
|
| 27 |
torch.set_float32_matmul_precision("high")
|
| 28 |
|
| 29 |
def load_custom_checkpoint(algo, checkpoint_path):
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
def download_assets_if_needed():
|
| 39 |
ASSETS_URL_BASE = "https://huggingface.co/spaces/yslan/worldmem/resolve/main/assets/examples"
|
|
|
|
| 27 |
torch.set_float32_matmul_precision("high")
|
| 28 |
|
| 29 |
def load_custom_checkpoint(algo, checkpoint_path):
|
| 30 |
+
try:
|
| 31 |
+
hf_ckpt = str(checkpoint_path).split('/')
|
| 32 |
+
repo_id = '/'.join(hf_ckpt[:2])
|
| 33 |
+
file_name = '/'.join(hf_ckpt[2:])
|
| 34 |
+
model_path = hf_hub_download(repo_id=repo_id,
|
| 35 |
+
filename=file_name)
|
| 36 |
+
ckpt = torch.load(model_path, map_location=torch.device('cpu'))
|
| 37 |
+
algo.load_state_dict(ckpt['state_dict'], strict=False)
|
| 38 |
+
print("Load: ", model_path)
|
| 39 |
+
except:
|
| 40 |
+
ckpt = torch.load(checkpoint_path, map_location=torch.device('cpu'))
|
| 41 |
+
algo.load_state_dict(ckpt['state_dict'], strict=False)
|
| 42 |
+
print("Load: ", checkpoint_path)
|
| 43 |
|
| 44 |
def download_assets_if_needed():
|
| 45 |
ASSETS_URL_BASE = "https://huggingface.co/spaces/yslan/worldmem/resolve/main/assets/examples"
|
configurations/huggingface.yaml
CHANGED
|
@@ -53,6 +53,6 @@ noise_level: random_all
|
|
| 53 |
causal: True
|
| 54 |
x_shape: [3, 360, 640]
|
| 55 |
context_frames: 1
|
| 56 |
-
diffusion_path:
|
| 57 |
vae_path: yslan/worldmem_checkpoints/vae_only.ckpt
|
| 58 |
pose_predictor_path: yslan/worldmem_checkpoints/pose_prediction_model_only.ckpt
|
|
|
|
| 53 |
causal: True
|
| 54 |
x_shape: [3, 360, 640]
|
| 55 |
context_frames: 1
|
| 56 |
+
diffusion_path: /mnt/xiaozeqi/worldmem_github/diffusion_only_2025-04-04_4-56-27_epoch1step560000.ckpt
|
| 57 |
vae_path: yslan/worldmem_checkpoints/vae_only.ckpt
|
| 58 |
pose_predictor_path: yslan/worldmem_checkpoints/pose_prediction_model_only.ckpt
|