Spaces:
Running on Zero
Running on Zero
Flatten hf_hub_download subfolder so LoRA lands where Wan2GP expects it
Browse files
app.py
CHANGED
|
@@ -59,13 +59,17 @@ _setup_done = False
|
|
| 59 |
def _download(repo_id, filename, dest_dir):
|
| 60 |
from huggingface_hub import hf_hub_download
|
| 61 |
dest_dir.mkdir(parents=True, exist_ok=True)
|
| 62 |
-
dest = dest_dir / Path(filename).name
|
| 63 |
if dest.exists():
|
| 64 |
print(f"[download] cached: {dest.name}")
|
| 65 |
return
|
| 66 |
print(f"[download] {repo_id}/{filename}")
|
| 67 |
hf_hub_download(repo_id=repo_id, filename=filename,
|
| 68 |
local_dir=str(dest_dir), token=_HF_TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
def setup():
|
|
|
|
| 59 |
def _download(repo_id, filename, dest_dir):
|
| 60 |
from huggingface_hub import hf_hub_download
|
| 61 |
dest_dir.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
dest = dest_dir / Path(filename).name # flat — strip any subfolder
|
| 63 |
if dest.exists():
|
| 64 |
print(f"[download] cached: {dest.name}")
|
| 65 |
return
|
| 66 |
print(f"[download] {repo_id}/{filename}")
|
| 67 |
hf_hub_download(repo_id=repo_id, filename=filename,
|
| 68 |
local_dir=str(dest_dir), token=_HF_TOKEN)
|
| 69 |
+
# hf_hub_download preserves subfolder structure; flatten to dest_dir root
|
| 70 |
+
downloaded = dest_dir / filename
|
| 71 |
+
if downloaded.exists() and not dest.exists():
|
| 72 |
+
shutil.move(str(downloaded), str(dest))
|
| 73 |
|
| 74 |
|
| 75 |
def setup():
|