@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
@@ -8,9 +8,10 @@
8
8
  */
9
9
  export interface ObjectDetectionInput {
10
10
  /**
11
- * The input image data
11
+ * The input image data as a base64-encoded string. If no `parameters` are provided, you can
12
+ * also provide the image data as a raw bytes payload.
12
13
  */
13
- inputs: unknown;
14
+ inputs: string;
14
15
  /**
15
16
  * Additional inference parameters
16
17
  */
@@ -34,9 +35,21 @@ export interface ObjectDetectionParameters {
34
35
  * image.
35
36
  */
36
37
  export interface BoundingBox {
38
+ /**
39
+ * The x-coordinate of the bottom-right corner of the bounding box.
40
+ */
37
41
  xmax: number;
42
+ /**
43
+ * The x-coordinate of the top-left corner of the bounding box.
44
+ */
38
45
  xmin: number;
46
+ /**
47
+ * The y-coordinate of the bottom-right corner of the bounding box.
48
+ */
39
49
  ymax: number;
50
+ /**
51
+ * The y-coordinate of the top-left corner of the bounding box.
52
+ */
40
53
  ymin: number;
41
54
  [property: string]: unknown;
42
55
  }
@@ -51,11 +64,11 @@ export interface ObjectDetectionOutputElement {
51
64
  */
52
65
  box: BoundingBox;
53
66
  /**
54
- * The predicted label for the bounding box
67
+ * The predicted label for the bounding box.
55
68
  */
56
69
  label: string;
57
70
  /**
58
- * The associated score / probability
71
+ * The associated score / probability.
59
72
  */
60
73
  score: number;
61
74
  [property: string]: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/object-detection/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC;IACvC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD,MAAM,MAAM,qBAAqB,GAAG,4BAA4B,EAAE,CAAC;AACnE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/object-detection/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC;IACvC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD,MAAM,MAAM,qBAAqB,GAAG,4BAA4B,EAAE,CAAC;AACnE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
@@ -5,43 +5,44 @@
5
5
  */
6
6
  /**
7
7
  * Inputs for Summarization inference
8
- *
9
- * Inputs for Text2text Generation inference
10
8
  */
11
9
  export interface SummarizationInput {
12
10
  /**
13
- * The input text data
11
+ * The input text to summarize.
14
12
  */
15
13
  inputs: string;
16
14
  /**
17
- * Additional inference parameters
15
+ * Additional inference parameters.
18
16
  */
19
- parameters?: Text2TextGenerationParameters;
17
+ parameters?: SummarizationParameters;
20
18
  [property: string]: unknown;
21
19
  }
22
20
  /**
23
- * Additional inference parameters
21
+ * Additional inference parameters.
24
22
  *
25
- * Additional inference parameters for Text2text Generation
23
+ * Additional inference parameters for summarization.
26
24
  */
27
- export interface Text2TextGenerationParameters {
25
+ export interface SummarizationParameters {
28
26
  /**
29
27
  * Whether to clean up the potential extra spaces in the text output.
30
28
  */
31
29
  clean_up_tokenization_spaces?: boolean;
32
30
  /**
33
- * Additional parametrization of the text generation algorithm
31
+ * Additional parametrization of the text generation algorithm.
34
32
  */
35
33
  generate_parameters?: {
36
34
  [key: string]: unknown;
37
35
  };
38
36
  /**
39
- * The truncation strategy to use
37
+ * The truncation strategy to use.
40
38
  */
41
- truncation?: Text2TextGenerationTruncationStrategy;
39
+ truncation?: SummarizationTruncationStrategy;
42
40
  [property: string]: unknown;
43
41
  }
44
- export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
42
+ /**
43
+ * The truncation strategy to use.
44
+ */
45
+ export type SummarizationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
45
46
  /**
46
47
  * Outputs of inference for the Summarization task
47
48
  */
@@ -1 +1 @@
1
- {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/summarization/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,6BAA6B,CAAC;IAC3C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,qCAAqC,CAAC;IACnD,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AAEvH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/summarization/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,+BAA+B,CAAC;IAC7C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AAEjH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
@@ -8,7 +8,7 @@
8
8
  */
9
9
  export interface TextToImageInput {
10
10
  /**
11
- * The input text data (sometimes called "prompt"
11
+ * The input text data (sometimes called "prompt")
12
12
  */
13
13
  inputs: string;
14
14
  /**
@@ -24,8 +24,8 @@ export interface TextToImageInput {
24
24
  */
25
25
  export interface TextToImageParameters {
26
26
  /**
27
- * For diffusion models. A higher guidance scale value encourages the model to generate
28
- * images closely linked to the text prompt at the expense of lower image quality.
27
+ * A higher guidance scale value encourages the model to generate images closely linked to
28
+ * the text prompt, but values too high may cause saturation and other artifacts.
29
29
  */
30
30
  guidance_scale?: number;
31
31
  /**
@@ -33,14 +33,18 @@ export interface TextToImageParameters {
33
33
  */
34
34
  negative_prompt?: string[];
35
35
  /**
36
- * For diffusion models. The number of denoising steps. More denoising steps usually lead to
37
- * a higher quality image at the expense of slower inference.
36
+ * The number of denoising steps. More denoising steps usually lead to a higher quality
37
+ * image at the expense of slower inference.
38
38
  */
39
39
  num_inference_steps?: number;
40
40
  /**
41
- * For diffusion models. Override the scheduler with a compatible one
41
+ * Override the scheduler with a compatible one.
42
42
  */
43
43
  scheduler?: string;
44
+ /**
45
+ * Seed for the random number generator.
46
+ */
47
+ seed?: number;
44
48
  /**
45
49
  * The size in pixel of the output image
46
50
  */
@@ -60,7 +64,7 @@ export interface TargetSize {
60
64
  */
61
65
  export interface TextToImageOutput {
62
66
  /**
63
- * The generated image
67
+ * The generated image returned as raw bytes in the payload.
64
68
  */
65
69
  image: unknown;
66
70
  [property: string]: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-image/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-image/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
@@ -5,43 +5,54 @@
5
5
  */
6
6
  /**
7
7
  * Inputs for Translation inference
8
- *
9
- * Inputs for Text2text Generation inference
10
8
  */
11
9
  export interface TranslationInput {
12
10
  /**
13
- * The input text data
11
+ * The text to translate.
14
12
  */
15
13
  inputs: string;
16
14
  /**
17
15
  * Additional inference parameters
18
16
  */
19
- parameters?: Text2TextGenerationParameters;
17
+ parameters?: TranslationParameters;
20
18
  [property: string]: unknown;
21
19
  }
22
20
  /**
23
21
  * Additional inference parameters
24
22
  *
25
- * Additional inference parameters for Text2text Generation
23
+ * Additional inference parameters for Translation
26
24
  */
27
- export interface Text2TextGenerationParameters {
25
+ export interface TranslationParameters {
28
26
  /**
29
27
  * Whether to clean up the potential extra spaces in the text output.
30
28
  */
31
29
  clean_up_tokenization_spaces?: boolean;
32
30
  /**
33
- * Additional parametrization of the text generation algorithm
31
+ * Additional parametrization of the text generation algorithm.
34
32
  */
35
33
  generate_parameters?: {
36
34
  [key: string]: unknown;
37
35
  };
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
- export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
52
+ /**
53
+ * The truncation strategy to use.
54
+ */
55
+ export type TranslationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
45
56
  /**
46
57
  * Outputs of inference for the Translation task
47
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/translation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,6BAA6B,CAAC;IAC3C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,qCAAqC,CAAC;IACnD,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AAEvH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/translation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACjD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,6BAA6B,CAAC;IAC3C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AAE/G;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@huggingface/tasks",
3
3
  "packageManager": "pnpm@8.10.5",
4
- "version": "0.11.12",
4
+ "version": "0.12.0",
5
5
  "description": "List of ML tasks for huggingface.co/tasks",
6
6
  "repository": "https://github.com/huggingface/huggingface.js.git",
7
7
  "publishConfig": {
@@ -170,6 +170,48 @@ export const diffusers = (model: ModelData): string[] => {
170
170
  }
171
171
  };
172
172
 
173
+ export const diffusionkit = (model: ModelData): string[] => {
174
+ const sd3Snippet = `# Pipeline for Stable Diffusion 3
175
+ from diffusionkit.mlx import DiffusionPipeline
176
+
177
+ pipeline = DiffusionPipeline(
178
+ shift=3.0,
179
+ use_t5=False,
180
+ model_version=${model.id},
181
+ low_memory_mode=True,
182
+ a16=True,
183
+ w16=True,
184
+ )`;
185
+
186
+ const fluxSnippet = `# Pipeline for Flux
187
+ from diffusionkit.mlx import FluxPipeline
188
+
189
+ pipeline = FluxPipeline(
190
+ shift=1.0,
191
+ model_version=${model.id},
192
+ low_memory_mode=True,
193
+ a16=True,
194
+ w16=True,
195
+ )`;
196
+
197
+ const generateSnippet = `# Image Generation
198
+ HEIGHT = 512
199
+ WIDTH = 512
200
+ NUM_STEPS = ${model.tags.includes("flux") ? 4 : 50}
201
+ CFG_WEIGHT = ${model.tags.includes("flux") ? 0 : 5}
202
+
203
+ image, _ = pipeline.generate_image(
204
+ "a photo of a cat",
205
+ cfg_weight=CFG_WEIGHT,
206
+ num_steps=NUM_STEPS,
207
+ latent_size=(HEIGHT // 8, WIDTH // 8),
208
+ )`;
209
+
210
+ const pipelineSnippet = model.tags.includes("flux") ? fluxSnippet : sd3Snippet;
211
+
212
+ return [pipelineSnippet, generateSnippet];
213
+ };
214
+
173
215
  export const cartesia_pytorch = (model: ModelData): string[] => [
174
216
  `# pip install --no-binary :all: cartesia-pytorch
175
217
  from cartesia_pytorch import ReneLMHeadModel
@@ -181,6 +181,12 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
181
181
  filter: true,
182
182
  /// diffusers has its own more complex "countDownloads" query
183
183
  },
184
+ diffusionkit: {
185
+ prettyLabel: "DiffusionKit",
186
+ repoName: "DiffusionKit",
187
+ repoUrl: "https://github.com/argmaxinc/DiffusionKit",
188
+ snippets: snippets.diffusionkit,
189
+ },
184
190
  doctr: {
185
191
  prettyLabel: "docTR",
186
192
  repoName: "doctr",
@@ -440,6 +446,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
440
446
  snippets: snippets.pyannote_audio,
441
447
  filter: true,
442
448
  },
449
+ "py-feat": {
450
+ prettyLabel: "Py-Feat",
451
+ repoName: "Py-Feat",
452
+ repoUrl: "https://github.com/cosanlab/py-feat",
453
+ docsUrl: "https://py-feat.org/",
454
+ filter: false,
455
+ },
443
456
  pythae: {
444
457
  prettyLabel: "pythae",
445
458
  repoName: "pythae",
package/src/pipelines.ts CHANGED
@@ -656,6 +656,24 @@ export const PIPELINE_DATA = {
656
656
  name: "Video-Text-to-Text",
657
657
  modality: "multimodal",
658
658
  color: "blue",
659
+ hideInDatasets: false,
660
+ },
661
+ "keypoint-detection": {
662
+ name: "Keypoint Detection",
663
+ subtasks: [
664
+ {
665
+ type: "pose-estimation",
666
+ name: "Pose Estimation",
667
+ },
668
+ ],
669
+ modality: "cv",
670
+ color: "red",
671
+ hideInDatasets: true,
672
+ },
673
+ "any-to-any": {
674
+ name: "Any-to-Any",
675
+ modality: "multimodal",
676
+ color: "yellow",
659
677
  hideInDatasets: true,
660
678
  },
661
679
  other: {
@@ -8,9 +8,10 @@
8
8
  */
9
9
  export interface AudioClassificationInput {
10
10
  /**
11
- * The input audio data
11
+ * The input audio data as a base64-encoded string. If no `parameters` are provided, you can
12
+ * also provide the audio data as a raw bytes payload.
12
13
  */
13
- inputs: unknown;
14
+ inputs: string;
14
15
  /**
15
16
  * Additional inference parameters
16
17
  */
@@ -6,7 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input audio data"
9
+ "description": "The input audio data as a base64-encoded string. If no `parameters` are provided, you can also provide the audio data as a raw bytes payload.",
10
+ "type": "string"
10
11
  },
11
12
  "parameters": {
12
13
  "description": "Additional inference parameters",
@@ -5,6 +5,7 @@
5
5
  "description": "Outputs for Audio Classification inference",
6
6
  "type": "array",
7
7
  "items": {
8
+ "type": "object",
8
9
  "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutput"
9
10
  }
10
11
  }
@@ -9,9 +9,10 @@
9
9
  */
10
10
  export interface AutomaticSpeechRecognitionInput {
11
11
  /**
12
- * The input audio data
12
+ * The input audio data as a base64-encoded string. If no `parameters` are provided, you can
13
+ * also provide the audio data as a raw bytes payload.
13
14
  */
14
- inputs: unknown;
15
+ inputs: string;
15
16
  /**
16
17
  * Additional inference parameters
17
18
  */
@@ -6,7 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input audio data"
9
+ "description": "The input audio data as a base64-encoded string. If no `parameters` are provided, you can also provide the audio data as a raw bytes payload.",
10
+ "type": "string"
10
11
  },
11
12
  "parameters": {
12
13
  "description": "Additional inference parameters",
@@ -7,17 +7,7 @@
7
7
  "title": "ClassificationOutputTransform",
8
8
  "type": "string",
9
9
  "description": "The function to apply to the model outputs in order to retrieve the scores.",
10
- "oneOf": [
11
- {
12
- "const": "sigmoid"
13
- },
14
- {
15
- "const": "softmax"
16
- },
17
- {
18
- "const": "none"
19
- }
20
- ]
10
+ "enum": ["sigmoid", "softmax", "none"]
21
11
  },
22
12
  "ClassificationOutput": {
23
13
  "title": "ClassificationOutput",
@@ -84,16 +74,9 @@
84
74
  "description": "Whether to use sampling instead of greedy decoding when generating new tokens."
85
75
  },
86
76
  "early_stopping": {
77
+ "type": ["boolean", "string"],
87
78
  "description": "Controls the stopping condition for beam-based methods.",
88
- "oneOf": [
89
- {
90
- "type": "boolean"
91
- },
92
- {
93
- "const": "never",
94
- "type": "string"
95
- }
96
- ]
79
+ "enum": ["never", true, false]
97
80
  },
98
81
  "num_beams": {
99
82
  "type": "integer",
@@ -8,9 +8,10 @@
8
8
  */
9
9
  export interface ImageClassificationInput {
10
10
  /**
11
- * The input image data
11
+ * The input image data as a base64-encoded string. If no `parameters` are provided, you can
12
+ * also provide the image data as a raw bytes payload.
12
13
  */
13
- inputs: unknown;
14
+ inputs: string;
14
15
  /**
15
16
  * Additional inference parameters
16
17
  */
@@ -6,7 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input image data"
9
+ "type": "string",
10
+ "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."
10
11
  },
11
12
  "parameters": {
12
13
  "description": "Additional inference parameters",
@@ -5,6 +5,7 @@
5
5
  "title": "ImageClassificationOutput",
6
6
  "type": "array",
7
7
  "items": {
8
+ "type": "object",
8
9
  "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutput"
9
10
  }
10
11
  }
@@ -8,9 +8,10 @@
8
8
  */
9
9
  export interface ImageSegmentationInput {
10
10
  /**
11
- * The input image data
11
+ * The input image data as a base64-encoded string. If no `parameters` are provided, you can
12
+ * also provide the image data as a raw bytes payload.
12
13
  */
13
- inputs: unknown;
14
+ inputs: string;
14
15
  /**
15
16
  * Additional inference parameters
16
17
  */
@@ -41,6 +42,9 @@ export interface ImageSegmentationParameters {
41
42
  threshold?: number;
42
43
  [property: string]: unknown;
43
44
  }
45
+ /**
46
+ * Segmentation task to be performed, depending on model capabilities.
47
+ */
44
48
  export type ImageSegmentationSubtask = "instance" | "panoptic" | "semantic";
45
49
  export type ImageSegmentationOutput = ImageSegmentationOutputElement[];
46
50
  /**
@@ -50,15 +54,15 @@ export type ImageSegmentationOutput = ImageSegmentationOutputElement[];
50
54
  */
51
55
  export interface ImageSegmentationOutputElement {
52
56
  /**
53
- * The label of the predicted segment
57
+ * The label of the predicted segment.
54
58
  */
55
59
  label: string;
56
60
  /**
57
- * The corresponding mask as a black-and-white image
61
+ * The corresponding mask as a black-and-white image (base64-encoded).
58
62
  */
59
- mask: unknown;
63
+ mask: string;
60
64
  /**
61
- * The score or confidence degreee the model has
65
+ * The score or confidence degree the model has.
62
66
  */
63
67
  score?: number;
64
68
  [property: string]: unknown;
@@ -6,7 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input image data"
9
+ "type": "string",
10
+ "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."
10
11
  },
11
12
  "parameters": {
12
13
  "description": "Additional inference parameters",
@@ -31,17 +32,7 @@
31
32
  "title": "ImageSegmentationSubtask",
32
33
  "type": "string",
33
34
  "description": "Segmentation task to be performed, depending on model capabilities.",
34
- "oneOf": [
35
- {
36
- "const": "instance"
37
- },
38
- {
39
- "const": "panoptic"
40
- },
41
- {
42
- "const": "semantic"
43
- }
44
- ]
35
+ "enum": ["instance", "panoptic", "semantic"]
45
36
  },
46
37
  "threshold": {
47
38
  "type": "number",
@@ -10,14 +10,15 @@
10
10
  "properties": {
11
11
  "label": {
12
12
  "type": "string",
13
- "description": "The label of the predicted segment"
13
+ "description": "The label of the predicted segment."
14
14
  },
15
15
  "mask": {
16
- "description": "The corresponding mask as a black-and-white image"
16
+ "type": "string",
17
+ "description": "The corresponding mask as a black-and-white image (base64-encoded)."
17
18
  },
18
19
  "score": {
19
20
  "type": "number",
20
- "description": "The score or confidence degreee the model has"
21
+ "description": "The score or confidence degree the model has."
21
22
  }
22
23
  },
23
24
  "required": ["label", "mask"]