Skip to content

Commit

Permalink
[Tasks] remove duplicate description in task parameter objects (#1045)
Browse files Browse the repository at this point in the history
this PR removes redundant description in task parameter classes
definition while keeping it in the parameters field reference. this
avoids duplicate documentation, see:
[huggingface/huggingface_hub/pull/2664#discussion](huggingface/huggingface_hub#2664 (comment))
for more context.

Note : `packages/tasks/src/tasks/{task_name/inference.ts` files are
auto-generated.
  • Loading branch information
hanouticelina authored Nov 21, 2024
1 parent 21158d7 commit 0ebf911
Show file tree
Hide file tree
Showing 54 changed files with 53 additions and 135 deletions.
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/audio-classification/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ export interface AudioClassificationInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Audio Classification
*/
parameters?: AudioClassificationParameters;
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Audio Classification
*/
export interface AudioClassificationParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"type": "string"
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Audio Classification",
"$ref": "#/$defs/AudioClassificationParameters"
}
},
"$defs": {
"AudioClassificationParameters": {
"title": "AudioClassificationParameters",
"description": "Additional inference parameters for Audio Classification",
"type": "object",
"properties": {
"function_to_apply": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ export interface AutomaticSpeechRecognitionInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Automatic Speech Recognition
*/
parameters?: AutomaticSpeechRecognitionParameters;
[property: string]: unknown;
}

/**
* Additional inference parameters
*
* Additional inference parameters for Automatic Speech Recognition
*/
export interface AutomaticSpeechRecognitionParameters {
Expand All @@ -39,8 +37,6 @@ export interface AutomaticSpeechRecognitionParameters {

/**
* Parametrization of the text generation process
*
* Ad-hoc parametrization of the text generation process
*/
export interface GenerationParameters {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"type": "string"
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Automatic Speech Recognition",
"$ref": "#/$defs/AutomaticSpeechRecognitionParameters"
}
},
"$defs": {
"AutomaticSpeechRecognitionParameters": {
"title": "AutomaticSpeechRecognitionParameters",
"description": "Additional inference parameters for Automatic Speech Recognition",
"type": "object",
"properties": {
"return_timestamps": {
Expand Down
1 change: 0 additions & 1 deletion packages/tasks/src/tasks/common-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
},
"GenerationParameters": {
"title": "GenerationParameters",
"description": "Ad-hoc parametrization of the text generation process",
"type": "object",
"properties": {
"temperature": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tasks/src/tasks/depth-estimation/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface DepthEstimationInput {
*/
inputs: unknown;
/**
* Additional inference parameters
* Additional inference parameters for Depth Estimation
*/
parameters?: { [key: string]: unknown };
[property: string]: unknown;
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/depth-estimation/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
"description": "The input image data"
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Depth Estimation",
"$ref": "#/$defs/DepthEstimationParameters"
}
},
"$defs": {
"DepthEstimationParameters": {
"title": "DepthEstimationParameters",
"description": "Additional inference parameters for Depth Estimation",
"type": "object",
"properties": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface DocumentQuestionAnsweringInput {
*/
inputs: DocumentQuestionAnsweringInputData;
/**
* Additional inference parameters
* Additional inference parameters for Document Question Answering
*/
parameters?: DocumentQuestionAnsweringParameters;
[property: string]: unknown;
Expand All @@ -32,8 +32,6 @@ export interface DocumentQuestionAnsweringInputData {
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Document Question Answering
*/
export interface DocumentQuestionAnsweringParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
"required": ["image", "question"]
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Document Question Answering",
"$ref": "#/$defs/DocumentQuestionAnsweringParameters"
}
},
"$defs": {
"DocumentQuestionAnsweringParameters": {
"title": "DocumentQuestionAnsweringParameters",
"description": "Additional inference parameters for Document Question Answering",
"type": "object",
"properties": {
"doc_stride": {
Expand Down
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/fill-mask/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ export interface FillMaskInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Fill Mask
*/
parameters?: FillMaskParameters;
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Fill Mask
*/
export interface FillMaskParameters {
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/fill-mask/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"type": "string"
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Fill Mask",
"$ref": "#/$defs/FillMaskParameters"
}
},
"$defs": {
"FillMaskParameters": {
"title": "FillMaskParameters",
"description": "Additional inference parameters for Fill Mask",
"type": "object",
"properties": {
"top_k": {
Expand Down
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/image-classification/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ export interface ImageClassificationInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Image Classification
*/
parameters?: ImageClassificationParameters;
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Image Classification
*/
export interface ImageClassificationParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"description": "The input image data as a base64-encoded string. If no `parameters` are provided, you can also provide the image data as a raw bytes payload."
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Image Classification",
"$ref": "#/$defs/ImageClassificationParameters"
}
},
"$defs": {
"ImageClassificationParameters": {
"title": "ImageClassificationParameters",
"description": "Additional inference parameters for Image Classification",
"type": "object",
"properties": {
"function_to_apply": {
Expand Down
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/image-segmentation/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ export interface ImageSegmentationInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Image Segmentation
*/
parameters?: ImageSegmentationParameters;
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Image Segmentation
*/
export interface ImageSegmentationParameters {
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/image-segmentation/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"description": "The input image data as a base64-encoded string. If no `parameters` are provided, you can also provide the image data as a raw bytes payload."
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Image Segmentation",
"$ref": "#/$defs/ImageSegmentationParameters"
}
},
"$defs": {
"ImageSegmentationParameters": {
"title": "ImageSegmentationParameters",
"description": "Additional inference parameters for Image Segmentation",
"type": "object",
"properties": {
"mask_threshold": {
Expand Down
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/image-to-image/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ export interface ImageToImageInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Image To Image
*/
parameters?: ImageToImageParameters;
[property: string]: unknown;
}

/**
* Additional inference parameters
*
* Additional inference parameters for Image To Image
*/
export interface ImageToImageParameters {
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/image-to-image/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"description": "The input image data as a base64-encoded string. If no `parameters` are provided, you can also provide the image data as a raw bytes payload."
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Image To Image",
"$ref": "#/$defs/ImageToImageParameters"
}
},
"$defs": {
"ImageToImageParameters": {
"title": "ImageToImageParameters",
"description": "Additional inference parameters for Image To Image",
"type": "object",
"properties": {
"guidance_scale": {
Expand Down
6 changes: 1 addition & 5 deletions packages/tasks/src/tasks/image-to-text/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ export interface ImageToTextInput {
*/
inputs: unknown;
/**
* Additional inference parameters
* Additional inference parameters for Image To Text
*/
parameters?: ImageToTextParameters;
[property: string]: unknown;
}

/**
* Additional inference parameters
*
* Additional inference parameters for Image To Text
*/
export interface ImageToTextParameters {
Expand All @@ -38,8 +36,6 @@ export interface ImageToTextParameters {

/**
* Parametrization of the text generation process
*
* Ad-hoc parametrization of the text generation process
*/
export interface GenerationParameters {
/**
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/image-to-text/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
"description": "The input image data"
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Image To Text",
"$ref": "#/$defs/ImageToTextParameters"
}
},
"$defs": {
"ImageToTextParameters": {
"title": "ImageToTextParameters",
"description": "Additional inference parameters for Image To Text",
"type": "object",
"properties": {
"max_new_tokens": {
Expand Down
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/object-detection/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ export interface ObjectDetectionInput {
*/
inputs: string;
/**
* Additional inference parameters
* Additional inference parameters for Object Detection
*/
parameters?: ObjectDetectionParameters;
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Object Detection
*/
export interface ObjectDetectionParameters {
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/object-detection/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"description": "The input image data as a base64-encoded string. If no `parameters` are provided, you can also provide the image data as a raw bytes payload."
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Object Detection",
"$ref": "#/$defs/ObjectDetectionParameters"
}
},
"$defs": {
"ObjectDetectionParameters": {
"title": "ObjectDetectionParameters",
"description": "Additional inference parameters for Object Detection",
"type": "object",
"properties": {
"threshold": {
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/placeholder/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
"type": "string"
},
"parameters": {
"description": "Additional inference parameters",
"description": "TODO: describe additional parameters here.",
"$ref": "#/$defs/<TASK_ID>Parameters"
}
},
"$defs": {
"<TASK_ID>Parameters": {
"title": "<TASK_ID>Parameters",
"description": "TODO: describe additional parameters here.",
"type": "object",
"properties": {
"dummy_parameter_name": {
Expand Down
4 changes: 1 addition & 3 deletions packages/tasks/src/tasks/question-answering/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface QuestionAnsweringInput {
*/
inputs: QuestionAnsweringInputData;
/**
* Additional inference parameters
* Additional inference parameters for Question Answering
*/
parameters?: QuestionAnsweringParameters;
[property: string]: unknown;
Expand All @@ -32,8 +32,6 @@ export interface QuestionAnsweringInputData {
[property: string]: unknown;
}
/**
* Additional inference parameters
*
* Additional inference parameters for Question Answering
*/
export interface QuestionAnsweringParameters {
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/src/tasks/question-answering/spec/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
"required": ["question", "context"]
},
"parameters": {
"description": "Additional inference parameters",
"description": "Additional inference parameters for Question Answering",
"$ref": "#/$defs/QuestionAnsweringParameters"
}
},
"$defs": {
"QuestionAnsweringParameters": {
"title": "QuestionAnsweringParameters",
"description": "Additional inference parameters for Question Answering",
"type": "object",
"properties": {
"top_k": {
Expand Down
Loading

0 comments on commit 0ebf911

Please sign in to comment.