@huggingface/tasks 0.11.12 → 0.12.0

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 (66) hide show
  1. package/dist/index.cjs +74 -2
  2. package/dist/index.js +74 -2
  3. package/dist/src/model-libraries-snippets.d.ts +1 -0
  4. package/dist/src/model-libraries-snippets.d.ts.map +1 -1
  5. package/dist/src/model-libraries.d.ts +15 -2
  6. package/dist/src/model-libraries.d.ts.map +1 -1
  7. package/dist/src/pipelines.d.ts +18 -2
  8. package/dist/src/pipelines.d.ts.map +1 -1
  9. package/dist/src/tasks/audio-classification/inference.d.ts +3 -2
  10. package/dist/src/tasks/audio-classification/inference.d.ts.map +1 -1
  11. package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +3 -2
  12. package/dist/src/tasks/automatic-speech-recognition/inference.d.ts.map +1 -1
  13. package/dist/src/tasks/image-classification/inference.d.ts +3 -2
  14. package/dist/src/tasks/image-classification/inference.d.ts.map +1 -1
  15. package/dist/src/tasks/image-segmentation/inference.d.ts +10 -6
  16. package/dist/src/tasks/image-segmentation/inference.d.ts.map +1 -1
  17. package/dist/src/tasks/image-to-image/inference.d.ts +6 -5
  18. package/dist/src/tasks/image-to-image/inference.d.ts.map +1 -1
  19. package/dist/src/tasks/index.d.ts +1 -1
  20. package/dist/src/tasks/index.d.ts.map +1 -1
  21. package/dist/src/tasks/keypoint-detection/data.d.ts +4 -0
  22. package/dist/src/tasks/keypoint-detection/data.d.ts.map +1 -0
  23. package/dist/src/tasks/object-detection/inference.d.ts +17 -4
  24. package/dist/src/tasks/object-detection/inference.d.ts.map +1 -1
  25. package/dist/src/tasks/summarization/inference.d.ts +13 -12
  26. package/dist/src/tasks/summarization/inference.d.ts.map +1 -1
  27. package/dist/src/tasks/text-to-image/inference.d.ts +11 -7
  28. package/dist/src/tasks/text-to-image/inference.d.ts.map +1 -1
  29. package/dist/src/tasks/translation/inference.d.ts +21 -10
  30. package/dist/src/tasks/translation/inference.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/model-libraries-snippets.ts +42 -0
  33. package/src/model-libraries.ts +13 -0
  34. package/src/pipelines.ts +18 -0
  35. package/src/tasks/audio-classification/inference.ts +3 -2
  36. package/src/tasks/audio-classification/spec/input.json +2 -1
  37. package/src/tasks/audio-classification/spec/output.json +1 -0
  38. package/src/tasks/automatic-speech-recognition/inference.ts +3 -2
  39. package/src/tasks/automatic-speech-recognition/spec/input.json +2 -1
  40. package/src/tasks/common-definitions.json +3 -20
  41. package/src/tasks/image-classification/inference.ts +3 -2
  42. package/src/tasks/image-classification/spec/input.json +2 -1
  43. package/src/tasks/image-classification/spec/output.json +1 -0
  44. package/src/tasks/image-segmentation/inference.ts +10 -6
  45. package/src/tasks/image-segmentation/spec/input.json +3 -12
  46. package/src/tasks/image-segmentation/spec/output.json +4 -3
  47. package/src/tasks/image-to-image/about.md +70 -21
  48. package/src/tasks/image-to-image/data.ts +1 -1
  49. package/src/tasks/image-to-image/inference.ts +6 -5
  50. package/src/tasks/image-to-image/spec/input.json +3 -2
  51. package/src/tasks/image-to-image/spec/output.json +1 -1
  52. package/src/tasks/index.ts +5 -6
  53. package/src/tasks/keypoint-detection/about.md +59 -0
  54. package/src/tasks/keypoint-detection/data.ts +46 -0
  55. package/src/tasks/object-detection/inference.ts +17 -4
  56. package/src/tasks/object-detection/spec/input.json +2 -1
  57. package/src/tasks/object-detection/spec/output.json +10 -6
  58. package/src/tasks/summarization/inference.ts +13 -12
  59. package/src/tasks/summarization/spec/input.json +37 -2
  60. package/src/tasks/text-classification/spec/output.json +1 -0
  61. package/src/tasks/text-to-image/inference.ts +11 -7
  62. package/src/tasks/text-to-image/spec/input.json +8 -4
  63. package/src/tasks/text-to-image/spec/output.json +1 -1
  64. package/src/tasks/translation/inference.ts +21 -10
  65. package/src/tasks/translation/spec/input.json +45 -2
  66. package/src/tasks/zero-shot-classification/spec/output.json +1 -0
