Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,4 +13,22 @@ else:
|
|
13 |
torch_dtype = torch.float32
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
torch_dtype = torch.float32
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
+
from huggingface_hub import hf_hub_download
|
17 |
+
CONFIG_PATH = 'configs/composite_config.yaml'
|
18 |
+
|
19 |
+
repo_id = "JuyeopDang/KoFace-Diffusion"
|
20 |
+
filename = "composite_epoch2472.pth" # ์: "pytorch_model.pt" ๋๋ "model.pt"
|
21 |
+
vae = VariationalAutoEncoder(CONFIG_PATH)
|
22 |
+
|
23 |
+
try:
|
24 |
+
# ํ์ผ ๋ค์ด๋ก๋
|
25 |
+
# cache_dir์ ์ง์ ํ๋ฉด ๋ค์ด๋ก๋๋ ํ์ผ์ด ์ ์ฅ๋ ๊ฒฝ๋ก๋ฅผ ์ ์ดํ ์ ์์ต๋๋ค.
|
26 |
+
# ๊ธฐ๋ณธ์ ์ผ๋ก๋ ~/.cache/huggingface/hub ์ ์ ์ฅ๋ฉ๋๋ค.
|
27 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
28 |
+
print(f"๋ชจ๋ธ ๊ฐ์ค์น ํ์ผ์ด ๋ค์ ๊ฒฝ๋ก์ ๋ค์ด๋ก๋๋์์ต๋๋ค: {model_path}")
|
29 |
+
except Exception as e:
|
30 |
+
print(f"ํ์ผ ๋ค์ด๋ก๋ ๋๋ ๋ชจ๋ธ ๋ก๋ ์ค ์ค๋ฅ ๋ฐ์: {e}")
|
31 |
+
|
32 |
+
state_dict = torch.load(model_path, map_location='cuda')
|
33 |
+
vae.load_state_dict(state_dict['model_state_dict'])
|
34 |
+
print(vae)
|