fix issue with context optimizer overhead

This commit is contained in:
2026-01-21 13:37:51 +01:00
parent 2c9f0a0450
commit bef50ab8f9

View File

@@ -248,11 +248,12 @@ def find_optimal_context(model_name: str, max_turns: Optional[int], overhead_gb:
# Get VRAM info # Get VRAM info
vram_total, vram_available = get_gpu_vram() 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"GPU VRAM: {vram_available:.1f} GB available / {vram_total:.1f} GB total")
print(f"Overhead reserved: {overhead_gb:.1f} GB") print(f"Overhead reserved: {overhead_gb:.1f} GB")
# Reserve specified overhead # Reserve specified overhead from available VRAM (not total)
target_vram = vram_total - overhead_gb target_vram = vram_available - overhead_gb
print(f"Target VRAM for model: {target_vram:.1f} GB")
else: else:
print("⚠ Could not detect GPU VRAM (testing will continue)") print("⚠ Could not detect GPU VRAM (testing will continue)")
target_vram = None target_vram = None