@@ -6,7 +6,7 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "image": {
9
- "description": "The generated image"
9
+ "description": "The generated image returned as raw bytes in the payload."
10
10
  }
11
11
  },
12
12
  "required": ["image"]
@@ -6,43 +6,54 @@
6
6
 
7
7
  /**
8
8
  * Inputs for Translation inference
9
- *
10
- * Inputs for Text2text Generation inference
11
9
  */
12
10
  export interface TranslationInput {
13
11
  /**
14
- * The input text data
12
+ * The text to translate.
15
13
  */
16
14
  inputs: string;
17
15
  /**
18
16
  * Additional inference parameters
19
17
  */
20
- parameters?: Text2TextGenerationParameters;
18
+ parameters?: TranslationParameters;
21
19
  [property: string]: unknown;
22
20
  }
23
21
 
24
22
  /**
25
23
  * Additional inference parameters
26
24
  *
27
- * Additional inference parameters for Text2text Generation
25
+ * Additional inference parameters for Translation
28
26
  */
29
- export interface Text2TextGenerationParameters {
27
+ export interface TranslationParameters {
30
28
  /**
31
29
  * Whether to clean up the potential extra spaces in the text output.
32
30
  */
33
31
  clean_up_tokenization_spaces?: boolean;
34
32
  /**
35
- * Additional parametrization of the text generation algorithm
33
+ * Additional parametrization of the text generation algorithm.
36
34
  */
37
35
  generate_parameters?: { [key: string]: unknown };
38
36
  /**
39
- * The truncation strategy to use
37
+ * The source language of the text. Required for models that can translate from multiple
38
+ * languages.
39
+ */
40
+ src_lang?: string;
41
+ /**
42
+ * Target language to translate to. Required for models that can translate to multiple
43
+ * languages.
40
44
  */
41
- truncation?: Text2TextGenerationTruncationStrategy;
45
+ tgt_lang?: string;
46
+ /**
47
+ * The truncation strategy to use.
48
+ */
49
+ truncation?: TranslationTruncationStrategy;
42
50
  [property: string]: unknown;
43
51
  }
44
52
 
45
- export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
53
+ /**
54
+ * The truncation strategy to use.
55
+ */
56
+ export type TranslationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
46
57
 
47
58
  /**
48
59
  * Outputs of inference for the Translation task
@@ -1,7 +1,50 @@
1
1
  {
2
- "$ref": "/inference/schemas/text2text-generation/input.json",
3
2
  "$id": "/inference/schemas/translation/input.json",
4
3
  "$schema": "http://json-schema.org/draft-06/schema#",
4
+ "description": "Inputs for Translation inference",
5
5
  "title": "TranslationInput",
6
- "description": "Inputs for Translation inference"
6
+ "type": "object",
7
+ "properties": {
8
+ "inputs": {
9
+ "description": "The text to translate.",
10
+ "type": "string"
11
+ },
12
+ "parameters": {
13
+ "description": "Additional inference parameters",
14
+ "$ref": "#/$defs/TranslationParameters"
15
+ }
16
+ },
17
+ "$defs": {
18
+ "TranslationParameters": {
19
+ "title": "TranslationParameters",
20
+ "description": "Additional inference parameters for Translation",
21
+ "type": "object",
22
+ "properties": {
23
+ "src_lang": {
24
+ "type": "string",
25
+ "description": "The source language of the text. Required for models that can translate from multiple languages."
26
+ },
27
+ "tgt_lang": {
28
+ "type": "string",
29
+ "description": "Target language to translate to. Required for models that can translate to multiple languages."
30
+ },
31
+ "clean_up_tokenization_spaces": {
32
+ "type": "boolean",
33
+ "description": "Whether to clean up the potential extra spaces in the text output."
34
+ },
35
+ "truncation": {
36
+ "title": "TranslationTruncationStrategy",
37
+ "type": "string",
38
+ "description": "The truncation strategy to use.",
39
+ "enum": ["do_not_truncate", "longest_first", "only_first", "only_second"]
40
+ },
41
+ "generate_parameters": {
42
+ "title": "generateParameters",
43
+ "type": "object",
44
+ "description": "Additional parametrization of the text generation algorithm."
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "required": ["inputs"]
7
50
  }
@@ -5,6 +5,7 @@
5
5
  "title": "ZeroShotClassificationOutput",
6
6
  "type": "array",
7
7
  "items": {
8
+ "type": "object",
8
9
  "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutput"
9
10
  }
10
11
  }