diff --git a/src/transformers/models/llava_next_video/configuration_llava_next_video.py b/src/transformers/models/llava_next_video/configuration_llava_next_video.py index d141bbb0784b..40ae71010281 100644 --- a/src/transformers/models/llava_next_video/configuration_llava_next_video.py +++ b/src/transformers/models/llava_next_video/configuration_llava_next_video.py @@ -162,5 +162,11 @@ def __init__( super().__init__(**kwargs) + # Due to a mismatch at model addition-time, the `tie_word_embeddings` was saved in the text config, even + # though it concerns the main model, while it was set to False by default in the main model... So we hardcode a fix here + if not self.tie_word_embeddings and self.text_config.tie_word_embeddings: + self.tie_word_embeddings = True + self.text_config.tie_word_embeddings = False + __all__ = ["LlavaNextVideoConfig"] diff --git a/src/transformers/models/llava_next_video/modular_llava_next_video.py b/src/transformers/models/llava_next_video/modular_llava_next_video.py index d3670efec2d3..669c118d48c5 100644 --- a/src/transformers/models/llava_next_video/modular_llava_next_video.py +++ b/src/transformers/models/llava_next_video/modular_llava_next_video.py @@ -181,6 +181,12 @@ def __init__( super().__init__(**kwargs) + # Due to a mismatch at model addition-time, the `tie_word_embeddings` was saved in the text config, even + # though it concerns the main model, while it was set to False by default in the main model... So we hardcode a fix here + if not self.tie_word_embeddings and self.text_config.tie_word_embeddings: + self.tie_word_embeddings = True + self.text_config.tie_word_embeddings = False + class LlavaNextVideoModelOutputWithPast(LlavaNextModelOutputWithPast): r""" diff --git a/src/transformers/models/llava_onevision/configuration_llava_onevision.py b/src/transformers/models/llava_onevision/configuration_llava_onevision.py index b5c1a4c89593..a18b3e6c8029 100644 --- a/src/transformers/models/llava_onevision/configuration_llava_onevision.py +++ b/src/transformers/models/llava_onevision/configuration_llava_onevision.py @@ -190,5 +190,10 @@ def __init__( super().__init__(**kwargs) + # Due to a mismatch at model addition-time, the `tie_word_embeddings` was saved in the text config, even + # though it concerns the main model, while it was set to False by default in the main model... So we hardcode a fix here + self.tie_word_embeddings = self.tie_word_embeddings or self.text_config.tie_word_embeddings + self.text_config.tie_word_embeddings = False + __all__ = ["LlavaOnevisionConfig"]