Make modeling_internvl_chat.py compatible with transformers v5

#11
by tengomucho HF Staff - opened
Files changed (1) hide show
  1. modeling_internvl_chat.py +4 -0
modeling_internvl_chat.py CHANGED
@@ -86,6 +86,10 @@ class InternVLChatModel(PreTrainedModel):
86
  self.conv_template = get_conv_template(self.template)
87
  self.system_message = self.conv_template.system_message
88
 
 
 
 
 
89
  def forward(
90
  self,
91
  pixel_values: torch.FloatTensor,
 
86
  self.conv_template = get_conv_template(self.template)
87
  self.system_message = self.conv_template.system_message
88
 
89
+ # Required by transformers v5: populates `all_tied_weights_keys`,
90
+ # tp/ep/pp plans, `_keep_in_fp32_modules`, and runs final weight init.
91
+ self.post_init()
92
+
93
  def forward(
94
  self,
95
  pixel_values: torch.FloatTensor,