Enhanced torch.compile System with Block-Level Compilation and Unified Whole-Model Fallback (#866)

* Add block-level compile and qcompile torch.compile whole model  modes

* Update torch compile system
This commit is contained in:
PlagueKind authored and GitHub committed 2026-06-12 10:35:12 -06:00
1 parent 324faf17b3
commit 6b1f89f30b
2 files changed
+163 -8

No files matched your search

+8 -3
View File
@@ -706,10 +706,15 @@ class ModelConfig:
# compile the model with torch compile
self.compile = kwargs.get("compile", False)
if self.compile and self.quantize:
print("Warning: You cannot compile a quantized model. Disabling compile.")
self.compile = False
print("Quantized model detected - allowing torch.compile (experimental - Does not work with offloaded transformer)")
# self.compile = False
self.block_compile = kwargs.get("block_compile", False)
self.compile_mode = kwargs.get("compile_mode", "default")
self.compile_fullgraph = kwargs.get("compile_fullgraph", True)
self.compile_dynamic = kwargs.get("compile_dynamic", True)
self.cache_size_limit = kwargs.get("cache_size_limit", 8)
# kwargs to pass to the model
self.model_kwargs = kwargs.get("model_kwargs", {})