@huggingface/tasks 0.0.2 → 0.0.4

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -0
  3. package/dist/index.d.ts +358 -46
  4. package/dist/index.js +103 -41
  5. package/dist/{index.cjs → index.mjs} +73 -67
  6. package/package.json +42 -33
  7. package/src/Types.ts +49 -43
  8. package/src/audio-classification/about.md +5 -5
  9. package/src/audio-classification/data.ts +11 -11
  10. package/src/audio-to-audio/about.md +4 -3
  11. package/src/audio-to-audio/data.ts +18 -15
  12. package/src/automatic-speech-recognition/about.md +5 -4
  13. package/src/automatic-speech-recognition/data.ts +18 -17
  14. package/src/const.ts +52 -44
  15. package/src/conversational/about.md +9 -9
  16. package/src/conversational/data.ts +22 -18
  17. package/src/depth-estimation/about.md +1 -3
  18. package/src/depth-estimation/data.ts +11 -11
  19. package/src/document-question-answering/about.md +1 -2
  20. package/src/document-question-answering/data.ts +22 -19
  21. package/src/feature-extraction/about.md +2 -3
  22. package/src/feature-extraction/data.ts +12 -15
  23. package/src/fill-mask/about.md +1 -1
  24. package/src/fill-mask/data.ts +16 -14
  25. package/src/image-classification/about.md +5 -3
  26. package/src/image-classification/data.ts +15 -15
  27. package/src/image-segmentation/about.md +4 -4
  28. package/src/image-segmentation/data.ts +26 -23
  29. package/src/image-to-image/about.md +8 -10
  30. package/src/image-to-image/data.ts +31 -27
  31. package/src/image-to-text/about.md +13 -6
  32. package/src/image-to-text/data.ts +20 -21
  33. package/src/index.ts +3 -1
  34. package/src/modelLibraries.ts +43 -0
  35. package/src/object-detection/about.md +2 -1
  36. package/src/object-detection/data.ts +20 -17
  37. package/src/pipelines.ts +608 -0
  38. package/src/placeholder/about.md +3 -3
  39. package/src/placeholder/data.ts +8 -8
  40. package/src/question-answering/about.md +1 -1
  41. package/src/question-answering/data.ts +21 -19
  42. package/src/reinforcement-learning/about.md +167 -176
  43. package/src/reinforcement-learning/data.ts +75 -78
  44. package/src/sentence-similarity/data.ts +29 -28
  45. package/src/summarization/about.md +6 -5
  46. package/src/summarization/data.ts +23 -20
  47. package/src/table-question-answering/about.md +5 -5
  48. package/src/table-question-answering/data.ts +35 -39
  49. package/src/tabular-classification/about.md +4 -6
  50. package/src/tabular-classification/data.ts +11 -12
  51. package/src/tabular-regression/about.md +14 -18
  52. package/src/tabular-regression/data.ts +10 -11
  53. package/src/tasksData.ts +47 -50
  54. package/src/text-classification/about.md +5 -4
  55. package/src/text-classification/data.ts +21 -20
  56. package/src/text-generation/about.md +7 -6
  57. package/src/text-generation/data.ts +36 -34
  58. package/src/text-to-image/about.md +19 -18
  59. package/src/text-to-image/data.ts +32 -26
  60. package/src/text-to-speech/about.md +4 -5
  61. package/src/text-to-speech/data.ts +16 -17
  62. package/src/text-to-video/about.md +41 -36
  63. package/src/text-to-video/data.ts +43 -38
  64. package/src/token-classification/about.md +1 -3
  65. package/src/token-classification/data.ts +26 -25
  66. package/src/translation/about.md +4 -4
  67. package/src/translation/data.ts +21 -21
  68. package/src/unconditional-image-generation/about.md +10 -5
  69. package/src/unconditional-image-generation/data.ts +26 -20
  70. package/src/video-classification/about.md +5 -1
  71. package/src/video-classification/data.ts +14 -14
  72. package/src/visual-question-answering/about.md +8 -3
  73. package/src/visual-question-answering/data.ts +22 -19
  74. package/src/zero-shot-classification/about.md +5 -4
  75. package/src/zero-shot-classification/data.ts +20 -20
  76. package/src/zero-shot-image-classification/about.md +17 -9
  77. package/src/zero-shot-image-classification/data.ts +12 -14
  78. package/tsconfig.json +18 -0
  79. package/assets/audio-classification/audio.wav +0 -0
  80. package/assets/audio-to-audio/input.wav +0 -0
  81. package/assets/audio-to-audio/label-0.wav +0 -0
  82. package/assets/audio-to-audio/label-1.wav +0 -0
  83. package/assets/automatic-speech-recognition/input.flac +0 -0
  84. package/assets/automatic-speech-recognition/wav2vec2.png +0 -0
  85. package/assets/contribution-guide/anatomy.png +0 -0
  86. package/assets/contribution-guide/libraries.png +0 -0
  87. package/assets/depth-estimation/depth-estimation-input.jpg +0 -0
  88. package/assets/depth-estimation/depth-estimation-output.png +0 -0
  89. package/assets/document-question-answering/document-question-answering-input.png +0 -0
  90. package/assets/image-classification/image-classification-input.jpeg +0 -0
  91. package/assets/image-segmentation/image-segmentation-input.jpeg +0 -0
  92. package/assets/image-segmentation/image-segmentation-output.png +0 -0
  93. package/assets/image-to-image/image-to-image-input.jpeg +0 -0
  94. package/assets/image-to-image/image-to-image-output.png +0 -0
  95. package/assets/image-to-image/pix2pix_examples.jpg +0 -0
  96. package/assets/image-to-text/savanna.jpg +0 -0
  97. package/assets/object-detection/object-detection-input.jpg +0 -0
  98. package/assets/object-detection/object-detection-output.jpg +0 -0
  99. package/assets/table-question-answering/tableQA.jpg +0 -0
  100. package/assets/text-to-image/image.jpeg +0 -0
  101. package/assets/text-to-speech/audio.wav +0 -0
  102. package/assets/text-to-video/text-to-video-output.gif +0 -0
  103. package/assets/unconditional-image-generation/unconditional-image-generation-output.jpeg +0 -0
  104. package/assets/video-classification/video-classification-input.gif +0 -0
  105. package/assets/visual-question-answering/elephant.jpeg +0 -0
  106. package/assets/zero-shot-image-classification/image-classification-input.jpeg +0 -0
  107. package/dist/index.d.cts +0 -145
