[cold start time] add envs.VLLM_COMPILE_DEPYF to guard decompile (#20790)
Signed-off-by: Boyuan Feng <boyuan@meta.com>
This commit is contained in:
@@ -95,16 +95,26 @@ class TorchCompileWrapperWithCustomDispatcher:
|
||||
self.compiled_codes.append(new_code)
|
||||
local_cache_dir = self.vllm_config.compilation_config.local_cache_dir
|
||||
if isinstance(local_cache_dir, str):
|
||||
decompiled_file_name = ("transformed_code.py"
|
||||
if envs.VLLM_COMPILE_DEPYF else
|
||||
"transformed_code_README.txt")
|
||||
|
||||
decompiled_file = os.path.join(local_cache_dir,
|
||||
"transformed_code.py")
|
||||
decompiled_file_name)
|
||||
if not os.path.exists(decompiled_file):
|
||||
try:
|
||||
# usually the decompilation will succeed for most models,
|
||||
# as we guarantee a full-graph compilation in Dynamo.
|
||||
# but there's no 100% guarantee, since decompliation is
|
||||
# not a reversible process.
|
||||
import depyf
|
||||
src = depyf.decompile(new_code)
|
||||
if envs.VLLM_COMPILE_DEPYF:
|
||||
import depyf
|
||||
src = depyf.decompile(new_code)
|
||||
else:
|
||||
src = (
|
||||
"To get a transformed_code.py file, re-run with "
|
||||
"VLLM_COMPILE_DEPYF=1")
|
||||
|
||||
with open(decompiled_file, "w") as f:
|
||||
f.write(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user