Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Dec 7, 2024
1 parent c9712eb commit 9acdd87
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/models/convnext/image_processing_convnext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions src/models/efficientnet/image_processing_efficientnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/models/paligemma/processing_paligemma.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down
1 change: 1 addition & 0 deletions src/models/qwen2_vl/processing_qwen2_vl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion src/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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)
);
Expand Down Expand Up @@ -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[]} */
Expand Down Expand Up @@ -3349,4 +3353,4 @@ async function loadItems(mapping, model, pretrainedOptions) {
}

return result;
}
}

0 comments on commit 9acdd87

Please sign in to comment.