fix: improve weight directory validation to ensure critical shards exist before initialization and add test asset
Browse files- backend/flux-klein.py +5 -3
backend/flux-klein.py
CHANGED
|
@@ -68,9 +68,11 @@ class AikoImageGen:
|
|
| 68 |
hf_token = os.environ["HF_TOKEN"]
|
| 69 |
local_path = f"{WEIGHTS_DIR}/flux2-klein-9b"
|
| 70 |
|
| 71 |
-
#
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
snapshot_download(
|
| 75 |
MODEL_ID,
|
| 76 |
local_dir=local_path,
|
|
|
|
| 68 |
hf_token = os.environ["HF_TOKEN"]
|
| 69 |
local_path = f"{WEIGHTS_DIR}/flux2-klein-9b"
|
| 70 |
|
| 71 |
+
# verify the critical shard exists, not just the directory
|
| 72 |
+
shard_check = f"{local_path}/transformer/diffusion_pytorch_model-00001-of-00002.safetensors"
|
| 73 |
+
|
| 74 |
+
if not os.path.exists(local_path) or not os.path.exists(shard_check):
|
| 75 |
+
print("Downloading FLUX.2 klein 9B weights (or resuming partial)...")
|
| 76 |
snapshot_download(
|
| 77 |
MODEL_ID,
|
| 78 |
local_dir=local_path,
|