@huggingface/tasks 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +3144 -3085
  3. package/dist/index.d.ts +441 -74
  4. package/dist/index.js +3143 -3084
  5. package/package.json +1 -1
  6. package/src/index.ts +2 -5
  7. package/src/library-to-tasks.ts +1 -1
  8. package/src/model-libraries-downloads.ts +20 -0
  9. package/src/{library-ui-elements.ts → model-libraries-snippets.ts} +46 -292
  10. package/src/model-libraries.ts +375 -44
  11. package/src/pipelines.ts +14 -8
  12. package/src/tasks/audio-classification/inference.ts +4 -4
  13. package/src/tasks/audio-classification/spec/input.json +4 -4
  14. package/src/tasks/audio-classification/spec/output.json +1 -12
  15. package/src/tasks/automatic-speech-recognition/inference.ts +35 -30
  16. package/src/tasks/automatic-speech-recognition/spec/input.json +3 -3
  17. package/src/tasks/automatic-speech-recognition/spec/output.json +30 -28
  18. package/src/tasks/common-definitions.json +25 -17
  19. package/src/tasks/depth-estimation/inference.ts +10 -10
  20. package/src/tasks/depth-estimation/spec/input.json +3 -8
  21. package/src/tasks/depth-estimation/spec/output.json +9 -3
  22. package/src/tasks/document-question-answering/inference.ts +16 -8
  23. package/src/tasks/document-question-answering/spec/input.json +9 -9
  24. package/src/tasks/document-question-answering/spec/output.json +2 -2
  25. package/src/tasks/feature-extraction/inference.ts +1 -1
  26. package/src/tasks/feature-extraction/spec/input.json +2 -2
  27. package/src/tasks/fill-mask/inference.ts +4 -3
  28. package/src/tasks/fill-mask/spec/input.json +3 -3
  29. package/src/tasks/fill-mask/spec/output.json +1 -1
  30. package/src/tasks/image-classification/inference.ts +3 -3
  31. package/src/tasks/image-classification/spec/input.json +4 -4
  32. package/src/tasks/image-segmentation/inference.ts +3 -3
  33. package/src/tasks/image-segmentation/spec/input.json +4 -4
  34. package/src/tasks/image-to-image/inference.ts +5 -5
  35. package/src/tasks/image-to-image/spec/input.json +9 -7
  36. package/src/tasks/image-to-text/inference.ts +25 -20
  37. package/src/tasks/image-to-text/spec/input.json +3 -3
  38. package/src/tasks/image-to-text/spec/output.json +8 -11
  39. package/src/tasks/index.ts +2 -0
  40. package/src/tasks/object-detection/inference.ts +1 -1
  41. package/src/tasks/object-detection/spec/input.json +2 -2
  42. package/src/tasks/placeholder/spec/input.json +4 -4
  43. package/src/tasks/placeholder/spec/output.json +1 -1
  44. package/src/tasks/question-answering/inference.ts +8 -8
  45. package/src/tasks/question-answering/spec/input.json +9 -9
  46. package/src/tasks/sentence-similarity/inference.ts +1 -1
  47. package/src/tasks/sentence-similarity/spec/input.json +2 -2
  48. package/src/tasks/summarization/inference.ts +5 -4
  49. package/src/tasks/table-question-answering/inference.ts +1 -1
  50. package/src/tasks/table-question-answering/spec/input.json +8 -3
  51. package/src/tasks/text-classification/inference.ts +3 -3
  52. package/src/tasks/text-classification/spec/input.json +4 -4
  53. package/src/tasks/text-generation/inference.ts +123 -14
  54. package/src/tasks/text-generation/spec/input.json +28 -12
  55. package/src/tasks/text-generation/spec/output.json +112 -9
  56. package/src/tasks/text-to-audio/inference.ts +24 -19
  57. package/src/tasks/text-to-audio/spec/input.json +2 -2
  58. package/src/tasks/text-to-audio/spec/output.json +10 -13
  59. package/src/tasks/text-to-image/inference.ts +6 -8
  60. package/src/tasks/text-to-image/spec/input.json +9 -7
  61. package/src/tasks/text-to-image/spec/output.json +7 -9
  62. package/src/tasks/text-to-speech/inference.ts +18 -17
  63. package/src/tasks/text2text-generation/inference.ts +10 -8
  64. package/src/tasks/text2text-generation/spec/input.json +4 -4
  65. package/src/tasks/text2text-generation/spec/output.json +8 -11
  66. package/src/tasks/token-classification/inference.ts +4 -4
  67. package/src/tasks/token-classification/spec/input.json +4 -4
  68. package/src/tasks/token-classification/spec/output.json +1 -1
  69. package/src/tasks/translation/inference.ts +5 -4
  70. package/src/tasks/video-classification/inference.ts +5 -5
  71. package/src/tasks/video-classification/spec/input.json +6 -6
  72. package/src/tasks/visual-question-answering/inference.ts +2 -2
  73. package/src/tasks/visual-question-answering/spec/input.json +3 -3
  74. package/src/tasks/zero-shot-classification/inference.ts +3 -3
  75. package/src/tasks/zero-shot-classification/spec/input.json +4 -4
  76. package/src/tasks/zero-shot-image-classification/inference.ts +2 -2
  77. package/src/tasks/zero-shot-image-classification/spec/input.json +3 -3
  78. package/src/tasks/zero-shot-object-detection/inference.ts +1 -1
  79. package/src/tasks/zero-shot-object-detection/spec/input.json +2 -2
