diff --git a/predix.py b/predix.py index a4d438dd..67de876b 100644 --- a/predix.py +++ b/predix.py @@ -329,13 +329,9 @@ def quant( threading.Thread(target=start_cli_dash, daemon=True).start() time.sleep(1) - # ---- Kronos Factor: skip if GPU unavailable (CUDA OOM with llama-server) ---- + # ---- Kronos Factor: CPU inference to avoid GPU conflict with llama-server ---- try: - import torch - if torch.cuda.is_available() and torch.cuda.get_device_properties(0).total_memory > 20 * 1024**3: - _ensure_kronos_factor_in_pool(console) - else: - console.print("[dim]Kronos Factor skipped — GPU < 20GB or CUDA unavailable[/dim]") + _ensure_kronos_factor_in_pool(console) except Exception: console.print("[dim]Kronos Factor skipped — torch not available[/dim]") diff --git a/rdagent/components/coder/kronos_adapter.py b/rdagent/components/coder/kronos_adapter.py index af7e6f35..ef90d85d 100644 --- a/rdagent/components/coder/kronos_adapter.py +++ b/rdagent/components/coder/kronos_adapter.py @@ -91,7 +91,7 @@ class KronosAdapter: TOKENIZER_ID = "NeoQuasar/Kronos-Tokenizer-2k" def __init__(self, device: Optional[str] = None, max_context: int = 512): - self.device = device or ("cuda" if _cuda_available() else "cpu") + self.device = device or "cpu" self.max_context = max_context self._predictor = None @@ -236,7 +236,7 @@ def build_kronos_factor( Returns: MultiIndex (datetime, instrument) DataFrame with column "KronosPredReturn". """ - device = device or ("cuda" if _cuda_available() else "cpu") + device = device or "cpu" logger.info(f"Loading data from {hdf5_path}...") raw = pd.read_hdf(hdf5_path, key="data") @@ -312,7 +312,7 @@ def evaluate_kronos_model( Returns: dict with keys: IC_mean, IC_std, IC_IR (IC / std), hit_rate, n_predictions """ - device = device or ("cuda" if _cuda_available() else "cpu") + device = device or "cpu" raw = pd.read_hdf(hdf5_path, key="data") instrument = raw.index.get_level_values("instrument").unique()[0] df = raw.xs(instrument, level="instrument")