Skip to content

Commit 04fa3bb

Browse files
Tasks: add function_to_apply's docstring for classification tasks (huggingface#1043)
This PR adds missing parameter description for `function_to_apply`. this documentation is required since huggingface_hub's `InferenceClient` documentation is automatically generated from the specs defined here (See [huggingface_hub/.github/workflows/update-inference-types.yaml](https://github.com/huggingface/huggingface_hub/blob/main/.github/workflows/update-inference-types.yaml) for more details). Note: the description was not technically missing since it's already available in `ClassificationOutputTransform`'s description, but it wasn't being properly inferred for the `function_to_apply` property.
1 parent f0389a6 commit 04fa3bb

File tree

8 files changed

+20
-4
lines changed

8 files changed

+20
-4
lines changed

packages/tasks/src/tasks/audio-classification/inference.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export interface AudioClassificationInput {
2424
* Additional inference parameters for Audio Classification
2525
*/
2626
export interface AudioClassificationParameters {
27+
/**
28+
* The function to apply to the model outputs in order to retrieve the scores.
29+
*/
2730
function_to_apply?: ClassificationOutputTransform;
2831
/**
2932
* When specified, limits the output to the top K most probable classes.

packages/tasks/src/tasks/audio-classification/spec/input.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"properties": {
2323
"function_to_apply": {
2424
"title": "AudioClassificationOutputTransform",
25-
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
25+
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
26+
"description": "The function to apply to the model outputs in order to retrieve the scores."
2627
},
2728
"top_k": {
2829
"type": "integer",

packages/tasks/src/tasks/image-classification/inference.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export interface ImageClassificationInput {
2424
* Additional inference parameters for Image Classification
2525
*/
2626
export interface ImageClassificationParameters {
27+
/**
28+
* The function to apply to the model outputs in order to retrieve the scores.
29+
*/
2730
function_to_apply?: ClassificationOutputTransform;
2831
/**
2932
* When specified, limits the output to the top K most probable classes.

packages/tasks/src/tasks/image-classification/spec/input.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"properties": {
2323
"function_to_apply": {
2424
"title": "ImageClassificationOutputTransform",
25-
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
25+
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
26+
"description": "The function to apply to the model outputs in order to retrieve the scores."
2627
},
2728
"top_k": {
2829
"type": "integer",

packages/tasks/src/tasks/text-classification/inference.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export interface TextClassificationInput {
2323
* Additional inference parameters for Text Classification
2424
*/
2525
export interface TextClassificationParameters {
26+
/**
27+
* The function to apply to the model outputs in order to retrieve the scores.
28+
*/
2629
function_to_apply?: ClassificationOutputTransform;
2730
/**
2831
* When specified, limits the output to the top K most probable classes.

packages/tasks/src/tasks/text-classification/spec/input.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"properties": {
2323
"function_to_apply": {
2424
"title": "TextClassificationOutputTransform",
25-
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
25+
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
26+
"description": "The function to apply to the model outputs in order to retrieve the scores."
2627
},
2728
"top_k": {
2829
"type": "integer",

packages/tasks/src/tasks/video-classification/inference.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export interface VideoClassificationParameters {
2727
* The sampling rate used to select frames from the video.
2828
*/
2929
frame_sampling_rate?: number;
30+
/**
31+
* The function to apply to the model outputs in order to retrieve the scores.
32+
*/
3033
function_to_apply?: ClassificationOutputTransform;
3134
/**
3235
* The number of sampled frames to consider for classification.

packages/tasks/src/tasks/video-classification/spec/input.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"properties": {
2222
"function_to_apply": {
2323
"title": "TextClassificationOutputTransform",
24-
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
24+
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
25+
"description": "The function to apply to the model outputs in order to retrieve the scores."
2526
},
2627
"num_frames": {
2728
"type": "integer",

0 commit comments

Comments
 (0)