@@ -19,7 +19,7 @@
19
19
  "type": "integer",
20
20
  "description": "The predicted token id (to replace the masked one)."
21
21
  },
22
- "tokenStr": {
22
+ "token_str": {
23
23
  "type": "string",
24
24
  "description": "The predicted token (to replace the masked one)."
25
25
  }
@@ -10,7 +10,7 @@ export interface ImageClassificationInput {
10
10
  /**
11
11
  * The input image data
12
12
  */
13
- data: unknown;
13
+ inputs: unknown;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
@@ -23,11 +23,11 @@ export interface ImageClassificationInput {
23
23
  * Additional inference parameters for Image Classification
24
24
  */
25
25
  export interface ImageClassificationParameters {
26
- functionToApply?: ClassificationOutputTransform;
26
+ function_to_apply?: ClassificationOutputTransform;
27
27
  /**
28
28
  * When specified, limits the output to the top K most probable classes.
29
29
  */
30
- topK?: number;
30
+ top_k?: number;
31
31
  [property: string]: unknown;
32
32
  }
33
33
  /**
@@ -5,7 +5,7 @@
5
5
  "title": "ImageClassificationInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "description": "The input image data"
10
10
  },
11
11
  "parameters": {
@@ -19,16 +19,16 @@
19
19
  "description": "Additional inference parameters for Image Classification",
20
20
  "type": "object",
21
21
  "properties": {
22
- "functionToApply": {
22
+ "function_to_apply": {
23
23
  "title": "ImageClassificationOutputTransform",
24
24
  "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
25
25
  },
26
- "topK": {
26
+ "top_k": {
27
27
  "type": "integer",
28
28
  "description": "When specified, limits the output to the top K most probable classes."
29
29
  }
30
30
  }
31
31
  }
32
32
  },
33
- "required": ["data"]
33
+ "required": ["inputs"]
34
34
  }
@@ -10,7 +10,7 @@ export interface ImageSegmentationInput {
10
10
  /**
11
11
  * The input image data
12
12
  */
13
- data: unknown;
13
+ inputs: unknown;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
@@ -26,11 +26,11 @@ export interface ImageSegmentationParameters {
26
26
  /**
27
27
  * Threshold to use when turning the predicted masks into binary values.
28
28
  */
29
- maskThreshold?: number;
29
+ mask_threshold?: number;
30
30
  /**
31
31
  * Mask overlap threshold to eliminate small, disconnected segments.
32
32
  */
33
- overlapMaskAreaThreshold?: number;
33
+ overlap_mask_area_threshold?: number;
34
34
  /**
35
35
  * Segmentation task to be performed, depending on model capabilities.
36
36
  */
@@ -5,7 +5,7 @@
5
5
  "title": "ImageSegmentationInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "description": "The input image data"
10
10
  },
11
11
  "parameters": {
@@ -19,11 +19,11 @@
19
19
  "description": "Additional inference parameters for Image Segmentation",
20
20
  "type": "object",
21
21
  "properties": {
22
- "maskThreshold": {
22
+ "mask_threshold": {
23
23
  "type": "number",
24
24
  "description": "Threshold to use when turning the predicted masks into binary values."
25
25
  },
26
- "overlapMaskAreaThreshold": {
26
+ "overlap_mask_area_threshold": {
27
27
  "type": "number",
28
28
  "description": "Mask overlap threshold to eliminate small, disconnected segments."
29
29
  },
@@ -50,5 +50,5 @@
50
50
  }
51
51
  }
52
52
  },
53
- "required": ["data"]
53
+ "required": ["inputs"]
54
54
  }
@@ -11,7 +11,7 @@ export interface ImageToImageInput {
11
11
  /**
12
12
  * The input image data
13
13
  */
14
- data: unknown;
14
+ inputs: unknown;
15
15
  /**
16
16
  * Additional inference parameters
17
17
  */
@@ -29,20 +29,20 @@ export interface ImageToImageParameters {
29
29
  * For diffusion models. A higher guidance scale value encourages the model to generate
30
30
  * images closely linked to the text prompt at the expense of lower image quality.
31
31
  */
32
- guidanceScale?: number;
32
+ guidance_scale?: number;
33
33
  /**
34
34
  * One or several prompt to guide what NOT to include in image generation.
35
35
  */
36
- negativePrompt?: string[];
36
+ negative_prompt?: string[];
37
37
  /**
38
38
  * For diffusion models. The number of denoising steps. More denoising steps usually lead to
39
39
  * a higher quality image at the expense of slower inference.
40
40
  */
41
- numInferenceSteps?: number;
41
+ num_inference_steps?: number;
42
42
  /**
43
43
  * The size in pixel of the output image
44
44
  */
45
- targetSize?: TargetSize;
45
+ target_size?: TargetSize;
46
46
  [property: string]: unknown;
47
47
  }
48
48
 
@@ -5,7 +5,7 @@
5
5
  "title": "ImageToImageInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "description": "The input image data"
10
10
  },
11
11
  "parameters": {
@@ -19,20 +19,22 @@
19
19
  "description": "Additional inference parameters for Image To Image",
20
20
  "type": "object",
21
21
  "properties": {
22
- "guidanceScale": {
22
+ "guidance_scale": {
23
23
  "type": "number",
24
24
  "description": "For diffusion models. A higher guidance scale value encourages the model to generate images closely linked to the text prompt at the expense of lower image quality."
25
25
  },
26
- "negativePrompt": {
26
+ "negative_prompt": {
27
27
  "type": "array",
28
- "items": { "type": "string" },
28
+ "items": {
29
+ "type": "string"
30
+ },
29
31
  "description": "One or several prompt to guide what NOT to include in image generation."
30
32
  },
31
- "numInferenceSteps": {
33
+ "num_inference_steps": {
32
34
  "type": "integer",
33
35
  "description": "For diffusion models. The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."
34
36
  },
35
- "targetSize": {
37
+ "target_size": {
36
38
  "type": "object",
37
39
  "description": "The size in pixel of the output image",
38
40
  "properties": {
@@ -48,5 +50,5 @@
48
50
  }
49
51
  }
50
52
  },
51
- "required": ["data"]
53
+ "required": ["inputs"]
52
54
  }
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Using src/scripts/inference-codegen
5
5
  */
6
+
6
7
  /**
7
8
  * Inputs for Image To Text inference
8
9
  */
@@ -10,13 +11,14 @@ export interface ImageToTextInput {
10
11
  /**
11
12
  * The input image data
12
13
  */
13
- data: unknown;
14
+ inputs: unknown;
14
15
  /**
15
16
  * Additional inference parameters
16
17
  */
17
18
  parameters?: ImageToTextParameters;
18
19
  [property: string]: unknown;
19
20
  }
21
+
20
22
  /**
21
23
  * Additional inference parameters
22
24
  *
@@ -30,9 +32,10 @@ export interface ImageToTextParameters {
30
32
  /**
31
33
  * The amount of maximum tokens to generate.
32
34
  */
33
- maxNewTokens?: number;
35
+ max_new_tokens?: number;
34
36
  [property: string]: unknown;
35
37
  }
38
+
36
39
  /**
37
40
  * Parametrization of the text generation process
38
41
  *
@@ -42,18 +45,18 @@ export interface GenerationParameters {
42
45
  /**
43
46
  * Whether to use sampling instead of greedy decoding when generating new tokens.
44
47
  */
45
- doSample?: boolean;
48
+ do_sample?: boolean;
46
49
  /**
47
50
  * Controls the stopping condition for beam-based methods.
48
51
  */
49
- earlyStopping?: EarlyStoppingUnion;
52
+ early_stopping?: EarlyStoppingUnion;
50
53
  /**
51
54
  * If set to float strictly between 0 and 1, only tokens with a conditional probability
52
55
  * greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
53
56
  * 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
54
57
  * Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
55
58
  */
56
- epsilonCutoff?: number;
59
+ epsilon_cutoff?: number;
57
60
  /**
58
61
  * Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
59
62
  * float strictly between 0 and 1, a token is only considered if it is greater than either
@@ -63,37 +66,37 @@ export interface GenerationParameters {
63
66
  * See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
64
67
  * for more details.
65
68
  */
66
- etaCutoff?: number;
69
+ eta_cutoff?: number;
67
70
  /**
68
71
  * The maximum length (in tokens) of the generated text, including the input.
69
72
  */
70
- maxLength?: number;
73
+ max_length?: number;
71
74
  /**
72
75
  * The maximum number of tokens to generate. Takes precedence over maxLength.
73
76
  */
74
- maxNewTokens?: number;
77
+ max_new_tokens?: number;
75
78
  /**
76
79
  * The minimum length (in tokens) of the generated text, including the input.
77
80
  */
78
- minLength?: number;
81
+ min_length?: number;
79
82
  /**
80
83
  * The minimum number of tokens to generate. Takes precedence over maxLength.
81
84
  */
82
- minNewTokens?: number;
85
+ min_new_tokens?: number;
83
86
  /**
84
87
  * Number of groups to divide num_beams into in order to ensure diversity among different
85
88
  * groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
86
89
  */
87
- numBeamGroups?: number;
90
+ num_beam_groups?: number;
88
91
  /**
89
92
  * Number of beams to use for beam search.
90
93
  */
91
- numBeams?: number;
94
+ num_beams?: number;
92
95
  /**
93
96
  * The value balances the model confidence and the degeneration penalty in contrastive
94
97
  * search decoding.
95
98
  */
96
- penaltyAlpha?: number;
99
+ penalty_alpha?: number;
97
100
  /**
98
101
  * The value used to modulate the next token probabilities.
99
102
  */
@@ -101,12 +104,12 @@ export interface GenerationParameters {
101
104
  /**
102
105
  * The number of highest probability vocabulary tokens to keep for top-k-filtering.
103
106
  */
104
- topK?: number;
107
+ top_k?: number;
105
108
  /**
106
109
  * If set to float < 1, only the smallest set of most probable tokens with probabilities
107
110
  * that add up to top_p or higher are kept for generation.
108
111
  */
109
- topP?: number;
112
+ top_p?: number;
110
113
  /**
111
114
  * Local typicality measures how similar the conditional probability of predicting a target
112
115
  * token next is to the expected conditional probability of predicting a random token next,
@@ -114,25 +117,27 @@ export interface GenerationParameters {
114
117
  * most locally typical tokens with probabilities that add up to typical_p or higher are
115
118
  * kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
116
119
  */
117
- typicalP?: number;
120
+ typical_p?: number;
118
121
  /**
119
122
  * Whether the model should use the past last key/values attentions to speed up decoding
120
123
  */
121
- useCache?: boolean;
124
+ use_cache?: boolean;
122
125
  [property: string]: unknown;
123
126
  }
127
+
124
128
  /**
125
129
  * Controls the stopping condition for beam-based methods.
126
130
  */
127
131
  export type EarlyStoppingUnion = boolean | "never";
128
- export type ImageToTextOutput = ImageToTextOutputElement[];
132
+
129
133
  /**
130
134
  * Outputs of inference for the Image To Text task
131
135
  */
132
- export interface ImageToTextOutputElement {
136
+ export interface ImageToTextOutput {
137
+ generatedText: unknown;
133
138
  /**
134
139
  * The generated text.
135
140
  */
136
- generatedText: string;
141
+ generated_text?: string;
137
142
  [property: string]: unknown;
138
143
  }
@@ -5,7 +5,7 @@
5
5
  "title": "ImageToTextInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "description": "The input image data"
10
10
  },
11
11
  "parameters": {
@@ -19,7 +19,7 @@
19
19
  "description": "Additional inference parameters for Image To Text",
20
20
  "type": "object",
21
21
  "properties": {
22
- "maxNewTokens": {
22
+ "max_new_tokens": {
23
23
  "type": "integer",
24
24
  "description": "The amount of maximum tokens to generate."
25
25
  },
@@ -30,5 +30,5 @@
30
30
  }
31
31
  }
32
32
  },
33
- "required": ["data"]
33
+ "required": ["inputs"]
34
34
  }
@@ -3,15 +3,12 @@
3
3
  "$schema": "http://json-schema.org/draft-06/schema#",
4
4
  "description": "Outputs of inference for the Image To Text task",
5
5
  "title": "ImageToTextOutput",
6
- "type": "array",
7
- "items": {
8
- "type": "object",
9
- "properties": {
10
- "generatedText": {
11
- "type": "string",
12
- "description": "The generated text."
13
- }
14
- },
15
- "required": ["generatedText"]
16
- }
6
+ "type": "object",
7
+ "properties": {
8
+ "generated_text": {
9
+ "type": "string",
10
+ "description": "The generated text."
11
+ }
12
+ },
13
+ "required": ["generatedText"]
17
14
  }
@@ -53,6 +53,7 @@ export const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]> = {
53
53
  "graph-ml": ["transformers"],
54
54
  "image-classification": ["keras", "timm", "transformers", "transformers.js"],
55
55
  "image-segmentation": ["transformers", "transformers.js"],
56
+ "image-text-to-text": ["transformers"],
56
57
  "image-to-image": ["diffusers", "transformers", "transformers.js"],
57
58
  "image-to-text": ["transformers", "transformers.js"],
58
59
  "image-to-video": ["diffusers"],
@@ -130,6 +131,7 @@ export const TASKS_DATA: Record<PipelineType, TaskData | undefined> = {
130
131
  "graph-ml": undefined,
131
132
  "image-classification": getData("image-classification", imageClassification),
132
133
  "image-segmentation": getData("image-segmentation", imageSegmentation),
134
+ "image-text-to-text": undefined,
133
135
  "image-to-image": getData("image-to-image", imageToImage),
134
136
  "image-to-text": getData("image-to-text", imageToText),
135
137
  "image-to-video": undefined,
@@ -10,7 +10,7 @@ export interface ObjectDetectionInput {
10
10
  /**
11
11
  * The input image data
12
12
  */
13
- data: unknown;
13
+ inputs: unknown;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
@@ -5,7 +5,7 @@
5
5
  "title": "ObjectDetectionInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "description": "The input image data"
10
10
  },
11
11
  "parameters": {
@@ -26,5 +26,5 @@
26
26
  }
27
27
  }
28
28
  },
29
- "required": ["data"]
29
+ "required": ["inputs"]
30
30
  }
@@ -5,7 +5,7 @@
5
5
  "title": "PlaceholderInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "description": "TODO: describe the input here. This must be model & framework agnostic.",
10
10
  "type": "string"
11
11
  },
@@ -20,16 +20,16 @@
20
20
  "description": "TODO: describe additional parameters here.",
21
21
  "type": "object",
22
22
  "properties": {
23
- "dummyParameterName": {
23
+ "dummy_parameter_name": {
24
24
  "type": "boolean",
25
25
  "description": "TODO: describe the parameter here"
26
26
  },
27
- "dummyParameterName2": {
27
+ "dummy_parameter_name2": {
28
28
  "type": "integer",
29
29
  "description": "TODO: describe the parameter here"
30
30
  }
31
31
  }
32
32
  }
33
33
  },
34
- "required": ["data"]
34
+ "required": ["inputs"]
35
35
  }
