diff --git a/scripts/context-optimizer.py b/scripts/context-optimizer.py index f331214..5a26593 100755 --- a/scripts/context-optimizer.py +++ b/scripts/context-optimizer.py @@ -248,11 +248,12 @@ def find_optimal_context(model_name: str, max_turns: Optional[int], overhead_gb: # Get VRAM info vram_total, vram_available = get_gpu_vram() - if vram_total: + if vram_total and vram_available is not None: print(f"GPU VRAM: {vram_available:.1f} GB available / {vram_total:.1f} GB total") print(f"Overhead reserved: {overhead_gb:.1f} GB") - # Reserve specified overhead - target_vram = vram_total - overhead_gb + # Reserve specified overhead from available VRAM (not total) + target_vram = vram_available - overhead_gb + print(f"Target VRAM for model: {target_vram:.1f} GB") else: print("⚠ Could not detect GPU VRAM (testing will continue)") target_vram = None