Skip to content

Commit

Permalink
only compile language_model in vl models
Browse files Browse the repository at this point in the history
  • Loading branch information
tangzhiyi11 committed Dec 13, 2024
1 parent 422b9f2 commit 0d494f8
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 0d494f8

Please sign in to comment.