Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/models/auto/processing_auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ import * as AllProcessors from '../processors.js';
import * as AllImageProcessors from '../image_processors.js';
import * as AllFeatureExtractors from '../feature_extractors.js';

/**
* @typedef {import('../../base/processing_utils.js').PretrainedProcessorOptions} PretrainedProcessorOptions
*/

/**
* Helper class which is used to instantiate pretrained processors with the `from_pretrained` function.
* The chosen processor class is determined by the type specified in the processor config.
*
*
* **Example:** Load a processor using `from_pretrained`.
* ```javascript
* let processor = await AutoProcessor.from_pretrained('openai/whisper-tiny.en');
* ```
*
*
* **Example:** Run an image through a processor.
* ```javascript
* let processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');
Expand Down
5 changes: 2 additions & 3 deletions src/models/mgp_str/processing_mgp_str.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class MgpstrProcessor extends Processor {

/**
* Convert a list of lists of token ids into a list of strings by calling decode.
* @param {import('../../utils/tensor.js').Tensor[]} sequences List of tokenized input ids.
* @param {[import('../../utils/tensor.js').Tensor, import('../../utils/tensor.js').Tensor, import('../../utils/tensor.js').Tensor]} sequences List of tokenized input ids.
* @returns {{generated_text: string[], scores: number[], char_preds: string[], bpe_preds: string[], wp_preds: string[]}}
* Dictionary of all the outputs of the decoded results.
* - generated_text: The final results after fusion of char, bpe, and wp.
Expand All @@ -119,8 +119,7 @@ export class MgpstrProcessor extends Processor {
* - bpe_preds: The list of BPE decoded sentences.
* - wp_preds: The list of wp decoded sentences.
*/
// @ts-expect-error The type of this method is not compatible with the one
// in the base class. It might be a good idea to fix this.
// @ts-expect-error The type of this method is not compatible with the one in the base class.
batch_decode([char_logits, bpe_logits, wp_logits]) {
const [char_preds, char_scores] = this._decode_helper(char_logits, 'char');
const [bpe_preds, bpe_scores] = this._decode_helper(bpe_logits, 'bpe');
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"declaration": true,
"declarationMap": true,
"noEmit": false,
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"esModuleInterop": true
},
"typeAcquisition": {
"include": ["jest"]
Expand Down