Download api/local_config.py from Unit4IAI/Fuse-MD: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/Unit4IAI/Fuse-MD/resolve/main/api/local_config.py
- Command line
-
hf download hf://spaces/Unit4IAI/Fuse-MD/api/local_config.py
-
curl -L -o local_config.py https://huggingface.co/spaces/Unit4IAI/Fuse-MD/resolve/main/api/local_config.py
1.3 kB
| from dataclasses import dataclass | |
| from pathlib import Path | |
| from typing import Optional | |
| # Update this once to point at the checkpoint you want the easy-mode API to use. | |
| CHECKPOINT_PATH = ( | |
| "trained_model/tamil/fusion/" | |
| "custom_tamil_llamavit_fusion_element_lr1e-05_epoch4_bs16_20260425_231136.pth" | |
| ) | |
| LOCAL_MODEL_ROOT = "local_models" | |
| HOST = "127.0.0.1" | |
| PORT = 8000 | |
| DEVICE = "auto" | |
| THRESHOLD = None | |
| MAX_LENGTH = None | |
| class LocalAPIConfig: | |
| checkpoint_path: Path | |
| local_model_root: Path | |
| host: str | |
| port: int | |
| device: str | |
| threshold: Optional[float] | |
| max_length: Optional[int] | |
| def repo_root() -> Path: | |
| return Path(__file__).resolve().parents[1] | |
| def resolve_repo_path(raw_path: str) -> Path: | |
| path = Path(raw_path) | |
| if path.is_absolute(): | |
| return path | |
| return (repo_root() / path).resolve() | |
| def load_local_api_config() -> LocalAPIConfig: | |
| return LocalAPIConfig( | |
| checkpoint_path=resolve_repo_path(CHECKPOINT_PATH), | |
| local_model_root=resolve_repo_path(LOCAL_MODEL_ROOT), | |
| host=str(HOST), | |
| port=int(PORT), | |
| device=str(DEVICE).strip().lower(), | |
| threshold=None if THRESHOLD is None else float(THRESHOLD), | |
| max_length=None if MAX_LENGTH is None else int(MAX_LENGTH), | |
| ) | |