From 9acdd87b835ad627b665760c50538db11536cabc Mon Sep 17 00:00:00 2001 From: ocavue Date: Sun, 8 Dec 2024 10:15:45 +1100 Subject: [PATCH] add @ts-expect-error --- src/models/convnext/image_processing_convnext.js | 1 + src/models/efficientnet/image_processing_efficientnet.js | 1 + src/models/paligemma/processing_paligemma.js | 1 + src/models/qwen2_vl/processing_qwen2_vl.js | 1 + src/pipelines.js | 6 +++++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/models/convnext/image_processing_convnext.js b/src/models/convnext/image_processing_convnext.js index 525e736cd..7b867a60a 100644 --- a/src/models/convnext/image_processing_convnext.js +++ b/src/models/convnext/image_processing_convnext.js @@ -9,6 +9,7 @@ export class ConvNextImageProcessor extends ImageProcessor { /** * Percentage of the image to crop. Only has an effect if this.size < 384. */ + // @ts-expect-error TS2339 this.crop_pct = this.config.crop_pct ?? (224 / 256); } diff --git a/src/models/efficientnet/image_processing_efficientnet.js b/src/models/efficientnet/image_processing_efficientnet.js index 9fde87156..29a594e18 100644 --- a/src/models/efficientnet/image_processing_efficientnet.js +++ b/src/models/efficientnet/image_processing_efficientnet.js @@ -5,6 +5,7 @@ import { export class EfficientNetImageProcessor extends ImageProcessor { constructor(config) { super(config); + // @ts-expect-error TS2339 this.include_top = this.config.include_top ?? true; if (this.include_top) { this.image_std = this.image_std.map(x => x * x); diff --git a/src/models/paligemma/processing_paligemma.js b/src/models/paligemma/processing_paligemma.js index 9fb580cd8..63f50b99d 100644 --- a/src/models/paligemma/processing_paligemma.js +++ b/src/models/paligemma/processing_paligemma.js @@ -41,6 +41,7 @@ export class PaliGemmaProcessor extends Processor { } const bos_token = this.tokenizer.bos_token; + // @ts-expect-error TS2339 const image_seq_length = this.image_processor.config.image_seq_length; let input_strings; if (text.some((t) => t.includes(IMAGE_TOKEN))) { diff --git a/src/models/qwen2_vl/processing_qwen2_vl.js b/src/models/qwen2_vl/processing_qwen2_vl.js index d5f05535b..692987f86 100644 --- a/src/models/qwen2_vl/processing_qwen2_vl.js +++ b/src/models/qwen2_vl/processing_qwen2_vl.js @@ -28,6 +28,7 @@ export class Qwen2VLProcessor extends Processor { } if (image_grid_thw) { + // @ts-expect-error TS2551 let merge_length = this.image_processor.config.merge_size ** 2; let index = 0; diff --git a/src/pipelines.js b/src/pipelines.js index 386bcbc8b..ce8dbd9cc 100644 --- a/src/pipelines.js +++ b/src/pipelines.js @@ -1492,6 +1492,7 @@ export class AudioClassificationPipeline extends (/** @type {new (options: Audio const sampling_rate = this.processor.feature_extractor.config.sampling_rate; const preparedAudios = await prepareAudios(audio, sampling_rate); + // @ts-expect-error TS2339 const id2label = this.model.config.id2label; const toReturn = []; @@ -1866,7 +1867,9 @@ export class AutomaticSpeechRecognitionPipeline extends (/** @type {new (options // TODO: Right now we only get top beam if (return_timestamps === 'word') { + // @ts-expect-error TS2339 chunk.tokens = data.sequences.tolist()[0]; + // @ts-expect-error TS2339 chunk.token_timestamps = data.token_timestamps.tolist()[0].map( (/** @type {number} */ x) => round(x, 2) ); @@ -2032,6 +2035,7 @@ export class ImageClassificationPipeline extends (/** @type {new (options: Image const { pixel_values } = await this.processor(preparedImages); const output = await this.model({ pixel_values }); + // @ts-expect-error TS2339 const id2label = this.model.config.id2label; /** @type {ImageClassificationOutput[]} */ @@ -3349,4 +3353,4 @@ async function loadItems(mapping, model, pretrainedOptions) { } return result; -} \ No newline at end of file +}