Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 63d76a1

Browse files
committed
hack PTEModel to support current ppl
1 parent 2e3d1dc commit 63d76a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

torchchat/model.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,11 @@ def __init__(self, config, path) -> None:
782782

783783
# A hacky way to get the model config from the self.model, making it consistent with Model class
784784
# TODO: remove the hacky way once get rid of model.model
785-
self.model = type('model', (), {'config': self.config})
785+
try:
786+
text_transformer_config = TransformerArgs.from_params(self.config.transformer_args["text"])
787+
else:
788+
text_transformer_config = None
789+
self.model = type('model', (), {'config': text_transformer_config})
786790

787791
def forward(self, x, input_pos):
788792
# model_.forward expects inputs to be wrapped in a tuple

0 commit comments

Comments
 (0)