Skip to content

fix(models): VRAM-aware memory estimation to prevent OOM (#1966)#2007

Merged
mrveiss merged 1 commit intoDev_new_guifrom
fix/model-memory-estimation-1966
Mar 22, 2026
Merged

fix(models): VRAM-aware memory estimation to prevent OOM (#1966)#2007
mrveiss merged 1 commit intoDev_new_guifrom
fix/model-memory-estimation-1966

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Mar 22, 2026

Summary

  • Adds estimate_model_memory_gb() with quantization-aware formula: memory = (params_B * bpp) + (0.000008 * params_B * ctx) + 0.5
  • Adds gpu_vram_gb field to SystemResources for GPU VRAM tracking
  • fits_resource_constraints() now rejects models exceeding available VRAM
  • Fixes dict API path to forward gpu_vram_gb (was silently dropped)
  • Exposes estimate_model_memory_gb from package public API
  • 51 test cases covering estimation, VRAM checking, parameter parsing, and edge cases

Closes #1966

Test plan

  • Run pytest autobot-backend/tests/utils/model_optimization/test_memory_estimation.py -v
  • Verify ModelSelector filters models by estimated memory vs available VRAM
  • Verify unknown quantization levels fall back to Q4 (0.5 bpp)

Add gpu_vram_gb forwarding in dict-based fits_resource_constraints
and model_optimizer wrapper. Expose estimate_model_memory_gb from
package __init__. Add comprehensive test suite (51 cases).
@mrveiss mrveiss force-pushed the fix/model-memory-estimation-1966 branch from 7afc94b to 93f8ba4 Compare March 22, 2026 20:14
@mrveiss mrveiss merged commit 375d4f6 into Dev_new_gui Mar 22, 2026
3 of 4 checks passed
@mrveiss mrveiss deleted the fix/model-memory-estimation-1966 branch March 22, 2026 20:18
@github-actions
Copy link
Copy Markdown

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant