fix: only check model type if config exists

This commit is contained in:
David Holtz 2024-10-30 22:23:08 +00:00
parent 8648212c76
commit 7d97ee82a1

View File

@ -1430,7 +1430,11 @@ class FlashCausalLM(Model):
else:
state = None
if self.model.config.model_type == "qwen2_vl":
if (
hasattr(self.model, "config")
and hasattr(self.model.config, "model_type")
and self.model.config.model_type == "qwen2_vl"
):
if position_ids.dim() == 1:
position_ids = self.model.get_position_ids(input_ids)