Update modeling_internlm2.py for transformers >=4.50.0

#5
by Yukino0301 - opened
Files changed (1) hide show
  1. modeling_internlm2.py +2 -1
modeling_internlm2.py CHANGED
@@ -34,6 +34,7 @@ from transformers.modeling_utils import PreTrainedModel
34
  from transformers.utils import (add_start_docstrings,
35
  add_start_docstrings_to_model_forward, logging,
36
  replace_return_docstrings)
 
37
 
38
  try:
39
  from transformers.generation.streamers import BaseStreamer
@@ -1026,7 +1027,7 @@ class InternLM2Model(InternLM2PreTrainedModel):
1026
 
1027
 
1028
  # Modified from transformers.model.llama.modeling_llama.LlamaForCausalLM
1029
- class InternLM2ForCausalLM(InternLM2PreTrainedModel):
1030
  _auto_class = 'AutoModelForCausalLM'
1031
 
1032
  _tied_weights_keys = ['output.weight']
 
34
  from transformers.utils import (add_start_docstrings,
35
  add_start_docstrings_to_model_forward, logging,
36
  replace_return_docstrings)
37
+ from transformers.generation.utils import GenerationMixin
38
 
39
  try:
40
  from transformers.generation.streamers import BaseStreamer
 
1027
 
1028
 
1029
  # Modified from transformers.model.llama.modeling_llama.LlamaForCausalLM
1030
+ class InternLM2ForCausalLM(InternLM2PreTrainedModel, GenerationMixin):
1031
  _auto_class = 'AutoModelForCausalLM'
1032
 
1033
  _tied_weights_keys = ['output.weight']