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
2026-06-12 18:35:12 +02:00
committed by GitHub
parent 324faf17b3
commit 6b1f89f30b
2 changed files with 163 additions and 8 deletions

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", {})