@huggingface/tasks 0.3.2 → 0.3.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.
package/dist/index.js CHANGED
@@ -1260,7 +1260,7 @@ var PIPELINE_DATA = {
1260
1260
  color: "green"
1261
1261
  },
1262
1262
  "image-text-to-text": {
1263
- name: "Image + Text to Text (VLLMs)",
1263
+ name: "Image-Text-to-Text",
1264
1264
  modality: "multimodal",
1265
1265
  color: "red",
1266
1266
  hideInDatasets: true
@@ -4406,6 +4406,41 @@ var pythae = (model) => [
4406
4406
 
4407
4407
  model = AutoModel.load_from_hf_hub("${model.id}")`
4408
4408
  ];
4409
+ var musicgen = (model) => [
4410
+ `from audiocraft.models import MusicGen
4411
+
4412
+ model = MusicGen.get_pretrained("${model.id}")
4413
+
4414
+ descriptions = ['happy rock', 'energetic EDM', 'sad jazz']
4415
+ wav = model.generate(descriptions) # generates 3 samples.`
4416
+ ];
4417
+ var magnet = (model) => [
4418
+ `from audiocraft.models import MAGNeT
4419
+
4420
+ model = MAGNeT.get_pretrained("${model.id}")
4421
+
4422
+ descriptions = ['disco beat', 'energetic EDM', 'funky groove']
4423
+ wav = model.generate(descriptions) # generates 3 samples.`
4424
+ ];
4425
+ var audiogen = (model) => [
4426
+ `from audiocraft.models import AudioGen
4427
+
4428
+ model = AudioGen.get_pretrained("${model.id}")
4429
+ model.set_generation_params(duration=5) # generate 5 seconds.
4430
+ descriptions = ['dog barking', 'sirene of an emergency vehicle', 'footsteps in a corridor']
4431
+ wav = model.generate(descriptions) # generates 3 samples.`
4432
+ ];
4433
+ var audiocraft = (model) => {
4434
+ if (model.tags?.includes("musicgen")) {
4435
+ return musicgen(model);
4436
+ } else if (model.tags?.includes("audiogen")) {
4437
+ return audiogen(model);
4438
+ } else if (model.tags?.includes("magnet")) {
4439
+ return magnet(model);
4440
+ } else {
4441
+ return [`# Type of model unknown.`];
4442
+ }
4443
+ };
4409
4444
 
4410
4445
  // src/model-libraries.ts
4411
4446
  var MODEL_LIBRARIES_UI_ELEMENTS = {
@@ -4439,6 +4474,13 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
4439
4474
  term: { path: "pytorch_model.bin" }
4440
4475
  }
4441
4476
  },
