@@ -581,7 +581,7 @@ def _maybe_initialize_input_ids_for_generation(
581581 encoder_outputs = model_kwargs .get ("encoder_outputs" )
582582 if self .config .is_encoder_decoder and encoder_outputs is not None :
583583 # make dummy input_ids with value -100, as a sanity check ensuring that they won't be used for encoding
584- shape = encoder_outputs .last_hidden_state .size () [:- 1 ]
584+ shape = encoder_outputs .last_hidden_state .shape [:- 1 ]
585585 return ops .ones (shape , dtype = mindspore .int64 ) * - 100
586586
587587 if bos_token_id is None :
@@ -609,7 +609,7 @@ def _maybe_initialize_input_ids_for_generation(
609609 encoder_outputs = model_kwargs .get ("encoder_outputs" )
610610 if self .config .is_encoder_decoder and encoder_outputs is not None :
611611 # make dummy input_ids with value -100, as a sanity check ensuring that they won't be used for encoding
612- shape = encoder_outputs .last_hidden_state .size () [:- 1 ]
612+ shape = encoder_outputs .last_hidden_state .shape [:- 1 ]
613613 return ops .ones (shape , dtype = mindspore .int64 ) * - 100
614614
615615 if bos_token_id is None :
@@ -651,7 +651,7 @@ def _prepare_input_ids_for_generation(
651651 ) -> mindspore .Tensor :
652652 if self .config .is_encoder_decoder and encoder_outputs is not None :
653653 # make dummy input_ids with value -100, as a sanity check ensuring that they won't be used for encoding
654- shape = encoder_outputs .last_hidden_state .size () [:- 1 ]
654+ shape = encoder_outputs .last_hidden_state .shape [:- 1 ]
655655 return ops .ones (shape , dtype = mindspore .float32 ) * - 100
656656
657657 if bos_token_id is None :
0 commit comments