Skip to content

Commit 20770be

Browse files
authored
[dlinfer] fix glm-4v graph mode on ascend (InternLM#3235)
* [dlinfer] support glm-4v graph mode on ascend * lint
1 parent 9528a74 commit 20770be

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: lmdeploy/pytorch/backends/dlinfer/ascend/graph_runner.py

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from lmdeploy.pytorch.config import BackendConfig, CacheConfig, ModelConfig
1111
from lmdeploy.pytorch.model_inputs import StepContext
12+
from lmdeploy.pytorch.models.chatglm2 import ChatGLMForConditionalGeneration
1213
from lmdeploy.pytorch.models.qwen2_vl import Qwen2VLForConditionalGeneration
1314
from lmdeploy.utils import get_logger
1415

@@ -39,6 +40,11 @@ def __init__(self, model: torch.nn.Module, model_config: ModelConfig, cache_conf
3940
backend='atbgraph')
4041
elif isinstance(self.model, Qwen2VLForConditionalGeneration):
4142
self.model.model = torch.compile(self.model.model, fullgraph=True, dynamic=True, backend='atbgraph')
43+
elif isinstance(self.model, ChatGLMForConditionalGeneration):
44+
self.model.transformer.encoder = torch.compile(self.model.transformer.encoder,
45+
fullgraph=True,
46+
dynamic=True,
47+
backend='atbgraph')
4248
else:
4349
self.model = torch.compile(self.model, fullgraph=True, dynamic=True, backend='atbgraph')
4450

0 commit comments

Comments
 (0)