Skip to content

Commit 38ec1d4

Browse files
authored
Improve typing of pipeline helper function (#485)
* Improve typing of `pipeline` helper function * Overhaul image pipeline types * Improve typing * Fix export * Do not require separate proxy object * Update text classification pipeline types * Fix calls to base pipeline * Improve inheritance * Fix JSDoc * Update token classification pipeline typing * Update question answering pipeline * Update fill-mask pipeline * Fix JSDoc * Improve generation config typing * Update text2text generation pipeline * Fix generation config type * Update summarization and translation pipelines * Update text generation pipeline types * Update zero-shot classification pipeline types * Update feature extraction pipeline types * Update audio pipeline types * Fix generation config types * Improve pipeline constructor types * Update image to text pipeline types * Update image classification pipeline types * Update zero-shot image classification pipeline types * Update ImageSegmentationPipeline constructor type * Update object detection pipeline types * Update zero-shot object detection pipeline types * Update document question answering pipeline types * Update text-to-audio pipeline types * Update image-to-image pipeline types * Update depth estimation pipeline types * Improve return JSDoc * Improve example pipeline JSDoc
1 parent 61459e3 commit 38ec1d4

File tree

6 files changed

+1173
-898
lines changed

6 files changed

+1173
-898
lines changed

src/models.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ export class PreTrainedModel extends Callable {
813813
}
814814

815815
/**
816-
* @param {GenerationConfig} generation_config
816+
* @param {import('./utils/generation.js').GenerationConfigType} generation_config
817817
* @param {number} input_ids_seq_length The starting sequence length for the input ids.
818818
* @returns {LogitsProcessorList}
819819
* @private
@@ -943,9 +943,8 @@ export class PreTrainedModel extends Callable {
943943
/**
944944
* This function merges multiple generation configs together to form a final generation config to be used by the model for text generation.
945945
* It first creates an empty `GenerationConfig` object, then it applies the model's own `generation_config` property to it. Finally, if a `generation_config` object was passed in the arguments, it overwrites the corresponding properties in the final config with those of the passed config object.
946-
*
947-
* @param {GenerationConfig} generation_config A `GenerationConfig` object containing generation parameters.
948-
* @returns {GenerationConfig} The final generation config object to be used by the model for text generation.
946+
* @param {import('./utils/generation.js').GenerationConfigType} generation_config A `GenerationConfig` object containing generation parameters.
947+
* @returns {import('./utils/generation.js').GenerationConfigType} The final generation config object to be used by the model for text generation.
949948
*/
950949
_get_generation_config(generation_config) {
951950
// Create empty generation config (contains defaults)

0 commit comments

Comments
 (0)