Skip to content

Commit f36e0bf

Browse files
authored
Merge pull request #3 from huggingface/main
Fix type errors (huggingface#1436)
2 parents 19a6e03 + fcf2ec9 commit f36e0bf

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/models/auto/processing_auto.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ import * as AllProcessors from '../processors.js';
88
import * as AllImageProcessors from '../image_processors.js';
99
import * as AllFeatureExtractors from '../feature_extractors.js';
1010

11+
/**
12+
* @typedef {import('../../base/processing_utils.js').PretrainedProcessorOptions} PretrainedProcessorOptions
13+
*/
14+
1115
/**
1216
* Helper class which is used to instantiate pretrained processors with the `from_pretrained` function.
1317
* The chosen processor class is determined by the type specified in the processor config.
14-
*
18+
*
1519
* **Example:** Load a processor using `from_pretrained`.
1620
* ```javascript
1721
* let processor = await AutoProcessor.from_pretrained('openai/whisper-tiny.en');
1822
* ```
19-
*
23+
*
2024
* **Example:** Run an image through a processor.
2125
* ```javascript
2226
* let processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');

src/models/mgp_str/processing_mgp_str.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class MgpstrProcessor extends Processor {
110110

111111
/**
112112
* Convert a list of lists of token ids into a list of strings by calling decode.
113-
* @param {import('../../utils/tensor.js').Tensor[]} sequences List of tokenized input ids.
113+
* @param {[import('../../utils/tensor.js').Tensor, import('../../utils/tensor.js').Tensor, import('../../utils/tensor.js').Tensor]} sequences List of tokenized input ids.
114114
* @returns {{generated_text: string[], scores: number[], char_preds: string[], bpe_preds: string[], wp_preds: string[]}}
115115
* Dictionary of all the outputs of the decoded results.
116116
* - generated_text: The final results after fusion of char, bpe, and wp.
@@ -119,8 +119,7 @@ export class MgpstrProcessor extends Processor {
119119
* - bpe_preds: The list of BPE decoded sentences.
120120
* - wp_preds: The list of wp decoded sentences.
121121
*/
122-
// @ts-expect-error The type of this method is not compatible with the one
123-
// in the base class. It might be a good idea to fix this.
122+
// @ts-expect-error The type of this method is not compatible with the one in the base class.
124123
batch_decode([char_logits, bpe_logits, wp_logits]) {
125124
const [char_preds, char_scores] = this._decode_helper(char_logits, 'char');
126125
const [bpe_preds, bpe_scores] = this._decode_helper(bpe_logits, 'bpe');

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"declaration": true,
1414
"declarationMap": true,
1515
"noEmit": false,
16-
"emitDeclarationOnly": true
16+
"emitDeclarationOnly": true,
17+
"esModuleInterop": true
1718
},
1819
"typeAcquisition": {
1920
"include": ["jest"]

0 commit comments

Comments
 (0)