@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.
- package/README.md +1 -1
- package/dist/index.cjs +3144 -3085
- package/dist/index.d.ts +441 -74
- package/dist/index.js +3143 -3084
- package/package.json +1 -1
- package/src/index.ts +2 -5
- package/src/library-to-tasks.ts +1 -1
- package/src/model-libraries-downloads.ts +20 -0
- package/src/{library-ui-elements.ts → model-libraries-snippets.ts} +46 -292
- package/src/model-libraries.ts +375 -44
- package/src/pipelines.ts +14 -8
- package/src/tasks/audio-classification/inference.ts +4 -4
- package/src/tasks/audio-classification/spec/input.json +4 -4
- package/src/tasks/audio-classification/spec/output.json +1 -12
- package/src/tasks/automatic-speech-recognition/inference.ts +35 -30
- package/src/tasks/automatic-speech-recognition/spec/input.json +3 -3
- package/src/tasks/automatic-speech-recognition/spec/output.json +30 -28
- package/src/tasks/common-definitions.json +25 -17
- package/src/tasks/depth-estimation/inference.ts +10 -10
- package/src/tasks/depth-estimation/spec/input.json +3 -8
- package/src/tasks/depth-estimation/spec/output.json +9 -3
- package/src/tasks/document-question-answering/inference.ts +16 -8
- package/src/tasks/document-question-answering/spec/input.json +9 -9
- package/src/tasks/document-question-answering/spec/output.json +2 -2
- package/src/tasks/feature-extraction/inference.ts +1 -1
- package/src/tasks/feature-extraction/spec/input.json +2 -2
- package/src/tasks/fill-mask/inference.ts +4 -3
- package/src/tasks/fill-mask/spec/input.json +3 -3
- package/src/tasks/fill-mask/spec/output.json +1 -1
- package/src/tasks/image-classification/inference.ts +3 -3
- package/src/tasks/image-classification/spec/input.json +4 -4
- package/src/tasks/image-segmentation/inference.ts +3 -3
- package/src/tasks/image-segmentation/spec/input.json +4 -4
- package/src/tasks/image-to-image/inference.ts +5 -5
- package/src/tasks/image-to-image/spec/input.json +9 -7
- package/src/tasks/image-to-text/inference.ts +25 -20
- package/src/tasks/image-to-text/spec/input.json +3 -3
- package/src/tasks/image-to-text/spec/output.json +8 -11
- package/src/tasks/index.ts +2 -0
- package/src/tasks/object-detection/inference.ts +1 -1
- package/src/tasks/object-detection/spec/input.json +2 -2
- package/src/tasks/placeholder/spec/input.json +4 -4
- package/src/tasks/placeholder/spec/output.json +1 -1
- package/src/tasks/question-answering/inference.ts +8 -8
- package/src/tasks/question-answering/spec/input.json +9 -9
- package/src/tasks/sentence-similarity/inference.ts +1 -1
- package/src/tasks/sentence-similarity/spec/input.json +2 -2
- package/src/tasks/summarization/inference.ts +5 -4
- package/src/tasks/table-question-answering/inference.ts +1 -1
- package/src/tasks/table-question-answering/spec/input.json +8 -3
- package/src/tasks/text-classification/inference.ts +3 -3
- package/src/tasks/text-classification/spec/input.json +4 -4
- package/src/tasks/text-generation/inference.ts +123 -14
- package/src/tasks/text-generation/spec/input.json +28 -12
- package/src/tasks/text-generation/spec/output.json +112 -9
- package/src/tasks/text-to-audio/inference.ts +24 -19
- package/src/tasks/text-to-audio/spec/input.json +2 -2
- package/src/tasks/text-to-audio/spec/output.json +10 -13
- package/src/tasks/text-to-image/inference.ts +6 -8
- package/src/tasks/text-to-image/spec/input.json +9 -7
- package/src/tasks/text-to-image/spec/output.json +7 -9
- package/src/tasks/text-to-speech/inference.ts +18 -17
- package/src/tasks/text2text-generation/inference.ts +10 -8
- package/src/tasks/text2text-generation/spec/input.json +4 -4
- package/src/tasks/text2text-generation/spec/output.json +8 -11
- package/src/tasks/token-classification/inference.ts +4 -4
- package/src/tasks/token-classification/spec/input.json +4 -4
- package/src/tasks/token-classification/spec/output.json +1 -1
- package/src/tasks/translation/inference.ts +5 -4
- package/src/tasks/video-classification/inference.ts +5 -5
- package/src/tasks/video-classification/spec/input.json +6 -6
- package/src/tasks/visual-question-answering/inference.ts +2 -2
- package/src/tasks/visual-question-answering/spec/input.json +3 -3
- package/src/tasks/zero-shot-classification/inference.ts +3 -3
- package/src/tasks/zero-shot-classification/spec/input.json +4 -4
- package/src/tasks/zero-shot-image-classification/inference.ts +2 -2
- package/src/tasks/zero-shot-image-classification/spec/input.json +3 -3
- package/src/tasks/zero-shot-object-detection/inference.ts +1 -1
- package/src/tasks/zero-shot-object-detection/spec/input.json +2 -2
|
@@ -10,7 +10,7 @@ export interface ImageClassificationInput {
|
|
|
10
10
|
/**
|
|
11
11
|
* The input image data
|
|
12
12
|
*/
|
|
13
|
-
|
|
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
|
-
|
|
26
|
+
function_to_apply?: ClassificationOutputTransform;
|
|
27
27
|
/**
|
|
28
28
|
* When specified, limits the output to the top K most probable classes.
|
|
29
29
|
*/
|
|
30
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
22
|
+
"function_to_apply": {
|
|
23
23
|
"title": "ImageClassificationOutputTransform",
|
|
24
24
|
"$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
|
|
25
25
|
},
|
|
26
|
-
"
|
|
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": ["
|
|
33
|
+
"required": ["inputs"]
|
|
34
34
|
}
|
|
@@ -10,7 +10,7 @@ export interface ImageSegmentationInput {
|
|
|
10
10
|
/**
|
|
11
11
|
* The input image data
|
|
12
12
|
*/
|
|
13
|
-
|
|
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
|
-
|
|
29
|
+
mask_threshold?: number;
|
|
30
30
|
/**
|
|
31
31
|
* Mask overlap threshold to eliminate small, disconnected segments.
|
|
32
32
|
*/
|
|
33
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
22
|
+
"mask_threshold": {
|
|
23
23
|
"type": "number",
|
|
24
24
|
"description": "Threshold to use when turning the predicted masks into binary values."
|
|
25
25
|
},
|
|
26
|
-
"
|
|
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": ["
|
|
53
|
+
"required": ["inputs"]
|
|
54
54
|
}
|
|
@@ -11,7 +11,7 @@ export interface ImageToImageInput {
|
|
|
11
11
|
/**
|
|
12
12
|
* The input image data
|
|
13
13
|
*/
|
|
14
|
-
|
|
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
|
-
|
|
32
|
+
guidance_scale?: number;
|
|
33
33
|
/**
|
|
34
34
|
* One or several prompt to guide what NOT to include in image generation.
|
|
35
35
|
*/
|
|
36
|
-
|
|
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
|
-
|
|
41
|
+
num_inference_steps?: number;
|
|
42
42
|
/**
|
|
43
43
|
* The size in pixel of the output image
|
|
44
44
|
*/
|
|
45
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
26
|
+
"negative_prompt": {
|
|
27
27
|
"type": "array",
|
|
28
|
-
"items": {
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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": ["
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
48
|
+
do_sample?: boolean;
|
|
46
49
|
/**
|
|
47
50
|
* Controls the stopping condition for beam-based methods.
|
|
48
51
|
*/
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
|
|
69
|
+
eta_cutoff?: number;
|
|
67
70
|
/**
|
|
68
71
|
* The maximum length (in tokens) of the generated text, including the input.
|
|
69
72
|
*/
|
|
70
|
-
|
|
73
|
+
max_length?: number;
|
|
71
74
|
/**
|
|
72
75
|
* The maximum number of tokens to generate. Takes precedence over maxLength.
|
|
73
76
|
*/
|
|
74
|
-
|
|
77
|
+
max_new_tokens?: number;
|
|
75
78
|
/**
|
|
76
79
|
* The minimum length (in tokens) of the generated text, including the input.
|
|
77
80
|
*/
|
|
78
|
-
|
|
81
|
+
min_length?: number;
|
|
79
82
|
/**
|
|
80
83
|
* The minimum number of tokens to generate. Takes precedence over maxLength.
|
|
81
84
|
*/
|
|
82
|
-
|
|
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
|
-
|
|
90
|
+
num_beam_groups?: number;
|
|
88
91
|
/**
|
|
89
92
|
* Number of beams to use for beam search.
|
|
90
93
|
*/
|
|
91
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
132
|
+
|
|
129
133
|
/**
|
|
130
134
|
* Outputs of inference for the Image To Text task
|
|
131
135
|
*/
|
|
132
|
-
export interface
|
|
136
|
+
export interface ImageToTextOutput {
|
|
137
|
+
generatedText: unknown;
|
|
133
138
|
/**
|
|
134
139
|
* The generated text.
|
|
135
140
|
*/
|
|
136
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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": ["
|
|
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": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
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
|
}
|
package/src/tasks/index.ts
CHANGED
|
@@ -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,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"title": "ObjectDetectionInput",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"
|
|
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": ["
|
|
29
|
+
"required": ["inputs"]
|
|
30
30
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"title": "PlaceholderInput",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"
|
|
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
|
-
"
|
|
23
|
+
"dummy_parameter_name": {
|
|
24
24
|
"type": "boolean",
|
|
25
25
|
"description": "TODO: describe the parameter here"
|
|
26
26
|
},
|
|
27
|
-
"
|
|
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": ["
|
|
34
|
+
"required": ["inputs"]
|
|
35
35
|
}
|
|
@@ -10,7 +10,7 @@ export interface QuestionAnsweringInput {
|
|
|
10
10
|
/**
|
|
11
11
|
* One (context, question) pair to answer
|
|
12
12
|
*/
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
+
doc_stride?: number;
|
|
50
50
|
/**
|
|
51
51
|
* Whether to accept impossible as an answer.
|
|
52
52
|
*/
|
|
53
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
55
|
+
"handle_impossible_answer": {
|
|
56
56
|
"type": "boolean",
|
|
57
57
|
"description": "Whether to accept impossible as an answer."
|
|
58
58
|
},
|
|
59
|
-
"
|
|
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": ["
|
|
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
|
-
|
|
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
|
-
"
|
|
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": ["
|
|
39
|
+
"required": ["inputs"]
|
|
40
40
|
}
|
|
@@ -13,7 +13,7 @@ export interface SummarizationInput {
|
|
|
13
13
|
/**
|
|
14
14
|
* The input text data
|
|
15
15
|
*/
|
|
16
|
-
|
|
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
|
-
|
|
33
|
+
clean_up_tokenization_spaces?: boolean;
|
|
34
34
|
/**
|
|
35
35
|
* Additional parametrization of the text generation algorithm
|
|
36
36
|
*/
|
|
37
|
-
|
|
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
|
-
|
|
57
|
+
generated_text?: string;
|
|
57
58
|
[property: string]: unknown;
|
|
58
59
|
}
|