This commit is contained in:
hiyouga
2023-09-21 19:51:02 +08:00
parent ace3f85a72
commit 338b8664ed
11 changed files with 116 additions and 101 deletions

View File

@@ -173,7 +173,7 @@ def load_model_and_tokenizer(
)
# Disable custom generate method (for Qwen)
if "GenerationMixin" not in str(model.generate.__func__):
if isinstance(model, PreTrainedModel) and "GenerationMixin" not in str(model.generate.__func__):
model.generate = MethodType(PreTrainedModel.generate, model)
# Fix LM head (for ChatGLM2)