@huggingface/tasks 0.6.1 → 0.7.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.
- package/dist/index.cjs +22 -4
- package/dist/index.d.ts +6 -6
- package/dist/index.js +21 -3
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/library-to-tasks.ts +23 -5
- package/src/tasks/index.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ __export(src_exports, {
|
|
|
23
23
|
ALL_DISPLAY_MODEL_LIBRARY_KEYS: () => ALL_DISPLAY_MODEL_LIBRARY_KEYS,
|
|
24
24
|
ALL_MODEL_LIBRARY_KEYS: () => ALL_MODEL_LIBRARY_KEYS,
|
|
25
25
|
InferenceDisplayability: () => InferenceDisplayability,
|
|
26
|
-
|
|
26
|
+
LIBRARY_TASK_MAPPING: () => LIBRARY_TASK_MAPPING,
|
|
27
27
|
MAPPING_DEFAULT_WIDGET: () => MAPPING_DEFAULT_WIDGET,
|
|
28
28
|
MODALITIES: () => MODALITIES,
|
|
29
29
|
MODALITY_LABELS: () => MODALITY_LABELS,
|
|
@@ -40,7 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
module.exports = __toCommonJS(src_exports);
|
|
41
41
|
|
|
42
42
|
// src/library-to-tasks.ts
|
|
43
|
-
var
|
|
43
|
+
var LIBRARY_TASK_MAPPING = {
|
|
44
44
|
"adapter-transformers": ["question-answering", "text-classification", "token-classification"],
|
|
45
45
|
allennlp: ["question-answering"],
|
|
46
46
|
asteroid: [
|
|
@@ -76,6 +76,24 @@ var LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS = {
|
|
|
76
76
|
],
|
|
77
77
|
stanza: ["token-classification"],
|
|
78
78
|
timm: ["image-classification"],
|
|
79
|
+
transformers: [
|
|
80
|
+
"audio-classification",
|
|
81
|
+
"automatic-speech-recognition",
|
|
82
|
+
"depth-estimation",
|
|
83
|
+
"document-question-answering",
|
|
84
|
+
"fill-mask",
|
|
85
|
+
"image-classification",
|
|
86
|
+
"image-segmentation",
|
|
87
|
+
"image-to-text",
|
|
88
|
+
"image-to-image",
|
|
89
|
+
"object-detection",
|
|
90
|
+
"question-answering",
|
|
91
|
+
"text-generation",
|
|
92
|
+
"text2text-generation",
|
|
93
|
+
"visual-question-answering",
|
|
94
|
+
"zero-shot-classification",
|
|
95
|
+
"zero-shot-image-classification"
|
|
96
|
+
],
|
|
79
97
|
mindspore: ["image-classification"]
|
|
80
98
|
};
|
|
81
99
|
|
|
@@ -3847,7 +3865,7 @@ var data_default34 = taskData34;
|
|
|
3847
3865
|
// src/tasks/index.ts
|
|
3848
3866
|
var TASKS_MODEL_LIBRARIES = {
|
|
3849
3867
|
"audio-classification": ["speechbrain", "transformers", "transformers.js"],
|
|
3850
|
-
"audio-to-audio": ["asteroid", "speechbrain"],
|
|
3868
|
+
"audio-to-audio": ["asteroid", "fairseq", "speechbrain"],
|
|
3851
3869
|
"automatic-speech-recognition": ["espnet", "nemo", "speechbrain", "transformers", "transformers.js"],
|
|
3852
3870
|
"depth-estimation": ["transformers", "transformers.js"],
|
|
3853
3871
|
"document-question-answering": ["transformers", "transformers.js"],
|
|
@@ -5324,7 +5342,7 @@ function hasJsInferenceSnippet(model) {
|
|
|
5324
5342
|
ALL_DISPLAY_MODEL_LIBRARY_KEYS,
|
|
5325
5343
|
ALL_MODEL_LIBRARY_KEYS,
|
|
5326
5344
|
InferenceDisplayability,
|
|
5327
|
-
|
|
5345
|
+
LIBRARY_TASK_MAPPING,
|
|
5328
5346
|
MAPPING_DEFAULT_WIDGET,
|
|
5329
5347
|
MODALITIES,
|
|
5330
5348
|
MODALITY_LABELS,
|
package/dist/index.d.ts
CHANGED
|
@@ -1145,13 +1145,13 @@ declare const ALL_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "all
|
|
|
1145
1145
|
declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gliner" | "grok" | "keras" | "k2" | "mindspore" | "ml-agents" | "mlx" | "mlx-image" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis" | "whisperkit")[];
|
|
1146
1146
|
|
|
1147
1147
|
/**
|
|
1148
|
-
* Mapping from library name
|
|
1148
|
+
* Mapping from library name to its supported tasks.
|
|
1149
1149
|
* Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1152
|
-
*
|
|
1150
|
+
* This mapping is partially generated automatically by "python-api-export-tasks" action in
|
|
1151
|
+
* huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually
|
|
1152
|
+
* based on api-inference.
|
|
1153
1153
|
*/
|
|
1154
|
-
declare const
|
|
1154
|
+
declare const LIBRARY_TASK_MAPPING: Partial<Record<ModelLibraryKey, PipelineType[]>>;
|
|
1155
1155
|
|
|
1156
1156
|
type PerLanguageMapping = Map<WidgetType, string[] | WidgetExample[]>;
|
|
1157
1157
|
declare const MAPPING_DEFAULT_WIDGET: Map<string, PerLanguageMapping>;
|
|
@@ -3471,4 +3471,4 @@ declare namespace index {
|
|
|
3471
3471
|
};
|
|
3472
3472
|
}
|
|
3473
3473
|
|
|
3474
|
-
export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, AddedToken, AudioClassificationInput, AudioClassificationOutput, AudioClassificationOutputElement, AudioClassificationParameters, AutomaticSpeechRecognitionInput, AutomaticSpeechRecognitionOutput, AutomaticSpeechRecognitionOutputChunk, AutomaticSpeechRecognitionParameters, BoundingBox, ChatCompletionFinishReason, ChatCompletionInput, ChatCompletionInputMessage, ChatCompletionOutput, ChatCompletionOutputChoice, ChatCompletionOutputChoiceMessage, ChatCompletionStreamOutput, ChatCompletionStreamOutputChoice, ChatCompletionStreamOutputDelta, ChatMessage, ClassificationOutputTransform$1 as ClassificationOutputTransform, DepthEstimationInput, DepthEstimationOutput, DocumentQuestionAnsweringInput, DocumentQuestionAnsweringInputData, DocumentQuestionAnsweringOutput, DocumentQuestionAnsweringOutputElement, DocumentQuestionAnsweringParameters, EarlyStoppingUnion$2 as EarlyStoppingUnion, ExampleRepo, FeatureExtractionInput, FeatureExtractionOutput, FillMaskInput, FillMaskOutput, FillMaskOutputElement, FillMaskParameters, GenerationParameters$2 as GenerationParameters, ImageClassificationInput, ImageClassificationOutput, ImageClassificationOutputElement, ImageClassificationParameters, ImageSegmentationInput, ImageSegmentationOutput, ImageSegmentationOutputElement, ImageSegmentationParameters, ImageSegmentationSubtask, ImageToImageInput, ImageToImageOutput, ImageToImageParameters, ImageToTextInput, ImageToTextOutput, ImageToTextParameters, InferenceDisplayability,
|
|
3474
|
+
export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, AddedToken, AudioClassificationInput, AudioClassificationOutput, AudioClassificationOutputElement, AudioClassificationParameters, AutomaticSpeechRecognitionInput, AutomaticSpeechRecognitionOutput, AutomaticSpeechRecognitionOutputChunk, AutomaticSpeechRecognitionParameters, BoundingBox, ChatCompletionFinishReason, ChatCompletionInput, ChatCompletionInputMessage, ChatCompletionOutput, ChatCompletionOutputChoice, ChatCompletionOutputChoiceMessage, ChatCompletionStreamOutput, ChatCompletionStreamOutputChoice, ChatCompletionStreamOutputDelta, ChatMessage, ClassificationOutputTransform$1 as ClassificationOutputTransform, DepthEstimationInput, DepthEstimationOutput, DocumentQuestionAnsweringInput, DocumentQuestionAnsweringInputData, DocumentQuestionAnsweringOutput, DocumentQuestionAnsweringOutputElement, DocumentQuestionAnsweringParameters, EarlyStoppingUnion$2 as EarlyStoppingUnion, ExampleRepo, FeatureExtractionInput, FeatureExtractionOutput, FillMaskInput, FillMaskOutput, FillMaskOutputElement, FillMaskParameters, GenerationParameters$2 as GenerationParameters, ImageClassificationInput, ImageClassificationOutput, ImageClassificationOutputElement, ImageClassificationParameters, ImageSegmentationInput, ImageSegmentationOutput, ImageSegmentationOutputElement, ImageSegmentationParameters, ImageSegmentationSubtask, ImageToImageInput, ImageToImageOutput, ImageToImageParameters, ImageToTextInput, ImageToTextOutput, ImageToTextParameters, InferenceDisplayability, LIBRARY_TASK_MAPPING, LibraryUiElement, MAPPING_DEFAULT_WIDGET, MODALITIES, MODALITY_LABELS, MODEL_LIBRARIES_UI_ELEMENTS, Modality, ModelData, ModelLibraryKey, ObjectDetectionInput, ObjectDetectionOutput, ObjectDetectionOutputElement, ObjectDetectionParameters, PIPELINE_DATA, PIPELINE_TYPES, PIPELINE_TYPES_SET, PipelineData, PipelineType, QuestionAnsweringInput, QuestionAnsweringInputData, QuestionAnsweringOutput, QuestionAnsweringOutputElement, QuestionAnsweringParameters, SPECIAL_TOKENS_ATTRIBUTES, SUBTASK_TYPES, SentenceSimilarityInput, SentenceSimilarityInputData, SentenceSimilarityOutput, SpecialTokensMap, SummarizationInput, SummarizationOutput, TASKS_DATA, TASKS_MODEL_LIBRARIES, TableQuestionAnsweringInput, TableQuestionAnsweringInputData, TableQuestionAnsweringOutput, TableQuestionAnsweringOutputElement, TargetSize$1 as TargetSize, TaskData, TaskDataCustom, TaskDemo, TaskDemoEntry, Text2TextGenerationParameters, Text2TextGenerationTruncationStrategy, TextClassificationInput, TextClassificationOutput, TextClassificationOutputElement, TextClassificationParameters, TextGenerationFinishReason, TextGenerationInput, TextGenerationOutput, TextGenerationOutputDetails, TextGenerationOutputSequenceDetails, TextGenerationOutputToken, TextGenerationParameters, TextGenerationPrefillToken, TextToAudioParameters, TextToImageInput, TextToImageOutput, TextToImageParameters, TextToSpeechInput, TextToSpeechOutput, TokenClassificationAggregationStrategy, TokenClassificationInput, TokenClassificationOutput, TokenClassificationOutputElement, TokenClassificationParameters, TokenizerConfig, TransformersInfo, TranslationInput, TranslationOutput, VideoClassificationInput, VideoClassificationOutput, VideoClassificationOutputElement, VideoClassificationParameters, VisualQuestionAnsweringInput, VisualQuestionAnsweringInputData, VisualQuestionAnsweringOutput, VisualQuestionAnsweringOutputElement, VisualQuestionAnsweringParameters, WidgetExample, WidgetExampleAssetAndPromptInput, WidgetExampleAssetAndTextInput, WidgetExampleAssetAndZeroShotInput, WidgetExampleAssetInput, WidgetExampleAttribute, WidgetExampleChatInput, WidgetExampleOutput, WidgetExampleOutputAnswerScore, WidgetExampleOutputLabels, WidgetExampleOutputText, WidgetExampleOutputUrl, WidgetExampleSentenceSimilarityInput, WidgetExampleStructuredDataInput, WidgetExampleTableDataInput, WidgetExampleTextAndContextInput, WidgetExampleTextAndTableInput, WidgetExampleTextInput, WidgetExampleZeroShotTextInput, WidgetType, WordBox, ZeroShotClassificationInput, ZeroShotClassificationInputData, ZeroShotClassificationOutput, ZeroShotClassificationOutputElement, ZeroShotClassificationParameters, ZeroShotImageClassificationInput, ZeroShotImageClassificationInputData, ZeroShotImageClassificationOutput, ZeroShotImageClassificationOutputElement, ZeroShotImageClassificationParameters, ZeroShotObjectDetectionInput, ZeroShotObjectDetectionInputData, ZeroShotObjectDetectionOutput, ZeroShotObjectDetectionOutputElement, index as snippets };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/library-to-tasks.ts
|
|
8
|
-
var
|
|
8
|
+
var LIBRARY_TASK_MAPPING = {
|
|
9
9
|
"adapter-transformers": ["question-answering", "text-classification", "token-classification"],
|
|
10
10
|
allennlp: ["question-answering"],
|
|
11
11
|
asteroid: [
|
|
@@ -41,6 +41,24 @@ var LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS = {
|
|
|
41
41
|
],
|
|
42
42
|
stanza: ["token-classification"],
|
|
43
43
|
timm: ["image-classification"],
|
|
44
|
+
transformers: [
|
|
45
|
+
"audio-classification",
|
|
46
|
+
"automatic-speech-recognition",
|
|
47
|
+
"depth-estimation",
|
|
48
|
+
"document-question-answering",
|
|
49
|
+
"fill-mask",
|
|
50
|
+
"image-classification",
|
|
51
|
+
"image-segmentation",
|
|
52
|
+
"image-to-text",
|
|
53
|
+
"image-to-image",
|
|
54
|
+
"object-detection",
|
|
55
|
+
"question-answering",
|
|
56
|
+
"text-generation",
|
|
57
|
+
"text2text-generation",
|
|
58
|
+
"visual-question-answering",
|
|
59
|
+
"zero-shot-classification",
|
|
60
|
+
"zero-shot-image-classification"
|
|
61
|
+
],
|
|
44
62
|
mindspore: ["image-classification"]
|
|
45
63
|
};
|
|
46
64
|
|
|
@@ -3812,7 +3830,7 @@ var data_default34 = taskData34;
|
|
|
3812
3830
|
// src/tasks/index.ts
|
|
3813
3831
|
var TASKS_MODEL_LIBRARIES = {
|
|
3814
3832
|
"audio-classification": ["speechbrain", "transformers", "transformers.js"],
|
|
3815
|
-
"audio-to-audio": ["asteroid", "speechbrain"],
|
|
3833
|
+
"audio-to-audio": ["asteroid", "fairseq", "speechbrain"],
|
|
3816
3834
|
"automatic-speech-recognition": ["espnet", "nemo", "speechbrain", "transformers", "transformers.js"],
|
|
3817
3835
|
"depth-estimation": ["transformers", "transformers.js"],
|
|
3818
3836
|
"document-question-answering": ["transformers", "transformers.js"],
|
|
@@ -5288,7 +5306,7 @@ export {
|
|
|
5288
5306
|
ALL_DISPLAY_MODEL_LIBRARY_KEYS,
|
|
5289
5307
|
ALL_MODEL_LIBRARY_KEYS,
|
|
5290
5308
|
InferenceDisplayability,
|
|
5291
|
-
|
|
5309
|
+
LIBRARY_TASK_MAPPING,
|
|
5292
5310
|
MAPPING_DEFAULT_WIDGET,
|
|
5293
5311
|
MODALITIES,
|
|
5294
5312
|
MODALITY_LABELS,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { LIBRARY_TASK_MAPPING } from "./library-to-tasks";
|
|
2
2
|
export { MAPPING_DEFAULT_WIDGET } from "./default-widget-inputs";
|
|
3
3
|
export type { TaskData, TaskDemo, TaskDemoEntry, ExampleRepo } from "./tasks";
|
|
4
4
|
export * from "./tasks";
|
package/src/library-to-tasks.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { ModelLibraryKey } from "./model-libraries";
|
|
|
2
2
|
import type { PipelineType } from "./pipelines";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Mapping from library name
|
|
5
|
+
* Mapping from library name to its supported tasks.
|
|
6
6
|
* Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* This mapping is partially generated automatically by "python-api-export-tasks" action in
|
|
8
|
+
* huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually
|
|
9
|
+
* based on api-inference.
|
|
10
10
|
*/
|
|
11
|
-
export const
|
|
11
|
+
export const LIBRARY_TASK_MAPPING: Partial<Record<ModelLibraryKey, PipelineType[]>> = {
|
|
12
12
|
"adapter-transformers": ["question-answering", "text-classification", "token-classification"],
|
|
13
13
|
allennlp: ["question-answering"],
|
|
14
14
|
asteroid: [
|
|
@@ -44,5 +44,23 @@ export const LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS: Partial<Record<ModelLi
|
|
|
44
44
|
],
|
|
45
45
|
stanza: ["token-classification"],
|
|
46
46
|
timm: ["image-classification"],
|
|
47
|
+
transformers: [
|
|
48
|
+
"audio-classification",
|
|
49
|
+
"automatic-speech-recognition",
|
|
50
|
+
"depth-estimation",
|
|
51
|
+
"document-question-answering",
|
|
52
|
+
"fill-mask",
|
|
53
|
+
"image-classification",
|
|
54
|
+
"image-segmentation",
|
|
55
|
+
"image-to-text",
|
|
56
|
+
"image-to-image",
|
|
57
|
+
"object-detection",
|
|
58
|
+
"question-answering",
|
|
59
|
+
"text-generation",
|
|
60
|
+
"text2text-generation",
|
|
61
|
+
"visual-question-answering",
|
|
62
|
+
"zero-shot-classification",
|
|
63
|
+
"zero-shot-image-classification",
|
|
64
|
+
],
|
|
47
65
|
mindspore: ["image-classification"],
|
|
48
66
|
};
|
package/src/tasks/index.ts
CHANGED
|
@@ -112,7 +112,7 @@ import type { ModelLibraryKey } from "../model-libraries";
|
|
|
112
112
|
*/
|
|
113
113
|
export const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]> = {
|
|
114
114
|
"audio-classification": ["speechbrain", "transformers", "transformers.js"],
|
|
115
|
-
"audio-to-audio": ["asteroid", "speechbrain"],
|
|
115
|
+
"audio-to-audio": ["asteroid", "fairseq", "speechbrain"],
|
|
116
116
|
"automatic-speech-recognition": ["espnet", "nemo", "speechbrain", "transformers", "transformers.js"],
|
|
117
117
|
"depth-estimation": ["transformers", "transformers.js"],
|
|
118
118
|
"document-question-answering": ["transformers", "transformers.js"],
|