4477
+ audiocraft: {
4478
+ prettyLabel: "Audiocraft",
4479
+ repoName: "audiocraft",
4480
+ repoUrl: "https://github.com/facebookresearch/audiocraft",
4481
+ snippets: audiocraft,
4482
+ filter: false
4483
+ },
4442
4484
  bertopic: {
4443
4485
  prettyLabel: "BERTopic",
4444
4486
  repoName: "BERTopic",
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.3.2",
4
+ "version": "0.3.4",
5
5
  "description": "List of ML tasks for huggingface.co/tasks",
6
6
  "repository": "https://github.com/huggingface/huggingface.js.git",
7
7
  "publishConfig": {
package/src/model-data.ts CHANGED
@@ -54,7 +54,7 @@ export interface ModelData {
54
54
  base_model_name?: string;
55
55
  task_type?: string;
56
56
  };
57
- tokenizer?: TokenizerConfig;
57
+ tokenizer_config?: TokenizerConfig;
58
58
  };
59
59
  /**
60
60
  * all the model tags
@@ -80,7 +80,7 @@ export interface ModelData {
80
80
  */
81
81
  widgetData?: WidgetExample[] | undefined;
82
82
  /**
83
- * Parameters that will be used by the widget when calling Inference Endpoints (serverless)
83
+ * Parameters that will be used by the widget when calling Inference API (serverless)
84
84
  * https://huggingface.co/docs/api-inference/detailed_parameters
85
85
  *
86
86
  * can be set in the model card metadata (under `inference/parameters`)
@@ -548,4 +548,42 @@ export const pythae = (model: ModelData): string[] => [
548
548
  model = AutoModel.load_from_hf_hub("${model.id}")`,
549
549
  ];
550
550
 
551
+ const musicgen = (model: ModelData): string[] => [
552
+ `from audiocraft.models import MusicGen
553
+
554
+ model = MusicGen.get_pretrained("${model.id}")
555
+
556
+ descriptions = ['happy rock', 'energetic EDM', 'sad jazz']
557
+ wav = model.generate(descriptions) # generates 3 samples.`,
558
+ ];
559
+
560
+ const magnet = (model: ModelData): string[] => [
561
+ `from audiocraft.models import MAGNeT
562
+
563
+ model = MAGNeT.get_pretrained("${model.id}")
564
+
565
+ descriptions = ['disco beat', 'energetic EDM', 'funky groove']
566
+ wav = model.generate(descriptions) # generates 3 samples.`,
567
+ ];
568
+
569
+ const audiogen = (model: ModelData): string[] => [
570
+ `from audiocraft.models import AudioGen
571
+
572
+ model = AudioGen.get_pretrained("${model.id}")
573
+ model.set_generation_params(duration=5) # generate 5 seconds.
574
+ descriptions = ['dog barking', 'sirene of an emergency vehicle', 'footsteps in a corridor']
575
+ wav = model.generate(descriptions) # generates 3 samples.`,
576
+ ];
577
+
578
+ export const audiocraft = (model: ModelData): string[] => {
579
+ if (model.tags?.includes("musicgen")) {
580
+ return musicgen(model);
581
+ } else if (model.tags?.includes("audiogen")) {
582
+ return audiogen(model);
583
+ } else if (model.tags?.includes("magnet")) {
584
+ return magnet(model);
585
+ } else {
586
+ return [`# Type of model unknown.`];
587
+ }
588
+ };
551
589
  //#endregion
@@ -88,6 +88,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
88
88
  term: { path: "pytorch_model.bin" },
89
89
  },
90
90
  },
91
+ audiocraft: {
92
+ prettyLabel: "Audiocraft",
93
+ repoName: "audiocraft",
94
+ repoUrl: "https://github.com/facebookresearch/audiocraft",
95
+ snippets: snippets.audiocraft,
96
+ filter: false,
97
+ },
91
98
  bertopic: {
92
99
  prettyLabel: "BERTopic",
93
100
  repoName: "BERTopic",
package/src/pipelines.ts CHANGED
@@ -590,7 +590,7 @@ export const PIPELINE_DATA = {
590
590
  color: "green",
591
591
  },
592
592
  "image-text-to-text": {
593
- name: "Image + Text to Text (VLLMs)",
593
+ name: "Image-Text-to-Text",
594
594
  modality: "multimodal",
595
595
  color: "red",
596
596
  hideInDatasets: true,
@@ -36,6 +36,64 @@ import zeroShotClassification from "./zero-shot-classification/data";
36
36
  import zeroShotImageClassification from "./zero-shot-image-classification/data";
37
37
  import zeroShotObjectDetection from "./zero-shot-object-detection/data";
38
38
 
39
+ export type * from "./audio-classification/inference";
40
+ export type * from "./automatic-speech-recognition/inference";
41
+ export type * from "./document-question-answering/inference";
42
+ export type * from "./feature-extraction/inference";
43
+ export type * from "./fill-mask/inference";
44
+ export type {
45
+ ImageClassificationInput,
46
+ ImageClassificationOutput,
47
+ ImageClassificationOutputElement,
48
+ ImageClassificationParameters,
49
+ } from "./image-classification/inference";
50
+ export type * from "./image-to-image/inference";
51
+ export type { ImageToTextInput, ImageToTextOutput, ImageToTextParameters } from "./image-to-text/inference";
52
+ export type * from "./image-segmentation/inference";
53
+ export type * from "./object-detection/inference";
54
+ export type * from "./depth-estimation/inference";
55
+ export type * from "./question-answering/inference";
56
+ export type * from "./sentence-similarity/inference";
57
+ export type * from "./summarization/inference";
58
+ export type * from "./table-question-answering/inference";
59
+ export type { TextToImageInput, TextToImageOutput, TextToImageParameters } from "./text-to-image/inference";
60
+ export type { TextToAudioParameters, TextToSpeechInput, TextToSpeechOutput } from "./text-to-speech/inference";
61
+ export type * from "./token-classification/inference";
62
+ export type {
63
+ Text2TextGenerationParameters,
64
+ Text2TextGenerationTruncationStrategy,
65
+ TranslationInput,
66
+ TranslationOutput,
67
+ } from "./translation/inference";
68
+ export type {
69
+ ClassificationOutputTransform,
70
+ TextClassificationInput,
71
+ TextClassificationOutput,
72
+ TextClassificationOutputElement,
73
+ TextClassificationParameters,
74
+ } from "./text-classification/inference";
75
+ export type {
76
+ FinishReason,
77
+ PrefillToken,
78
+ TextGenerationInput,
79
+ TextGenerationOutput,
80
+ TextGenerationOutputDetails,
81
+ TextGenerationParameters,
82
+ TextGenerationSequenceDetails,
83
+ Token,
84
+ } from "./text-generation/inference";
85
+ export type * from "./video-classification/inference";
86
+ export type * from "./visual-question-answering/inference";
87
+ export type * from "./zero-shot-classification/inference";
88
+ export type * from "./zero-shot-image-classification/inference";
89
+ export type {
90
+ BoundingBox,
91
+ ZeroShotObjectDetectionInput,
92
+ ZeroShotObjectDetectionInputData,
93
+ ZeroShotObjectDetectionOutput,
94
+ ZeroShotObjectDetectionOutputElement,
95
+ } from "./zero-shot-object-detection/inference";
96
+
39
97
  import type { ModelLibraryKey } from "../model-libraries";
40
98
 
41
99
  /**
@@ -45,15 +45,12 @@ export interface Text2TextGenerationParameters {
45
45
  export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
46
46
 
47
47
  /**
48
- * Outputs for Summarization inference
49
- *
50
- * Outputs of inference for the Text2text Generation task
48
+ * Outputs of inference for the Summarization task
51
49
  */
52
50
  export interface SummarizationOutput {
53
- generatedText: unknown;
54
51
  /**
55
- * The generated text.
52
+ * The summarized text.
56
53
  */
57
- generated_text?: string;
54
+ summary_text: string;
58
55
  [property: string]: unknown;
59
56
  }
@@ -1,7 +1,14 @@
1
1
  {
2
- "$ref": "/inference/schemas/text2text-generation/output.json",
3
2
  "$id": "/inference/schemas/summarization/output.json",
4
3
  "$schema": "http://json-schema.org/draft-06/schema#",
4
+ "description": "Outputs of inference for the Summarization task",
5
5
  "title": "SummarizationOutput",
6
- "description": "Outputs for Summarization inference"
6
+ "type": "object",
7
+ "properties": {
8
+ "summary_text": {
9
+ "type": "string",
10
+ "description": "The summarized text."
11
+ }
12
+ },
13
+ "required": ["summary_text"]
7
14
  }
@@ -45,15 +45,12 @@ export interface Text2TextGenerationParameters {
45
45
  export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
46
46
 
47
47
  /**
48
- * Outputs for Translation inference
49
- *
50
- * Outputs of inference for the Text2text Generation task
48
+ * Outputs of inference for the Translation task
51
49
  */
52
50
  export interface TranslationOutput {
53
- generatedText: unknown;
54
51
  /**
55
- * The generated text.
52
+ * The translated text.
56
53
  */
57
- generated_text?: string;
54
+ translation_text: string;
58
55
  [property: string]: unknown;
59
56
  }
@@ -1,7 +1,14 @@
1
1
  {
2
- "$ref": "/inference/schemas/text2text-generation/output.json",
3
2
  "$id": "/inference/schemas/translation/output.json",
4
3
  "$schema": "http://json-schema.org/draft-06/schema#",
4
+ "description": "Outputs of inference for the Translation task",
5
5
  "title": "TranslationOutput",
6
- "description": "Outputs for Translation inference"
6
+ "type": "object",
7
+ "properties": {
8
+ "translation_text": {
9
+ "type": "string",
10
+ "description": "The translated text."
11
+ }
12
+ },
13
+ "required": ["translation_text"]
7
14
  }