Skip to content

Commit

Permalink
[dlinfer] only compile language_model in vl models (#2893)
Browse files Browse the repository at this point in the history
Co-authored-by: jinminxi104 <jinminxi104@hotmail.com>
  • Loading branch information
tangzhiyi11 and jinminxi104 authored Dec 16, 2024
1 parent abd90db commit 1efed79
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lmdeploy/pytorch/backends/dlinfer/ascend/graph_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ def __init__(self, model: torch.nn.Module, model_config: ModelConfig,
dlinfer.graph.config.enable_graph_mode = True
self.patch_kernels_custom_op()
self.patch_kvcache_static_shape()
self.model = torch.compile(self.model,
fullgraph=True,
dynamic=True,
backend='atbgraph')
if hasattr(self.model, 'language_model'):
self.model.language_model = torch.compile(
self.model.language_model,
fullgraph=True,
dynamic=True,
backend='atbgraph')
else:
self.model = torch.compile(self.model,
fullgraph=True,
dynamic=True,
backend='atbgraph')

def check_enable_graph(self):
"""check enable graph."""
Expand Down

0 comments on commit 1efed79

Please sign in to comment.