File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ export class Idefics3ImageProcessor extends ImageProcessor {
146146
147147 const start_offset = i * pixel_attention_mask_stride + num_patches * h * w ;
148148 const end_offset = ( i + 1 ) * pixel_attention_mask_stride ;
149+
150+ // @ts -expect-error
149151 pixel_attention_mask_data . fill ( false , start_offset , end_offset ) ;
150152 }
151153 }
Original file line number Diff line number Diff line change @@ -133,8 +133,8 @@ export class SeamlessM4TFeatureExtractor extends FeatureExtractor {
133133 'int64' ,
134134 new BigInt64Array ( numPaddedFrames ) ,
135135 [ 1 , numPaddedFrames ] ,
136- )
137- padded_attention_mask . data . fill ( 1n , 0 , num_frames ) ;
136+ ) ;
137+ /** @type { BigInt64Array } */ ( padded_attention_mask . data ) . fill ( 1n , 0 , num_frames ) ;
138138 }
139139 }
140140 }
Original file line number Diff line number Diff line change @@ -1916,7 +1916,7 @@ export class AutomaticSpeechRecognitionPipeline extends (/** @type {new (options
19161916 const max_new_tokens = Math . floor ( aud . length / sampling_rate ) * 6 ;
19171917 const outputs = await this . model . generate ( { max_new_tokens, ...kwargs , ...inputs } ) ;
19181918
1919- const text = this . processor . batch_decode ( outputs , { skip_special_tokens : true } ) [ 0 ] ;
1919+ const text = this . processor . batch_decode ( /** @type { Tensor } */ ( outputs ) , { skip_special_tokens : true } ) [ 0 ] ;
19201920 toReturn . push ( { text } ) ;
19211921 }
19221922 return single ? toReturn [ 0 ] : toReturn ;
Original file line number Diff line number Diff line change @@ -535,19 +535,18 @@ class Unigram extends TokenizerModel {
535535 * Create a new Unigram tokenizer model.
536536 * @param {Object } config The configuration object for the Unigram model.
537537 * @param {number } config.unk_id The ID of the unknown token
538- * @param {any[ ][] } config.vocab A 2D array representing a mapping of tokens to scores.
538+ * @param {[string, number ][] } config.vocab A 2D array representing a mapping of tokens to scores.
539539 * @param {Object } moreConfig Additional configuration object for the Unigram model.
540540 */
541541 constructor ( config , moreConfig ) {
542542 super ( config ) ;
543543
544544 const vocabSize = config . vocab . length ;
545545 this . vocab = new Array ( vocabSize ) ;
546+ /** @type {number[] } */
546547 this . scores = new Array ( vocabSize ) ;
547548 for ( let i = 0 ; i < vocabSize ; ++ i ) {
548- const piece = config . vocab [ i ] ;
549- this . vocab [ i ] = piece [ 0 ] ;
550- this . scores [ i ] = piece [ 1 ] ;
549+ [ this . vocab [ i ] , this . scores [ i ] ] = config . vocab [ i ] ;
551550 }
552551
553552 this . unk_token_id = config . unk_id ;
You can’t perform that action at this time.
0 commit comments