Download models/patchtst.py from whassan/Rukku: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/spaces/whassan/Rukku/resolve/main/models/patchtst.py
- Command line
-
hf download hf://spaces/whassan/Rukku/models/patchtst.py
-
curl -L -o patchtst.py https://huggingface.co/spaces/whassan/Rukku/resolve/main/models/patchtst.py
1.36 kB
| from .base import ForecastModel | |
| class PatchTSTAdapter(ForecastModel): | |
| def __init__(self): | |
| self.is_loaded = False | |
| self.error_msg = "" | |
| self.repo = "yuqinie98/PatchTST" | |
| self.commit = "9f8a3c2" | |
| self.checkpoint = "patchtst_default" | |
| def load(self, config: dict) -> bool: | |
| try: | |
| import torch | |
| from patchtst import PatchTST | |
| # Dummy load just to fail cleanly on import error | |
| self.is_loaded = True | |
| return True | |
| except ImportError as e: | |
| self.error_msg = f"ImportError: {str(e)}" | |
| return False | |
| def predict(self, historical_data, horizon: int): | |
| if not self.is_loaded: | |
| raise RuntimeError(f"Model not loaded: {self.error_msg}") | |
| raise RuntimeError("PatchTST real inference not yet implemented for target environment.") | |
| def metadata(self) -> dict: | |
| return { | |
| "repository": f"https://github.com/{self.repo}", | |
| "commit": self.commit, | |
| "checkpoint": self.checkpoint, | |
| "adapter_version": "1.0.0", | |
| "model_name": "PatchTST" | |
| } | |
| def health_check(self) -> dict: | |
| if self.is_loaded: | |
| return {"status": "ok", "reason": ""} | |
| return {"status": "error", "reason": self.error_msg or "Model not initialized."} | |