package/dist/index.js CHANGED
@@ -1,8 +1,35 @@
1
- // ../js/src/lib/interfaces/Types.ts
2
- function ensureRecordOfPipelines(record) {
3
- return record;
4
- }
5
- var PIPELINE_DATA = ensureRecordOfPipelines({
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ MODALITIES: () => MODALITIES,
24
+ ModelLibrary: () => ModelLibrary,
25
+ PIPELINE_DATA: () => PIPELINE_DATA,
26
+ TASKS_DATA: () => TASKS_DATA
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+
30
+ // src/pipelines.ts
31
+ var MODALITIES = ["cv", "nlp", "audio", "tabular", "multimodal", "rl", "other"];
32
+ var PIPELINE_DATA = {
6
33
  "text-classification": {
7
34
  name: "Text Classification",
8
35
  subtasks: [
@@ -138,12 +165,12 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
138
165
  modality: "nlp",
139
166
  color: "yellow"
140
167
  },
141
- "translation": {
168
+ translation: {
142
169
  name: "Translation",
143
170
  modality: "nlp",
144
171
  color: "green"
145
172
  },
146
- "summarization": {
173
+ summarization: {
147
174
  name: "Summarization",
148
175
  subtasks: [
149
176
  {
@@ -158,7 +185,7 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
158
185
  modality: "nlp",
159
186
  color: "indigo"
160
187
  },
161
- "conversational": {
188
+ conversational: {
162
189
  name: "Conversational",
163
190
  subtasks: [
164
191
  {
@@ -386,7 +413,7 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
386
413
  modality: "rl",
387
414
  color: "red"
388
415
  },
389
- "robotics": {
416
+ robotics: {
390
417
  name: "Robotics",
391
418
  modality: "rl",
392
419
  subtasks: [
@@ -539,19 +566,14 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
539
566
  modality: "multimodal",
540
567
  color: "green"
541
568
  },
542
- "other": {
569
+ other: {
543
570
  name: "Other",
544
571
  modality: "other",
545
572
  color: "blue",
546
573
  hideInModels: true,
547
574
  hideInDatasets: true
548
575
  }
549
- });
550
- var ALL_PIPELINE_TYPES = Object.keys(PIPELINE_DATA);
551
- var ALL_PIPELINE_TYPES_SET = new Set(ALL_PIPELINE_TYPES);
552
- var ALL_SUBTASKS = Object.values(PIPELINE_DATA).flatMap((data) => data.subtasks ?? []);
553
- var ALL_SUBTASK_TYPES = ALL_SUBTASKS.map((s) => s.type);
554
- var ALL_SUBTASK_TYPES_SET = new Set(ALL_SUBTASK_TYPES);
576
+ };
555
577
 
556
578
  // src/audio-classification/data.ts
557
579
  var taskData = {
@@ -1839,19 +1861,9 @@ var taskData19 = {
1839
1861
  ],
1840
1862
  type: "tabular"
1841
1863
  },
1842
- {
1843
- label: "Question",
1844
- content: "What is the number of reigns for Harley Race?",
1845
- type: "text"
1846
- }
1864
+ { label: "Question", content: "What is the number of reigns for Harley Race?", type: "text" }
1847
1865
  ],
1848
- outputs: [
1849
- {
1850
- label: "Result",
1851
- content: "7",
1852
- type: "text"
1853
- }
1854
- ]
1866
+ outputs: [{ label: "Result", content: "7", type: "text" }]
1855
1867
  },
1856
1868
  metrics: [
1857
1869
  {
@@ -2978,7 +2990,7 @@ var TASKS_MODEL_LIBRARIES = {
2978
2990
  "audio-classification": ["speechbrain", "transformers"],
2979
2991
  "audio-to-audio": ["asteroid", "speechbrain"],
2980
2992
  "automatic-speech-recognition": ["espnet", "nemo", "speechbrain", "transformers", "transformers.js"],
2981
- "conversational": ["transformers"],
2993
+ conversational: ["transformers"],
2982
2994
  "depth-estimation": ["transformers"],
2983
2995
  "document-question-answering": ["transformers"],
2984
2996
  "feature-extraction": ["sentence-transformers", "transformers", "transformers.js"],
@@ -2991,12 +3003,12 @@ var TASKS_MODEL_LIBRARIES = {
2991
3003
  "video-classification": [],
2992
3004
  "multiple-choice": ["transformers"],
2993
3005
  "object-detection": ["transformers", "transformers.js"],
2994
- "other": [],
3006
+ other: [],
2995
3007
  "question-answering": ["adapter-transformers", "allennlp", "transformers", "transformers.js"],
2996
- "robotics": [],
3008
+ robotics: [],
2997
3009
  "reinforcement-learning": ["transformers", "stable-baselines3", "ml-agents", "sample-factory"],
2998
3010
  "sentence-similarity": ["sentence-transformers", "spacy", "transformers.js"],
2999
- "summarization": ["transformers", "transformers.js"],
3011
+ summarization: ["transformers", "transformers.js"],
3000
3012
  "table-question-answering": ["transformers"],
3001
3013
  "table-to-text": ["transformers"],
3002
3014
  "tabular-classification": ["sklearn"],
@@ -3011,8 +3023,16 @@ var TASKS_MODEL_LIBRARIES = {
3011
3023
  "text-to-video": [],
3012
3024
  "text2text-generation": ["transformers", "transformers.js"],
3013
3025
  "time-series-forecasting": [],
3014
- "token-classification": ["adapter-transformers", "flair", "spacy", "span-marker", "stanza", "transformers", "transformers.js"],
3015
- "translation": ["transformers", "transformers.js"],
3026
+ "token-classification": [
3027
+ "adapter-transformers",
3028
+ "flair",
3029
+ "spacy",
3030
+ "span-marker",
3031
+ "stanza",
3032
+ "transformers",
3033
+ "transformers.js"
3034
+ ],
3035
+ translation: ["transformers", "transformers.js"],
3016
3036
  "unconditional-image-generation": [],
3017
3037
  "visual-question-answering": [],
3018
3038
  "voice-activity-detection": [],
@@ -3025,7 +3045,7 @@ var TASKS_DATA = {
3025
3045
  "audio-classification": getData("audio-classification", data_default),
3026
3046
  "audio-to-audio": getData("audio-to-audio", data_default2),
3027
3047
  "automatic-speech-recognition": getData("automatic-speech-recognition", data_default3),
3028
- "conversational": getData("conversational", data_default4),
3048
+ conversational: getData("conversational", data_default4),
3029
3049
  "depth-estimation": getData("depth-estimation", data_default13),
3030
3050
  "document-question-answering": getData("document-question-answering", data_default5),
3031
3051
  "feature-extraction": getData("feature-extraction", data_default6),
@@ -3038,12 +3058,12 @@ var TASKS_DATA = {
3038
3058
  "multiple-choice": void 0,
3039
3059
  "object-detection": getData("object-detection", data_default12),
3040
3060
  "video-classification": getData("video-classification", data_default30),
3041
- "other": void 0,
3061
+ other: void 0,
3042
3062
  "question-answering": getData("question-answering", data_default16),
3043
3063
  "reinforcement-learning": getData("reinforcement-learning", data_default15),
3044
- "robotics": void 0,
3064
+ robotics: void 0,
3045
3065
  "sentence-similarity": getData("sentence-similarity", data_default17),
3046
- "summarization": getData("summarization", data_default18),
3066
+ summarization: getData("summarization", data_default18),
3047
3067
  "table-question-answering": getData("table-question-answering", data_default19),
3048
3068
  "table-to-text": void 0,
3049
3069
  "tabular-classification": getData("tabular-classification", data_default20),
@@ -3059,7 +3079,7 @@ var TASKS_DATA = {
3059
3079
  "text2text-generation": void 0,
3060
3080
  "time-series-forecasting": void 0,
3061
3081
  "token-classification": getData("token-classification", data_default24),
3062
- "translation": getData("translation", data_default25),
3082
+ translation: getData("translation", data_default25),
3063
3083
  "unconditional-image-generation": getData("unconditional-image-generation", data_default29),
3064
3084
  "visual-question-answering": getData("visual-question-answering", data_default31),
3065
3085
  "voice-activity-detection": void 0,
@@ -3074,6 +3094,48 @@ function getData(type, partialTaskData = data_default14) {
3074
3094
  libraries: TASKS_MODEL_LIBRARIES[type]
3075
3095
  };
3076
3096
  }
3077
- export {
3097
+
3098
+ // src/modelLibraries.ts
3099
+ var ModelLibrary = /* @__PURE__ */ ((ModelLibrary2) => {
3100
+ ModelLibrary2["adapter-transformers"] = "Adapter Transformers";
3101
+ ModelLibrary2["allennlp"] = "allenNLP";
3102
+ ModelLibrary2["asteroid"] = "Asteroid";
3103
+ ModelLibrary2["bertopic"] = "BERTopic";
3104
+ ModelLibrary2["diffusers"] = "Diffusers";
3105
+ ModelLibrary2["doctr"] = "docTR";
3106
+ ModelLibrary2["espnet"] = "ESPnet";
3107
+ ModelLibrary2["fairseq"] = "Fairseq";
3108
+ ModelLibrary2["flair"] = "Flair";
3109
+ ModelLibrary2["keras"] = "Keras";
3110
+ ModelLibrary2["k2"] = "K2";
3111
+ ModelLibrary2["nemo"] = "NeMo";
3112
+ ModelLibrary2["open_clip"] = "OpenCLIP";
3113
+ ModelLibrary2["paddlenlp"] = "PaddleNLP";
3114
+ ModelLibrary2["peft"] = "PEFT";
3115
+ ModelLibrary2["pyannote-audio"] = "pyannote.audio";
3116
+ ModelLibrary2["sample-factory"] = "Sample Factory";
3117
+ ModelLibrary2["sentence-transformers"] = "Sentence Transformers";
3118
+ ModelLibrary2["sklearn"] = "Scikit-learn";
3119
+ ModelLibrary2["spacy"] = "spaCy";
3120
+ ModelLibrary2["span-marker"] = "SpanMarker";
3121
+ ModelLibrary2["speechbrain"] = "speechbrain";
3122
+ ModelLibrary2["tensorflowtts"] = "TensorFlowTTS";
3123
+ ModelLibrary2["timm"] = "Timm";
3124
+ ModelLibrary2["fastai"] = "fastai";
3125
+ ModelLibrary2["transformers"] = "Transformers";
3126
+ ModelLibrary2["transformers.js"] = "Transformers.js";
3127
+ ModelLibrary2["stanza"] = "Stanza";
3128
+ ModelLibrary2["fasttext"] = "fastText";
3129
+ ModelLibrary2["stable-baselines3"] = "Stable-Baselines3";
3130
+ ModelLibrary2["ml-agents"] = "ML-Agents";
3131
+ ModelLibrary2["pythae"] = "Pythae";
3132
+ ModelLibrary2["mindspore"] = "MindSpore";
3133
+ return ModelLibrary2;
3134
+ })(ModelLibrary || {});
3135
+ // Annotate the CommonJS export names for ESM import in node:
3136
+ 0 && (module.exports = {
3137
+ MODALITIES,
3138
+ ModelLibrary,
3139
+ PIPELINE_DATA,
3078
3140
  TASKS_DATA
3079
- };
3141
+ });
@@ -1,33 +1,6 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/index.ts
20
- var src_exports = {};
21
- __export(src_exports, {
22
- TASKS_DATA: () => TASKS_DATA
23
- });
24
- module.exports = __toCommonJS(src_exports);
25
-
26
- // ../js/src/lib/interfaces/Types.ts
27
- function ensureRecordOfPipelines(record) {
28
- return record;
29
- }
30
- var PIPELINE_DATA = ensureRecordOfPipelines({
1
+ // src/pipelines.ts
2
+ var MODALITIES = ["cv", "nlp", "audio", "tabular", "multimodal", "rl", "other"];
3
+ var PIPELINE_DATA = {
31
4
  "text-classification": {
32
5
  name: "Text Classification",
33
6
  subtasks: [
@@ -163,12 +136,12 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
163
136
  modality: "nlp",
164
137
  color: "yellow"
165
138
  },
166
- "translation": {
139
+ translation: {
167
140
  name: "Translation",
168
141
  modality: "nlp",
169
142
  color: "green"
170
143
  },
171
- "summarization": {
144
+ summarization: {
172
145
  name: "Summarization",
173
146
  subtasks: [
174
147
  {
@@ -183,7 +156,7 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
183
156
  modality: "nlp",
184
157
  color: "indigo"
185
158
  },
186
- "conversational": {
159
+ conversational: {
187
160
  name: "Conversational",
188
161
  subtasks: [
189
162
  {
@@ -411,7 +384,7 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
411
384
  modality: "rl",
412
385
  color: "red"
413
386
  },
414
- "robotics": {
387
+ robotics: {
415
388
  name: "Robotics",
416
389
  modality: "rl",
417
390
  subtasks: [
@@ -564,19 +537,14 @@ var PIPELINE_DATA = ensureRecordOfPipelines({
564
537
  modality: "multimodal",
565
538
  color: "green"
566
539
  },
567
- "other": {
540
+ other: {
568
541
  name: "Other",
569
542
  modality: "other",
570
543
  color: "blue",
571
544
  hideInModels: true,
572
545
  hideInDatasets: true
573
546
  }
574
- });
575
- var ALL_PIPELINE_TYPES = Object.keys(PIPELINE_DATA);
576
- var ALL_PIPELINE_TYPES_SET = new Set(ALL_PIPELINE_TYPES);
577
- var ALL_SUBTASKS = Object.values(PIPELINE_DATA).flatMap((data) => data.subtasks ?? []);
578
- var ALL_SUBTASK_TYPES = ALL_SUBTASKS.map((s) => s.type);
579
- var ALL_SUBTASK_TYPES_SET = new Set(ALL_SUBTASK_TYPES);
547
+ };
580
548
 
581
549
  // src/audio-classification/data.ts
582
550
  var taskData = {
@@ -1864,19 +1832,9 @@ var taskData19 = {
1864
1832
  ],
1865
1833
  type: "tabular"
1866
1834
  },
1867
- {
1868
- label: "Question",
1869
- content: "What is the number of reigns for Harley Race?",
1870
- type: "text"
1871
- }
1835
+ { label: "Question", content: "What is the number of reigns for Harley Race?", type: "text" }
1872
1836
  ],
1873
- outputs: [
1874
- {
1875
- label: "Result",
1876
- content: "7",
1877
- type: "text"
1878
- }
1879
- ]
1837
+ outputs: [{ label: "Result", content: "7", type: "text" }]
1880
1838
  },
1881
1839
  metrics: [
1882
1840
  {
@@ -3003,7 +2961,7 @@ var TASKS_MODEL_LIBRARIES = {
3003
2961
  "audio-classification": ["speechbrain", "transformers"],
3004
2962
  "audio-to-audio": ["asteroid", "speechbrain"],
3005
2963
  "automatic-speech-recognition": ["espnet", "nemo", "speechbrain", "transformers", "transformers.js"],
3006
- "conversational": ["transformers"],
2964
+ conversational: ["transformers"],
3007
2965
  "depth-estimation": ["transformers"],
3008
2966
  "document-question-answering": ["transformers"],
3009
2967
  "feature-extraction": ["sentence-transformers", "transformers", "transformers.js"],
@@ -3016,12 +2974,12 @@ var TASKS_MODEL_LIBRARIES = {
3016
2974
  "video-classification": [],
3017
2975
  "multiple-choice": ["transformers"],
3018
2976
  "object-detection": ["transformers", "transformers.js"],
3019
- "other": [],
2977
+ other: [],
3020
2978
  "question-answering": ["adapter-transformers", "allennlp", "transformers", "transformers.js"],
3021
- "robotics": [],
2979
+ robotics: [],
3022
2980
  "reinforcement-learning": ["transformers", "stable-baselines3", "ml-agents", "sample-factory"],
3023
2981
  "sentence-similarity": ["sentence-transformers", "spacy", "transformers.js"],
3024
- "summarization": ["transformers", "transformers.js"],
2982
+ summarization: ["transformers", "transformers.js"],
3025
2983
  "table-question-answering": ["transformers"],
3026
2984
  "table-to-text": ["transformers"],
3027
2985
  "tabular-classification": ["sklearn"],
@@ -3036,8 +2994,16 @@ var TASKS_MODEL_LIBRARIES = {
3036
2994
  "text-to-video": [],
3037
2995
  "text2text-generation": ["transformers", "transformers.js"],
3038
2996
  "time-series-forecasting": [],
3039
- "token-classification": ["adapter-transformers", "flair", "spacy", "span-marker", "stanza", "transformers", "transformers.js"],
3040
- "translation": ["transformers", "transformers.js"],
2997
+ "token-classification": [
2998
+ "adapter-transformers",
2999
+ "flair",
3000
+ "spacy",
3001
+ "span-marker",
3002
+ "stanza",
3003
+ "transformers",
3004
+ "transformers.js"
3005
+ ],
3006
+ translation: ["transformers", "transformers.js"],
3041
3007
  "unconditional-image-generation": [],
3042
3008
  "visual-question-answering": [],
3043
3009
  "voice-activity-detection": [],
@@ -3050,7 +3016,7 @@ var TASKS_DATA = {
3050
3016
  "audio-classification": getData("audio-classification", data_default),
3051
3017
  "audio-to-audio": getData("audio-to-audio", data_default2),
3052
3018
  "automatic-speech-recognition": getData("automatic-speech-recognition", data_default3),
3053
- "conversational": getData("conversational", data_default4),
3019
+ conversational: getData("conversational", data_default4),
3054
3020
  "depth-estimation": getData("depth-estimation", data_default13),
3055
3021
  "document-question-answering": getData("document-question-answering", data_default5),
3056
3022
  "feature-extraction": getData("feature-extraction", data_default6),
@@ -3063,12 +3029,12 @@ var TASKS_DATA = {
3063
3029
  "multiple-choice": void 0,
3064
3030
  "object-detection": getData("object-detection", data_default12),
3065
3031
  "video-classification": getData("video-classification", data_default30),
3066
- "other": void 0,
3032
+ other: void 0,
3067
3033
  "question-answering": getData("question-answering", data_default16),
3068
3034
  "reinforcement-learning": getData("reinforcement-learning", data_default15),
3069
- "robotics": void 0,
3035
+ robotics: void 0,
3070
3036
  "sentence-similarity": getData("sentence-similarity", data_default17),
3071
- "summarization": getData("summarization", data_default18),
3037
+ summarization: getData("summarization", data_default18),
3072
3038
  "table-question-answering": getData("table-question-answering", data_default19),
3073
3039
  "table-to-text": void 0,
3074
3040
  "tabular-classification": getData("tabular-classification", data_default20),
@@ -3084,7 +3050,7 @@ var TASKS_DATA = {
3084
3050
  "text2text-generation": void 0,
3085
3051
  "time-series-forecasting": void 0,
3086
3052
  "token-classification": getData("token-classification", data_default24),
3087
- "translation": getData("translation", data_default25),
3053
+ translation: getData("translation", data_default25),
3088
3054
  "unconditional-image-generation": getData("unconditional-image-generation", data_default29),
3089
3055
  "visual-question-answering": getData("visual-question-answering", data_default31),
3090
3056
  "voice-activity-detection": void 0,
@@ -3099,7 +3065,47 @@ function getData(type, partialTaskData = data_default14) {
3099
3065
  libraries: TASKS_MODEL_LIBRARIES[type]
3100
3066
  };
3101
3067
  }
3102
- // Annotate the CommonJS export names for ESM import in node:
3103
- 0 && (module.exports = {
3068
+
3069
+ // src/modelLibraries.ts
3070
+ var ModelLibrary = /* @__PURE__ */ ((ModelLibrary2) => {
3071
+ ModelLibrary2["adapter-transformers"] = "Adapter Transformers";
3072
+ ModelLibrary2["allennlp"] = "allenNLP";
3073
+ ModelLibrary2["asteroid"] = "Asteroid";
3074
+ ModelLibrary2["bertopic"] = "BERTopic";
3075
+ ModelLibrary2["diffusers"] = "Diffusers";
3076
+ ModelLibrary2["doctr"] = "docTR";
3077
+ ModelLibrary2["espnet"] = "ESPnet";
3078
+ ModelLibrary2["fairseq"] = "Fairseq";
3079
+ ModelLibrary2["flair"] = "Flair";
3080
+ ModelLibrary2["keras"] = "Keras";
3081
+ ModelLibrary2["k2"] = "K2";
3082
+ ModelLibrary2["nemo"] = "NeMo";
3083
+ ModelLibrary2["open_clip"] = "OpenCLIP";
3084
+ ModelLibrary2["paddlenlp"] = "PaddleNLP";
3085
+ ModelLibrary2["peft"] = "PEFT";
3086
+ ModelLibrary2["pyannote-audio"] = "pyannote.audio";
3087
+ ModelLibrary2["sample-factory"] = "Sample Factory";
3088
+ ModelLibrary2["sentence-transformers"] = "Sentence Transformers";
3089
+ ModelLibrary2["sklearn"] = "Scikit-learn";
3090
+ ModelLibrary2["spacy"] = "spaCy";
3091
+ ModelLibrary2["span-marker"] = "SpanMarker";
3092
+ ModelLibrary2["speechbrain"] = "speechbrain";
3093
+ ModelLibrary2["tensorflowtts"] = "TensorFlowTTS";
3094
+ ModelLibrary2["timm"] = "Timm";
3095
+ ModelLibrary2["fastai"] = "fastai";
3096
+ ModelLibrary2["transformers"] = "Transformers";
3097
+ ModelLibrary2["transformers.js"] = "Transformers.js";
3098
+ ModelLibrary2["stanza"] = "Stanza";
3099
+ ModelLibrary2["fasttext"] = "fastText";
3100
+ ModelLibrary2["stable-baselines3"] = "Stable-Baselines3";
3101
+ ModelLibrary2["ml-agents"] = "ML-Agents";
3102
+ ModelLibrary2["pythae"] = "Pythae";
3103
+ ModelLibrary2["mindspore"] = "MindSpore";
3104
+ return ModelLibrary2;
3105
+ })(ModelLibrary || {});
3106
+ export {
3107
+ MODALITIES,
3108
+ ModelLibrary,
3109
+ PIPELINE_DATA,
3104
3110
  TASKS_DATA
3105
- });
3111
+ };
package/package.json CHANGED
@@ -1,35 +1,44 @@
1
1
  {
2
- "name": "@huggingface/tasks",
3
- "version": "0.0.2",
4
- "type": "module",
5
- "description": "A library of tasks for the Hugging Face Hub",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "require": "./dist/index.js",
13
- "import": "./dist/index.mjs"
14
- }
15
- },
16
- "scripts": {
17
- "prepublishOnly": "npm run build",
18
- "build": "tsup src/index.ts --format cjs,esm --clean --dts",
19
- "test": "vitest run",
20
- "type-check": "tsc"
21
- },
22
- "source": "src/index.ts",
23
- "files": [
24
- "assets",
25
- "src",
26
- "dist"
27
- ],
28
- "devDependencies": {
29
- "tsup": "^7.3.0",
30
- "typescript": "^5.2.2"
31
- },
2
+ "name": "@huggingface/tasks",
3
+ "packageManager": "pnpm@8.3.1",
4
+ "version": "0.0.4",
5
+ "description": "List of ISO-639 languages used in the Hub",
6
+ "repository": "https://github.com/huggingface/huggingface.js.git",
32
7
  "publishConfig": {
33
- "access": "public"
34
- }
35
- }
8
+ "access": "public"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "module": "./dist/index.mjs",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "require": "./dist/index.js",
17
+ "import": "./dist/index.mjs"
18
+ }
19
+ },
20
+ "source": "src/index.ts",
21
+ "files": [
22
+ "dist",
23
+ "src",
24
+ "tsconfig.json"
25
+ ],
26
+ "keywords": [
27
+ "huggingface",
28
+ "hub",
29
+ "languages"
30
+ ],
31
+ "author": "Hugging Face",
32
+ "license": "MIT",
33
+ "devDependencies": {
34
+ "typescript": "^5.0.4"
35
+ },
36
+ "scripts": {
37
+ "lint": "eslint --quiet --fix --ext .cjs,.ts .",
38
+ "lint:check": "eslint --ext .cjs,.ts .",
39
+ "format": "prettier --write .",
40
+ "format:check": "prettier --check .",
41
+ "build": "tsup src/index.ts --format cjs,esm --clean --dts",
42
+ "type-check": "tsc"
43
+ }
44
+ }
package/src/Types.ts CHANGED
@@ -1,58 +1,64 @@
1
- import type { ModelLibraryKey } from "../../js/src/lib/interfaces/Libraries";
2
- import type { PipelineType } from "../../js/src/lib/interfaces/Types";
1
+ import type { ModelLibraryKey } from "./modelLibraries";
2
+ import type { PipelineType } from "./pipelines";
3
3
 
4
4
  export interface ExampleRepo {
5
5
  description: string;
6
- id: string;
6
+ id: string;
7
7
  }
8
8
 
9
- export type TaskDemoEntry = {
10
- filename: string;
11
- type: "audio";
12
- } | {
13
- data: Array<{
14
- label: string;
15
- score: number;
16
- }>;
17
- type: "chart";
18
- } | {
19
- filename: string;
20
- type: "img";
21
- } | {
22
- table: string[][];
23
- type: "tabular";
24
- } | {
25
- content: string;
26
- label: string;
27
- type: "text";
28
- } | {
29
- text: string;
30
- tokens: Array<{
31
- end: number;
32
- start: number;
33
- type: string;
34
- }>;
35
- type: "text-with-tokens";
36
- } ;
9
+ export type TaskDemoEntry =
10
+ | {
11
+ filename: string;
12
+ type: "audio";
13
+ }
14
+ | {
15
+ data: Array<{
16
+ label: string;
17
+ score: number;
18
+ }>;
19
+ type: "chart";
20
+ }
21
+ | {
22
+ filename: string;
23
+ type: "img";
24
+ }
25
+ | {
26
+ table: string[][];
27
+ type: "tabular";
28
+ }
29
+ | {
30
+ content: string;
31
+ label: string;
32
+ type: "text";
33
+ }
34
+ | {
35
+ text: string;
36
+ tokens: Array<{
37
+ end: number;
38
+ start: number;
39
+ type: string;
40
+ }>;
41
+ type: "text-with-tokens";
42
+ };
37
43
 
38
44
  export interface TaskDemo {
39
- inputs: TaskDemoEntry[];
45
+ inputs: TaskDemoEntry[];
40
46
  outputs: TaskDemoEntry[];
41
47
  }
42
48
 
43
49
  export interface TaskData {
44
- datasets: ExampleRepo[];
45
- demo: TaskDemo;
46
- id: PipelineType;
50
+ datasets: ExampleRepo[];
51
+ demo: TaskDemo;
52
+ id: PipelineType;
47
53
  isPlaceholder?: boolean;
48
- label: string;
49
- libraries: ModelLibraryKey[];
50
- metrics: ExampleRepo[];
51
- models: ExampleRepo[];
52
- spaces: ExampleRepo[];
53
- summary: string;
54
- widgetModels: string[];
55
- youtubeId?: string;
54
+ label: string;
55
+ libraries: ModelLibraryKey[];
56
+ metrics: ExampleRepo[];
57
+ models: ExampleRepo[];
58
+ spaces: ExampleRepo[];
59
+ summary: string;
60
+ widgetModels: string[];
61
+ youtubeId?: string;
56
62
  }
57
63
 
58
64
  export type TaskDataCustom = Omit<TaskData, "id" | "label" | "libraries">;