@@ -7,7 +7,7 @@
7
7
  "items": {
8
8
  "type": "object",
9
9
  "properties": {
10
- "meaningfulOutputName": {
10
+ "meaningful_output_name": {
11
11
  "type": "string",
12
12
  "description": "TODO: Describe what is outputed by the inference here"
13
13
  }
@@ -10,7 +10,7 @@ export interface QuestionAnsweringInput {
10
10
  /**
11
11
  * One (context, question) pair to answer
12
12
  */
13
- data: QuestionAnsweringInputData;
13
+ inputs: QuestionAnsweringInputData;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
@@ -41,37 +41,37 @@ export interface QuestionAnsweringParameters {
41
41
  * Attempts to align the answer to real words. Improves quality on space separated
42
42
  * languages. Might hurt on non-space-separated languages (like Japanese or Chinese)
43
43
  */
44
- alignToWords?: boolean;
44
+ align_to_words?: boolean;
45
45
  /**
46
46
  * If the context is too long to fit with the question for the model, it will be split in
47
47
  * several chunks with some overlap. This argument controls the size of that overlap.
48
48
  */
49
- docStride?: number;
49
+ doc_stride?: number;
50
50
  /**
51
51
  * Whether to accept impossible as an answer.
52
52
  */
53
- handleImpossibleAnswer?: boolean;
53
+ handle_impossible_answer?: boolean;
54
54
  /**
55
55
  * The maximum length of predicted answers (e.g., only answers with a shorter length are
56
56
  * considered).
57
57
  */
58
- maxAnswerLen?: number;
58
+ max_answer_len?: number;
59
59
  /**
60
60
  * The maximum length of the question after tokenization. It will be truncated if needed.
61
61
  */
62
- maxQuestionLen?: number;
62
+ max_question_len?: number;
63
63
  /**
64
64
  * The maximum length of the total sentence (context + question) in tokens of each chunk
65
65
  * passed to the model. The context will be split in several chunks (using docStride as
66
66
  * overlap) if needed.
67
67
  */
68
- maxSeqLen?: number;
68
+ max_seq_len?: number;
69
69
  /**
70
70
  * The number of answers to return (will be chosen by order of likelihood). Note that we
71
71
  * return less than topk answers if there are not enough options available within the
72
72
  * context.
73
73
  */
74
- topK?: number;
74
+ top_k?: number;
75
75
  [property: string]: unknown;
76
76
  }
77
77
  export type QuestionAnsweringOutput = QuestionAnsweringOutputElement[];
@@ -5,7 +5,7 @@
5
5
  "title": "QuestionAnsweringInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "title": "QuestionAnsweringInputData",
10
10
  "description": "One (context, question) pair to answer",
11
11
  "type": "object",
@@ -32,36 +32,36 @@
32
32
  "description": "Additional inference parameters for Question Answering",
33
33
  "type": "object",
34
34
  "properties": {
35
- "topK": {
35
+ "top_k": {
36
36
  "type": "integer",
37
37
  "description": "The number of answers to return (will be chosen by order of likelihood). Note that we return less than topk answers if there are not enough options available within the context."
38
38
  },
39
- "docStride": {
39
+ "doc_stride": {
40
40
  "type": "integer",
41
41
  "description": "If the context is too long to fit with the question for the model, it will be split in several chunks with some overlap. This argument controls the size of that overlap."
42
42
  },
43
- "maxAnswerLen": {
43
+ "max_answer_len": {
44
44
  "type": "integer",
45
45
  "description": "The maximum length of predicted answers (e.g., only answers with a shorter length are considered)."
46
46
  },
47
- "maxSeqLen": {
47
+ "max_seq_len": {
48
48
  "type": "integer",
49
49
  "description": "The maximum length of the total sentence (context + question) in tokens of each chunk passed to the model. The context will be split in several chunks (using docStride as overlap) if needed."
50
50
  },
51
- "maxQuestionLen": {
51
+ "max_question_len": {
52
52
  "type": "integer",
53
53
  "description": "The maximum length of the question after tokenization. It will be truncated if needed."
54
54
  },
55
- "handleImpossibleAnswer": {
55
+ "handle_impossible_answer": {
56
56
  "type": "boolean",
57
57
  "description": "Whether to accept impossible as an answer."
58
58
  },
59
- "alignToWords": {
59
+ "align_to_words": {
60
60
  "type": "boolean",
61
61
  "description": "Attempts to align the answer to real words. Improves quality on space separated languages. Might hurt on non-space-separated languages (like Japanese or Chinese)"
62
62
  }
63
63
  }
64
64
  }
65
65
  },
66
- "required": ["data"]
66
+ "required": ["inputs"]
67
67
  }
@@ -10,7 +10,7 @@ export type SentenceSimilarityOutput = number[];
10
10
  * Inputs for Sentence similarity inference
11
11
  */
12
12
  export interface SentenceSimilarityInput {
13
- data: SentenceSimilarityInputData;
13
+ inputs: SentenceSimilarityInputData;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
@@ -5,7 +5,7 @@
5
5
  "title": "SentenceSimilarityInput",
6
6
  "type": "object",
7
7
  "properties": {
8
- "data": {
8
+ "inputs": {
9
9
  "title": "SentenceSimilarityInputData",
10
10
  "type": "object",
11
11
  "properties": {
@@ -36,5 +36,5 @@
36
36
  "properties": {}
37
37
  }
38
38
  },
39
- "required": ["data"]
39
+ "required": ["inputs"]
40
40
  }
@@ -13,7 +13,7 @@ export interface SummarizationInput {
13
13
  /**
14
14
  * The input text data
15
15
  */
16
- data: string;
16
+ inputs: string;
17
17
  /**
18
18
  * Additional inference parameters
19
19
  */
@@ -30,11 +30,11 @@ export interface Text2TextGenerationParameters {
30
30
  /**
31
31
  * Whether to clean up the potential extra spaces in the text output.
32
32
  */
33
- cleanUpTokenizationSpaces?: boolean;
33
+ clean_up_tokenization_spaces?: boolean;
34
34
  /**
35
35
  * Additional parametrization of the text generation algorithm
36
36
  */
37
- generateParameters?: { [key: string]: unknown };
37
+ generate_parameters?: { [key: string]: unknown };
38
38
  /**
39
39
  * The truncation strategy to use
40
40
  */
@@ -50,9 +50,10 @@ export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest
50
50
  * Outputs of inference for the Text2text Generation task
51
51
  */
52
52
  export interface SummarizationOutput {
53
+ generatedText: unknown;
53
54
  /**
54
55
  * The generated text.
55
56
  */
56
- generatedText: string;
57
+ generated_text?: string;
57
58
  [property: string]: unknown;
58
59
  }
@@ -10,7 +10,7 @@ export interface TableQuestionAnsweringInput {
10
10
  /**
11
11
  * One (table, question) pair to answer
12
12
  */
13
- data: TableQuestionAnsweringInputData;
13
+ inputs: TableQuestionAnsweringInputData;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */