@@ -387,9 +387,17 @@ async function sessionRun(session, inputs) {
387387 output = replaceTensors ( output ) ;
388388 return output ;
389389 } catch ( e ) {
390+ // Error messages can be long (nested) and uninformative. For this reason,
391+ // we apply minor formatting to show the most important information
392+ const formatted = Object . fromEntries ( Object . entries ( checkedInputs )
393+ . map ( ( [ k , { type, dims, data } ] ) => [ k , {
394+ // Extract these properties from the underlying ORT tensor
395+ type, dims, data,
396+ } ] ) ) ;
397+
390398 // This usually occurs when the inputs are of the wrong type.
391399 console . error ( `An error occurred during model execution: "${ e } ".` ) ;
392- console . error ( 'Inputs given to model:' , checkedInputs )
400+ console . error ( 'Inputs given to model:' , formatted ) ;
393401 throw e ;
394402 }
395403}
@@ -3544,7 +3552,7 @@ export class Idefics3ForConditionalGeneration extends Idefics3PreTrainedModel {
35443552 const features = ( await sessionRun ( this . sessions [ 'vision_encoder' ] , { pixel_values, pixel_attention_mask } ) ) . image_features ;
35453553 return features ;
35463554 }
3547-
3555+
35483556 _merge_input_ids_with_image_features ( kwargs ) {
35493557 const vision_hidden_size = kwargs . image_features . dims . at ( - 1 ) ;
35503558 const reshaped_image_hidden_states = kwargs . image_features . view ( - 1 , vision_hidden_size ) ;
@@ -4355,7 +4363,7 @@ export class Qwen2VLForConditionalGeneration extends Qwen2VLPreTrainedModel {
43554363
43564364 _merge_input_ids_with_image_features ( kwargs ) {
43574365 return default_merge_input_ids_with_image_features ( {
4358- // @ts -ignore
4366+ // @ts -ignore
43594367 image_token_id : this . config . image_token_id ,
43604368 ...kwargs
43614369 } )
0 commit comments