Download worker/lora_mirror.py from nikdevs/qwen: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/nikdevs/qwen/resolve/main/worker/lora_mirror.py
- Command line
-
hf download hf://nikdevs/qwen/worker/lora_mirror.py
-
curl -L -o lora_mirror.py https://huggingface.co/nikdevs/qwen/resolve/main/worker/lora_mirror.py
1.28 kB
| """One-shot: mirror MiniMax H3 turbo LoRAs from civitai.red to HF.""" | |
| import os | |
| import time | |
| import urllib.request | |
| from huggingface_hub import HfApi | |
| REPO = "nikdevs/minimax-h3-loras" | |
| FILES = { | |
| "minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors": "https://civitai.red/api/download/models/3219337", | |
| "minimax_h3_fl2v_turbo_4step_v1.0_768p_comfyui_bf16.safetensors": "https://civitai.red/api/download/models/3219346", | |
| } | |
| api = HfApi() | |
| api.create_repo(REPO, exist_ok=True, private=False) | |
| existing = {s.rfilename for s in api.repo_info(REPO).siblings} | |
| for name, url in FILES.items(): | |
| if name in existing: | |
| print(f"[skip] {name}", flush=True) | |
| continue | |
| t0 = time.time() | |
| print(f"[dl] {name}", flush=True) | |
| req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"}) | |
| with urllib.request.urlopen(req, timeout=600) as r, open(f"/tmp/{name}", "wb") as f: | |
| while chunk := r.read(1 << 22): | |
| f.write(chunk) | |
| print(f"[dl] done {time.time()-t0:.0f}s, uploading", flush=True) | |
| api.upload_file(path_or_fileobj=f"/tmp/{name}", path_in_repo=name, repo_id=REPO) | |
| os.remove(f"/tmp/{name}") | |
| print(f"[up] done {time.time()-t0:.0f}s total", flush=True) | |
| print("LORA MIRROR DONE", flush=True) | |
| time.sleep(10 ** 6) | |