Add placeholder for the `prepare_inputs_for_generation` method for compatibility with transformers>=4.50

#78
Files changed (1) hide show
  1. modeling_phi4mm.py +9 -0
modeling_phi4mm.py CHANGED
@@ -1932,6 +1932,15 @@ class Phi4MMModel(Phi4MMPreTrainedModel):
1932
  )
1933
  return causal_mask
1934
 
 
 
 
 
 
 
 
 
 
1935
 
1936
  class Phi4MMForCausalLM(Phi4MMPreTrainedModel, GenerationMixin):
1937
  _tied_weights_keys = ["lm_head.weight"]
 
1932
  )
1933
  return causal_mask
1934
 
1935
+ def prepare_inputs_for_generation():
1936
+ """
1937
+ Placeholder for the `prepare_inputs_for_generation` method.
1938
+
1939
+ This function is part of the `GenerationMixin` and is added to the `Phi4MMModel`
1940
+ class to prevent the model from breaking due to the AttributeError.
1941
+ """
1942
+ pass
1943
+
1944
 
1945
  class Phi4MMForCausalLM(Phi4MMPreTrainedModel, GenerationMixin):
1946
  _tied_weights_keys = ["lm_head.weight"]