nikdevs commited on
Commit
3b54ee9
·
verified ·
1 Parent(s): f9e57f3

h3 nsfw lora mirror job

Browse files
Files changed (1) hide show
  1. worker/lora_mirror2.py +43 -0
worker/lora_mirror2.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One-shot: mirror the H3 nsfw LoRAs from civitai to HF (token-gated files)."""
2
+
3
+ import os
4
+ import time
5
+ import urllib.request
6
+
7
+ from huggingface_hub import HfApi
8
+
9
+ REPO = "nikdevs/minimax-h3-loras"
10
+ TOKEN = os.environ["CIVITAI_TOKEN"]
11
+ FILES = {
12
+ # HMPussy v0.5 — both files needed together
13
+ "hmpussy/vagassist_e40.safetensors":
14
+ "https://civitai.com/api/download/models/3215304?type=Model&format=SafeTensor&fileId=3097094",
15
+ "hmpussy/hmpussy_v6_epoch30.safetensors":
16
+ "https://civitai.com/api/download/models/3215304?type=Model&format=SafeTensor&fileId=3097100",
17
+ # H3 Riding POV i2v v1.0 (the H3 one, NOT the LTXV versions)
18
+ "riding/riding_pose_H3_i2v_v1.0.safetensors":
19
+ "https://civitai.com/api/download/models/3203205?fileId=3084588",
20
+ }
21
+
22
+ api = HfApi()
23
+ api.create_repo(REPO, exist_ok=True, private=False)
24
+ existing = {s.rfilename for s in api.repo_info(REPO).siblings}
25
+
26
+ for name, url in FILES.items():
27
+ if name in existing:
28
+ print(f"[skip] {name}", flush=True)
29
+ continue
30
+ t0 = time.time()
31
+ print(f"[dl] {name}", flush=True)
32
+ req = urllib.request.Request(url + f"&token={TOKEN}", headers={"User-Agent": "Mozilla/5.0"})
33
+ local = "/tmp/" + name.split("/")[-1]
34
+ with urllib.request.urlopen(req, timeout=600) as r, open(local, "wb") as f:
35
+ while chunk := r.read(1 << 22):
36
+ f.write(chunk)
37
+ print(f"[dl] {os.path.getsize(local)//1_000_000}MB in {time.time()-t0:.0f}s, uploading", flush=True)
38
+ api.upload_file(path_or_fileobj=local, path_in_repo=name, repo_id=REPO)
39
+ os.remove(local)
40
+ print(f"[up] {name} done", flush=True)
41
+
42
+ print("H3 LORA MIRROR DONE", flush=True)
43
+ time.sleep(10 ** 6)