(ckpt_name: str)
| 27 | |
| 28 | |
| 29 | def extract_model_id(ckpt_name: str) -> str: |
| 30 | model_id_key = "encrypted_wandb_properties" |
| 31 | with safe_open( |
| 32 | folder_paths.get_full_path_or_raise("checkpoints", ckpt_name), |
| 33 | framework="pt", |
| 34 | device="cpu", |
| 35 | ) as f: |
| 36 | metadata = f.metadata() |
| 37 | if not metadata or model_id_key not in metadata: |
| 38 | raise ValueError(MISSING_MODEL_ID_MESSAGE) |
| 39 | return metadata[model_id_key] |
| 40 | |
| 41 | |
| 42 | @comfy_node(name="GemmaAPITextEncode") |