Spaces:
Paused

Rukku / models /patchtst.py
whassan's picture
Upload folder using huggingface_hub
5937e07 verified
Raw History Blame Contribute Delete
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."}