@huggingface/tasks 0.16.7 → 0.17.1

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 (48) hide show
  1. package/dist/commonjs/index.d.ts +1 -3
  2. package/dist/commonjs/index.d.ts.map +1 -1
  3. package/dist/commonjs/index.js +5 -15
  4. package/dist/commonjs/model-libraries.d.ts +8 -1
  5. package/dist/commonjs/model-libraries.d.ts.map +1 -1
  6. package/dist/commonjs/model-libraries.js +7 -0
  7. package/dist/commonjs/snippets/index.d.ts +2 -5
  8. package/dist/commonjs/snippets/index.d.ts.map +1 -1
  9. package/dist/commonjs/snippets/index.js +2 -21
  10. package/dist/commonjs/snippets/inputs.d.ts.map +1 -1
  11. package/dist/commonjs/snippets/inputs.js +8 -3
  12. package/dist/esm/index.d.ts +1 -3
  13. package/dist/esm/index.d.ts.map +1 -1
  14. package/dist/esm/index.js +1 -2
  15. package/dist/esm/model-libraries.d.ts +8 -1
  16. package/dist/esm/model-libraries.d.ts.map +1 -1
  17. package/dist/esm/model-libraries.js +7 -0
  18. package/dist/esm/snippets/index.d.ts +2 -5
  19. package/dist/esm/snippets/index.d.ts.map +1 -1
  20. package/dist/esm/snippets/index.js +2 -5
  21. package/dist/esm/snippets/inputs.d.ts.map +1 -1
  22. package/dist/esm/snippets/inputs.js +8 -3
  23. package/package.json +1 -1
  24. package/src/index.ts +7 -3
  25. package/src/model-libraries.ts +7 -0
  26. package/src/snippets/index.ts +2 -6
  27. package/src/snippets/inputs.ts +9 -3
  28. package/dist/commonjs/snippets/curl.d.ts +0 -17
  29. package/dist/commonjs/snippets/curl.d.ts.map +0 -1
  30. package/dist/commonjs/snippets/curl.js +0 -129
  31. package/dist/commonjs/snippets/js.d.ts +0 -21
  32. package/dist/commonjs/snippets/js.d.ts.map +0 -1
  33. package/dist/commonjs/snippets/js.js +0 -413
  34. package/dist/commonjs/snippets/python.d.ts +0 -23
  35. package/dist/commonjs/snippets/python.d.ts.map +0 -1
  36. package/dist/commonjs/snippets/python.js +0 -435
  37. package/dist/esm/snippets/curl.d.ts +0 -17
  38. package/dist/esm/snippets/curl.d.ts.map +0 -1
  39. package/dist/esm/snippets/curl.js +0 -121
  40. package/dist/esm/snippets/js.d.ts +0 -21
  41. package/dist/esm/snippets/js.d.ts.map +0 -1
  42. package/dist/esm/snippets/js.js +0 -401
  43. package/dist/esm/snippets/python.d.ts +0 -23
  44. package/dist/esm/snippets/python.d.ts.map +0 -1
  45. package/dist/esm/snippets/python.js +0 -421
  46. package/src/snippets/curl.ts +0 -173
  47. package/src/snippets/js.ts +0 -471
  48. package/src/snippets/python.ts +0 -483
@@ -9,10 +9,8 @@ export type { ModelData, TransformersInfo } from "./model-data.js";
9
9
  export type { AddedToken, SpecialTokensMap, TokenizerConfig } from "./tokenizer-data.js";
10
10
  export type { WidgetExample, WidgetExampleAttribute, WidgetExampleAssetAndPromptInput, WidgetExampleAssetAndTextInput, WidgetExampleAssetAndZeroShotInput, WidgetExampleAssetInput, WidgetExampleChatInput, WidgetExampleSentenceSimilarityInput, WidgetExampleStructuredDataInput, WidgetExampleTableDataInput, WidgetExampleTextAndContextInput, WidgetExampleTextAndTableInput, WidgetExampleTextInput, WidgetExampleZeroShotTextInput, WidgetExampleOutput, WidgetExampleOutputUrl, WidgetExampleOutputLabels, WidgetExampleOutputAnswerScore, WidgetExampleOutputText, } from "./widget-example.js";
11
11
  export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data.js";
12
- import * as snippets from "./snippets/index.js";
13
12
  export * from "./gguf.js";
14
- export { snippets };
15
- export type { InferenceSnippet } from "./snippets/index.js";
13
+ export { type InferenceSnippet, type ModelDataMinimal, stringifyGenerationConfig, stringifyMessages, getModelInputSnippet, } from "./snippets/index.js";
16
14
  export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware.js";
17
15
  export type { HardwareSpec, SkuType } from "./hardware.js";
18
16
  export { LOCAL_APPS } from "./local-apps.js";
@@ -1 +1 @@
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ACX,aAAa,EACb,sBAAsB,EACtB,gCAAgC,EAChC,8BAA8B,EAC9B,kCAAkC,EAClC,uBAAuB,EACvB,sBAAsB,EACtB,oCAAoC,EACpC,gCAAgC,EAChC,2BAA2B,EAC3B,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,uBAAuB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,cAAc,WAAW,CAAC;AAE1B,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,cAAc,0BAA0B,CAAC"}
@@ -10,23 +10,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
15
  };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
16
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.DATASET_LIBRARIES_UI_ELEMENTS = exports.LOCAL_APPS = exports.DEFAULT_MEMORY_OPTIONS = exports.SKUS = exports.snippets = exports.SPECIAL_TOKENS_ATTRIBUTES = exports.MODEL_LIBRARIES_UI_ELEMENTS = exports.ALL_MODEL_LIBRARY_KEYS = exports.ALL_DISPLAY_MODEL_LIBRARY_KEYS = exports.PIPELINE_TYPES_SET = exports.SUBTASK_TYPES = exports.MODALITY_LABELS = exports.MODALITIES = exports.PIPELINE_TYPES = exports.PIPELINE_DATA = exports.MAPPING_DEFAULT_WIDGET = exports.LIBRARY_TASK_MAPPING = void 0;
17
+ exports.DATASET_LIBRARIES_UI_ELEMENTS = exports.LOCAL_APPS = exports.DEFAULT_MEMORY_OPTIONS = exports.SKUS = exports.getModelInputSnippet = exports.stringifyMessages = exports.stringifyGenerationConfig = exports.SPECIAL_TOKENS_ATTRIBUTES = exports.MODEL_LIBRARIES_UI_ELEMENTS = exports.ALL_MODEL_LIBRARY_KEYS = exports.ALL_DISPLAY_MODEL_LIBRARY_KEYS = exports.PIPELINE_TYPES_SET = exports.SUBTASK_TYPES = exports.MODALITY_LABELS = exports.MODALITIES = exports.PIPELINE_TYPES = exports.PIPELINE_DATA = exports.MAPPING_DEFAULT_WIDGET = exports.LIBRARY_TASK_MAPPING = void 0;
30
18
  var library_to_tasks_js_1 = require("./library-to-tasks.js");
31
19
  Object.defineProperty(exports, "LIBRARY_TASK_MAPPING", { enumerable: true, get: function () { return library_to_tasks_js_1.LIBRARY_TASK_MAPPING; } });
32
20
  var default_widget_inputs_js_1 = require("./default-widget-inputs.js");
@@ -45,9 +33,11 @@ Object.defineProperty(exports, "ALL_MODEL_LIBRARY_KEYS", { enumerable: true, get
45
33
  Object.defineProperty(exports, "MODEL_LIBRARIES_UI_ELEMENTS", { enumerable: true, get: function () { return model_libraries_js_1.MODEL_LIBRARIES_UI_ELEMENTS; } });
46
34
  var tokenizer_data_js_1 = require("./tokenizer-data.js");
47
35
  Object.defineProperty(exports, "SPECIAL_TOKENS_ATTRIBUTES", { enumerable: true, get: function () { return tokenizer_data_js_1.SPECIAL_TOKENS_ATTRIBUTES; } });
48
- const snippets = __importStar(require("./snippets/index.js"));
49
- exports.snippets = snippets;
50
36
  __exportStar(require("./gguf.js"), exports);
37
+ var index_js_1 = require("./snippets/index.js");
38
+ Object.defineProperty(exports, "stringifyGenerationConfig", { enumerable: true, get: function () { return index_js_1.stringifyGenerationConfig; } });
39
+ Object.defineProperty(exports, "stringifyMessages", { enumerable: true, get: function () { return index_js_1.stringifyMessages; } });
40
+ Object.defineProperty(exports, "getModelInputSnippet", { enumerable: true, get: function () { return index_js_1.getModelInputSnippet; } });
51
41
  var hardware_js_1 = require("./hardware.js");
52
42
  Object.defineProperty(exports, "SKUS", { enumerable: true, get: function () { return hardware_js_1.SKUS; } });
53
43
  Object.defineProperty(exports, "DEFAULT_MEMORY_OPTIONS", { enumerable: true, get: function () { return hardware_js_1.DEFAULT_MEMORY_OPTIONS; } });
@@ -485,6 +485,13 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
485
485
  filter: false;
486
486
  countDownloads: string;
487
487
  };
488
+ medvae: {
489
+ prettyLabel: string;
490
+ repoName: string;
491
+ repoUrl: string;
492
+ filter: false;
493
+ countDownloads: string;
494
+ };
488
495
  mitie: {
489
496
  prettyLabel: string;
490
497
  repoName: string;
@@ -920,5 +927,5 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
920
927
  };
921
928
  export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
922
929
  export declare const ALL_MODEL_LIBRARY_KEYS: ModelLibraryKey[];
923
- export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "asteroid" | "audiocraft" | "audioseal" | "ben2" | "bertopic" | "big_vision" | "birder" | "birefnet" | "bm25s" | "champ" | "chat_tts" | "colpali" | "comet" | "cosmos" | "cxr-foundation" | "deepforest" | "depth-anything-v2" | "depth-pro" | "derm-foundation" | "diffree" | "diffusers" | "diffusionkit" | "doctr" | "cartesia_pytorch" | "cartesia_mlx" | "clipscope" | "cosyvoice" | "cotracker" | "edsnlp" | "elm" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gemma.cpp" | "gliner" | "glyph-byt5" | "grok" | "hallo" | "hezar" | "htrflow" | "hunyuan-dit" | "hunyuan3d-2" | "imstoucan" | "keras" | "tf-keras" | "keras-hub" | "k2" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "mesh-anything" | "merlin" | "mitie" | "ml-agents" | "mlx" | "mlx-image" | "mlc-llm" | "model2vec" | "moshi" | "nemo" | "open-oasis" | "open_clip" | "paddlenlp" | "peft" | "pxia" | "pyannote-audio" | "py-feat" | "pythae" | "recurrentgemma" | "relik" | "refiners" | "reverb" | "saelens" | "sam2" | "sample-factory" | "sapiens" | "sentence-transformers" | "setfit" | "sklearn" | "spacy" | "span-marker" | "speechbrain" | "ssr-speech" | "stable-audio-tools" | "diffusion-single-file" | "seed-story" | "soloaudio" | "stable-baselines3" | "stanza" | "swarmformer" | "f5-tts" | "genmo" | "tensorflowtts" | "tabpfn" | "terratorch" | "tic-clip" | "timesfm" | "timm" | "transformers" | "transformers.js" | "trellis" | "ultralytics" | "unity-sentis" | "sana" | "vfi-mamba" | "voicecraft" | "whisperkit" | "yolov10" | "3dtopia-xl")[];
930
+ export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "asteroid" | "audiocraft" | "audioseal" | "ben2" | "bertopic" | "big_vision" | "birder" | "birefnet" | "bm25s" | "champ" | "chat_tts" | "colpali" | "comet" | "cosmos" | "cxr-foundation" | "deepforest" | "depth-anything-v2" | "depth-pro" | "derm-foundation" | "diffree" | "diffusers" | "diffusionkit" | "doctr" | "cartesia_pytorch" | "cartesia_mlx" | "clipscope" | "cosyvoice" | "cotracker" | "edsnlp" | "elm" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gemma.cpp" | "gliner" | "glyph-byt5" | "grok" | "hallo" | "hezar" | "htrflow" | "hunyuan-dit" | "hunyuan3d-2" | "imstoucan" | "keras" | "tf-keras" | "keras-hub" | "k2" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "mesh-anything" | "merlin" | "medvae" | "mitie" | "ml-agents" | "mlx" | "mlx-image" | "mlc-llm" | "model2vec" | "moshi" | "nemo" | "open-oasis" | "open_clip" | "paddlenlp" | "peft" | "pxia" | "pyannote-audio" | "py-feat" | "pythae" | "recurrentgemma" | "relik" | "refiners" | "reverb" | "saelens" | "sam2" | "sample-factory" | "sapiens" | "sentence-transformers" | "setfit" | "sklearn" | "spacy" | "span-marker" | "speechbrain" | "ssr-speech" | "stable-audio-tools" | "diffusion-single-file" | "seed-story" | "soloaudio" | "stable-baselines3" | "stanza" | "swarmformer" | "f5-tts" | "genmo" | "tensorflowtts" | "tabpfn" | "terratorch" | "tic-clip" | "timesfm" | "timm" | "transformers" | "transformers.js" | "trellis" | "ultralytics" | "unity-sentis" | "sana" | "vfi-mamba" | "voicecraft" | "whisperkit" | "yolov10" | "3dtopia-xl")[];
924
931
  //# sourceMappingURL=model-libraries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-libraries.d.ts","sourceRoot":"","sources":["../../src/model-libraries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE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vae: {
477
+ prettyLabel: "MedVAE",
478
+ repoName: "MedVAE",
479
+ repoUrl: "https://github.com/StanfordMIMI/MedVAE",
480
+ filter: false,
481
+ countDownloads: `path_extension:"ckpt"`,
482
+ },
476
483
  mitie: {
477
484
  prettyLabel: "MITIE",
478
485
  repoName: "MITIE",
@@ -1,7 +1,4 @@
1
- import * as inputs from "./inputs.js";
2
- import * as curl from "./curl.js";
3
- import * as python from "./python.js";
4
- import * as js from "./js.js";
1
+ export * from "./common.js";
2
+ export * from "./inputs.js";
5
3
  export * from "./types.js";
6
- export { inputs, curl, python, js };
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/snippets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/snippets/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -10,29 +10,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
15
  };
28
16
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.js = exports.python = exports.curl = exports.inputs = void 0;
30
- const inputs = __importStar(require("./inputs.js"));
31
- exports.inputs = inputs;
32
- const curl = __importStar(require("./curl.js"));
33
- exports.curl = curl;
34
- const python = __importStar(require("./python.js"));
35
- exports.python = python;
36
- const js = __importStar(require("./js.js"));
37
- exports.js = js;
17
+ __exportStar(require("./common.js"), exports);
18
+ __exportStar(require("./inputs.js"), exports);
38
19
  __exportStar(require("./types.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/snippets/inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgJnD,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,gBAAgB,EACvB,MAAM,UAAQ,EACd,QAAQ,UAAQ,GACd,MAAM,GAAG,0BAA0B,EAAE,CAmBvC"}
1
+ {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/snippets/inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAsJnD,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,gBAAgB,EACvB,MAAM,UAAQ,EACd,QAAQ,UAAQ,GACd,MAAM,GAAG,0BAA0B,EAAE,CAmBvC"}
@@ -18,9 +18,9 @@ const inputsTableQuestionAnswering = () => `{
18
18
  }
19
19
  }`;
20
20
  const inputsVisualQuestionAnswering = () => `{
21
- "image": "cat.png",
22
- "question": "What is in this image?"
23
- }`;
21
+ "image": "cat.png",
22
+ "question": "What is in this image?"
23
+ }`;
24
24
  const inputsQuestionAnswering = () => `{
25
25
  "question": "What is my name?",
26
26
  "context": "My name is Clara and I live in Berkeley."
@@ -64,6 +64,10 @@ const inputsSentenceSimilarity = () => `{
64
64
  const inputsFeatureExtraction = () => `"Today is a sunny day and I will get some ice cream."`;
65
65
  const inputsImageClassification = () => `"cats.jpg"`;
66
66
  const inputsImageToText = () => `"cats.jpg"`;
67
+ const inputsImageToImage = () => `{
68
+ "image": "cat.png",
69
+ "prompt": "Turn the cat into a tiger."
70
+ }`;
67
71
  const inputsImageSegmentation = () => `"cats.jpg"`;
68
72
  const inputsObjectDetection = () => `"cats.jpg"`;
69
73
  const inputsAudioToAudio = () => `"sample1.flac"`;
@@ -84,6 +88,7 @@ const modelInputSnippets = {
84
88
  "fill-mask": inputsFillMask,
85
89
  "image-classification": inputsImageClassification,
86
90
  "image-to-text": inputsImageToText,
91
+ "image-to-image": inputsImageToImage,
87
92
  "image-segmentation": inputsImageSegmentation,
88
93
  "object-detection": inputsObjectDetection,
89
94
  "question-answering": inputsQuestionAnswering,
@@ -9,10 +9,8 @@ export type { ModelData, TransformersInfo } from "./model-data.js";
9
9
  export type { AddedToken, SpecialTokensMap, TokenizerConfig } from "./tokenizer-data.js";
10
10
  export type { WidgetExample, WidgetExampleAttribute, WidgetExampleAssetAndPromptInput, WidgetExampleAssetAndTextInput, WidgetExampleAssetAndZeroShotInput, WidgetExampleAssetInput, WidgetExampleChatInput, WidgetExampleSentenceSimilarityInput, WidgetExampleStructuredDataInput, WidgetExampleTableDataInput, WidgetExampleTextAndContextInput, WidgetExampleTextAndTableInput, WidgetExampleTextInput, WidgetExampleZeroShotTextInput, WidgetExampleOutput, WidgetExampleOutputUrl, WidgetExampleOutputLabels, WidgetExampleOutputAnswerScore, WidgetExampleOutputText, } from "./widget-example.js";
11
11
  export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data.js";
12
- import * as snippets from "./snippets/index.js";
13
12
  export * from "./gguf.js";
14
- export { snippets };
15
- export type { InferenceSnippet } from "./snippets/index.js";
13
+ export { type InferenceSnippet, type ModelDataMinimal, stringifyGenerationConfig, stringifyMessages, getModelInputSnippet, } from "./snippets/index.js";
16
14
  export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware.js";
17
15
  export type { HardwareSpec, SkuType } from "./hardware.js";
18
16
  export { LOCAL_APPS } from "./local-apps.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvF,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACN,aAAa,EACb,cAAc,EACd,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,kBAAkB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,8BAA8B,EAC9B,sBAAsB,EACtB,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC9E,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzF,YAAY,EACX,aAAa,EACb,sBAAsB,EACtB,gCAAgC,EAChC,8BAA8B,EAC9B,kCAAkC,EAClC,uBAAuB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,EAAE,MAAM,wBAAwB,CAAC;AAEzF,cAAc,0BAA0B,CAAC"}
package/dist/esm/index.js CHANGED
@@ -4,9 +4,8 @@ export * from "./tasks/index.js";
4
4
  export { PIPELINE_DATA, PIPELINE_TYPES, MODALITIES, MODALITY_LABELS, SUBTASK_TYPES, PIPELINE_TYPES_SET, } from "./pipelines.js";
5
5
  export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, MODEL_LIBRARIES_UI_ELEMENTS, } from "./model-libraries.js";
6
6
  export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data.js";
7
- import * as snippets from "./snippets/index.js";
8
7
  export * from "./gguf.js";
9
- export { snippets };
8
+ export { stringifyGenerationConfig, stringifyMessages, getModelInputSnippet, } from "./snippets/index.js";
10
9
  export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware.js";
11
10
  export { LOCAL_APPS } from "./local-apps.js";
12
11
  export { DATASET_LIBRARIES_UI_ELEMENTS } from "./dataset-libraries.js";
@@ -485,6 +485,13 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
485
485
  filter: false;
486
486
  countDownloads: string;
487
487
  };
488
+ medvae: {
489
+ prettyLabel: string;
490
+ repoName: string;
491
+ repoUrl: string;
492
+ filter: false;
493
+ countDownloads: string;
494
+ };
488
495
  mitie: {
489
496
  prettyLabel: string;
490
497
  repoName: string;
@@ -920,5 +927,5 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
920
927
  };
921
928
  export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
922
929
  export declare const ALL_MODEL_LIBRARY_KEYS: ModelLibraryKey[];
923
- export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "asteroid" | "audiocraft" | "audioseal" | "ben2" | "bertopic" | "big_vision" | "birder" | "birefnet" | "bm25s" | "champ" | "chat_tts" | "colpali" | "comet" | "cosmos" | "cxr-foundation" | "deepforest" | "depth-anything-v2" | "depth-pro" | "derm-foundation" | "diffree" | "diffusers" | "diffusionkit" | "doctr" | "cartesia_pytorch" | "cartesia_mlx" | "clipscope" | "cosyvoice" | "cotracker" | "edsnlp" | "elm" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gemma.cpp" | "gliner" | "glyph-byt5" | "grok" | "hallo" | "hezar" | "htrflow" | "hunyuan-dit" | "hunyuan3d-2" | "imstoucan" | "keras" | "tf-keras" | "keras-hub" | "k2" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "mesh-anything" | "merlin" | "mitie" | "ml-agents" | "mlx" | "mlx-image" | "mlc-llm" | "model2vec" | "moshi" | "nemo" | "open-oasis" | "open_clip" | "paddlenlp" | "peft" | "pxia" | "pyannote-audio" | "py-feat" | "pythae" | "recurrentgemma" | "relik" | "refiners" | "reverb" | "saelens" | "sam2" | "sample-factory" | "sapiens" | "sentence-transformers" | "setfit" | "sklearn" | "spacy" | "span-marker" | "speechbrain" | "ssr-speech" | "stable-audio-tools" | "diffusion-single-file" | "seed-story" | "soloaudio" | "stable-baselines3" | "stanza" | "swarmformer" | "f5-tts" | "genmo" | "tensorflowtts" | "tabpfn" | "terratorch" | "tic-clip" | "timesfm" | "timm" | "transformers" | "transformers.js" | "trellis" | "ultralytics" | "unity-sentis" | "sana" | "vfi-mamba" | "voicecraft" | "whisperkit" | "yolov10" | "3dtopia-xl")[];
930
+ export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "asteroid" | "audiocraft" | "audioseal" | "ben2" | "bertopic" | "big_vision" | "birder" | "birefnet" | "bm25s" | "champ" | "chat_tts" | "colpali" | "comet" | "cosmos" | "cxr-foundation" | "deepforest" | "depth-anything-v2" | "depth-pro" | "derm-foundation" | "diffree" | "diffusers" | "diffusionkit" | "doctr" | "cartesia_pytorch" | "cartesia_mlx" | "clipscope" | "cosyvoice" | "cotracker" | "edsnlp" | "elm" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gemma.cpp" | "gliner" | "glyph-byt5" | "grok" | "hallo" | "hezar" | "htrflow" | "hunyuan-dit" | "hunyuan3d-2" | "imstoucan" | "keras" | "tf-keras" | "keras-hub" | "k2" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "mesh-anything" | "merlin" | "medvae" | "mitie" | "ml-agents" | "mlx" | "mlx-image" | "mlc-llm" | "model2vec" | "moshi" | "nemo" | "open-oasis" | "open_clip" | "paddlenlp" | "peft" | "pxia" | "pyannote-audio" | "py-feat" | "pythae" | "recurrentgemma" | "relik" | "refiners" | "reverb" | "saelens" | "sam2" | "sample-factory" | "sapiens" | "sentence-transformers" | "setfit" | "sklearn" | "spacy" | "span-marker" | "speechbrain" | "ssr-speech" | "stable-audio-tools" | "diffusion-single-file" | "seed-story" | "soloaudio" | "stable-baselines3" | "stanza" | "swarmformer" | "f5-tts" | "genmo" | "tensorflowtts" | "tabpfn" | "terratorch" | "tic-clip" | "timesfm" | "timm" | "transformers" | "transformers.js" | "trellis" | "ultralytics" | "unity-sentis" | "sana" | "vfi-mamba" | "voicecraft" | "whisperkit" | "yolov10" | "3dtopia-xl")[];
924
931
  //# sourceMappingURL=model-libraries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-libraries.d.ts","sourceRoot":"","sources":["../../src/model-libraries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA62BI,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAEvE,eAAO,MAAM,sBAAsB,EAA+C,eAAe,EAAE,CAAC;AAEpG,eAAO,MAAM,8BAA8B,mlDAQ1B,CAAC"}
@@ -447,6 +447,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
447
447
  filter: false,
448
448
  countDownloads: `path_extension:"pt"`,
449
449
  },
450
+ medvae: {
451
+ prettyLabel: "MedVAE",
452
+ repoName: "MedVAE",
453
+ repoUrl: "https://github.com/StanfordMIMI/MedVAE",
454
+ filter: false,
455
+ countDownloads: `path_extension:"ckpt"`,
456
+ },
450
457
  mitie: {
451
458
  prettyLabel: "MITIE",
452
459
  repoName: "MITIE",
@@ -1,7 +1,4 @@
1
- import * as inputs from "./inputs.js";
2
- import * as curl from "./curl.js";
3
- import * as python from "./python.js";
4
- import * as js from "./js.js";
1
+ export * from "./common.js";
2
+ export * from "./inputs.js";
5
3
  export * from "./types.js";
6
- export { inputs, curl, python, js };
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/snippets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/snippets/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -1,6 +1,3 @@
1
- import * as inputs from "./inputs.js";
2
- import * as curl from "./curl.js";
3
- import * as python from "./python.js";
4
- import * as js from "./js.js";
1
+ export * from "./common.js";
2
+ export * from "./inputs.js";
5
3
  export * from "./types.js";
6
- export { inputs, curl, python, js };
@@ -1 +1 @@
1
- {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/snippets/inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgJnD,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,gBAAgB,EACvB,MAAM,UAAQ,EACd,QAAQ,UAAQ,GACd,MAAM,GAAG,0BAA0B,EAAE,CAmBvC"}
1
+ {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/snippets/inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAsJnD,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,gBAAgB,EACvB,MAAM,UAAQ,EACd,QAAQ,UAAQ,GACd,MAAM,GAAG,0BAA0B,EAAE,CAmBvC"}
@@ -15,9 +15,9 @@ const inputsTableQuestionAnswering = () => `{
15
15
  }
16
16
  }`;
17
17
  const inputsVisualQuestionAnswering = () => `{
18
- "image": "cat.png",
19
- "question": "What is in this image?"
20
- }`;
18
+ "image": "cat.png",
19
+ "question": "What is in this image?"
20
+ }`;
21
21
  const inputsQuestionAnswering = () => `{
22
22
  "question": "What is my name?",
23
23
  "context": "My name is Clara and I live in Berkeley."
@@ -61,6 +61,10 @@ const inputsSentenceSimilarity = () => `{
61
61
  const inputsFeatureExtraction = () => `"Today is a sunny day and I will get some ice cream."`;
62
62
  const inputsImageClassification = () => `"cats.jpg"`;
63
63
  const inputsImageToText = () => `"cats.jpg"`;
64
+ const inputsImageToImage = () => `{
65
+ "image": "cat.png",
66
+ "prompt": "Turn the cat into a tiger."
67
+ }`;
64
68
  const inputsImageSegmentation = () => `"cats.jpg"`;
65
69
  const inputsObjectDetection = () => `"cats.jpg"`;
66
70
  const inputsAudioToAudio = () => `"sample1.flac"`;
@@ -81,6 +85,7 @@ const modelInputSnippets = {
81
85
  "fill-mask": inputsFillMask,
82
86
  "image-classification": inputsImageClassification,
83
87
  "image-to-text": inputsImageToText,
88
+ "image-to-image": inputsImageToImage,
84
89
  "image-segmentation": inputsImageSegmentation,
85
90
  "object-detection": inputsObjectDetection,
86
91
  "question-answering": inputsQuestionAnswering,
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.16.7",
4
+ "version": "0.17.1",
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/index.ts CHANGED
@@ -45,11 +45,15 @@ export type {
45
45
  } from "./widget-example.js";
46
46
  export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data.js";
47
47
 
48
- import * as snippets from "./snippets/index.js";
49
48
  export * from "./gguf.js";
50
49
 
51
- export { snippets };
52
- export type { InferenceSnippet } from "./snippets/index.js";
50
+ export {
51
+ type InferenceSnippet,
52
+ type ModelDataMinimal,
53
+ stringifyGenerationConfig,
54
+ stringifyMessages,
55
+ getModelInputSnippet,
56
+ } from "./snippets/index.js";
53
57
 
54
58
  export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware.js";
55
59
  export type { HardwareSpec, SkuType } from "./hardware.js";
@@ -491,6 +491,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
491
491
  filter: false,
492
492
  countDownloads: `path_extension:"pt"`,
493
493
  },
494
+ medvae: {
495
+ prettyLabel: "MedVAE",
496
+ repoName: "MedVAE",
497
+ repoUrl: "https://github.com/StanfordMIMI/MedVAE",
498
+ filter: false,
499
+ countDownloads: `path_extension:"ckpt"`,
500
+ },
494
501
  mitie: {
495
502
  prettyLabel: "MITIE",
496
503
  repoName: "MITIE",
@@ -1,7 +1,3 @@
1
- import * as inputs from "./inputs.js";
2
- import * as curl from "./curl.js";
3
- import * as python from "./python.js";
4
- import * as js from "./js.js";
1
+ export * from "./common.js";
2
+ export * from "./inputs.js";
5
3
  export * from "./types.js";
6
-
7
- export { inputs, curl, python, js };
@@ -27,9 +27,9 @@ const inputsTableQuestionAnswering = () =>
27
27
 
28
28
  const inputsVisualQuestionAnswering = () =>
29
29
  `{
30
- "image": "cat.png",
31
- "question": "What is in this image?"
32
- }`;
30
+ "image": "cat.png",
31
+ "question": "What is in this image?"
32
+ }`;
33
33
 
34
34
  const inputsQuestionAnswering = () =>
35
35
  `{
@@ -86,6 +86,11 @@ const inputsImageClassification = () => `"cats.jpg"`;
86
86
 
87
87
  const inputsImageToText = () => `"cats.jpg"`;
88
88
 
89
+ const inputsImageToImage = () => `{
90
+ "image": "cat.png",
91
+ "prompt": "Turn the cat into a tiger."
92
+ }`;
93
+
89
94
  const inputsImageSegmentation = () => `"cats.jpg"`;
90
95
 
91
96
  const inputsObjectDetection = () => `"cats.jpg"`;
@@ -120,6 +125,7 @@ const modelInputSnippets: {
120
125
  "fill-mask": inputsFillMask,
121
126
  "image-classification": inputsImageClassification,
122
127
  "image-to-text": inputsImageToText,
128
+ "image-to-image": inputsImageToImage,
123
129
  "image-segmentation": inputsImageSegmentation,
124
130
  "object-detection": inputsObjectDetection,
125
131
  "question-answering": inputsQuestionAnswering,
@@ -1,17 +0,0 @@
1
- import { type SnippetInferenceProvider } from "../inference-providers.js";
2
- import type { PipelineType } from "../pipelines.js";
3
- import type { ChatCompletionInputMessage, GenerationParameters } from "../tasks/index.js";
4
- import type { InferenceSnippet, ModelDataMinimal } from "./types.js";
5
- export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
6
- export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: {
7
- streaming?: boolean;
8
- messages?: ChatCompletionInputMessage[];
9
- temperature?: GenerationParameters["temperature"];
10
- max_tokens?: GenerationParameters["max_tokens"];
11
- top_p?: GenerationParameters["top_p"];
12
- }) => InferenceSnippet[];
13
- export declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
14
- export declare const snippetFile: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
15
- export declare const curlSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
16
- export declare function getCurlInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>): InferenceSnippet[];
17
- //# sourceMappingURL=curl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../src/snippets/curl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAErE,eAAO,MAAM,YAAY,UACjB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAelB,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAC1B,gBAAgB,eACV,MAAM,YACT,wBAAwB,oBAChB,MAAM,SACjB;IACN,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACxC,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAClD,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CACtC,KACC,gBAAgB,EA2ClB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAclB,CAAC;AAEF,eAAO,MAAM,WAAW,UAChB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAalB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAAO,CACjC,MAAM,CACL,YAAY,EACZ,CACC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,gBAAgB,EAAE,CACvB,CA0BD,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CAIpB"}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.curlSnippets = exports.snippetFile = exports.snippetZeroShotClassification = exports.snippetTextGeneration = exports.snippetBasic = void 0;
4
- exports.getCurlInferenceSnippet = getCurlInferenceSnippet;
5
- const inference_providers_js_1 = require("../inference-providers.js");
6
- const common_js_1 = require("./common.js");
7
- const inputs_js_1 = require("./inputs.js");
8
- const snippetBasic = (model, accessToken, provider) => {
9
- if (provider !== "hf-inference") {
10
- return [];
11
- }
12
- return [
13
- {
14
- client: "curl",
15
- content: `\
16
- curl https://router.huggingface.co/hf-inference/models/${model.id} \\
17
- -X POST \\
18
- -d '{"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model, true)}}' \\
19
- -H 'Content-Type: application/json' \\
20
- -H 'Authorization: Bearer ${accessToken || `{API_TOKEN}`}'`,
21
- },
22
- ];
23
- };
24
- exports.snippetBasic = snippetBasic;
25
- const snippetTextGeneration = (model, accessToken, provider, providerModelId, opts) => {
26
- if (model.tags.includes("conversational")) {
27
- const baseUrl = provider === "hf-inference"
28
- ? `https://router.huggingface.co/hf-inference/models/${model.id}/v1/chat/completions`
29
- : inference_providers_js_1.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider) + "/v1/chat/completions";
30
- const modelId = providerModelId ?? model.id;
31
- // Conversational model detected, so we display a code snippet that features the Messages API
32
- const streaming = opts?.streaming ?? true;
33
- const exampleMessages = (0, inputs_js_1.getModelInputSnippet)(model);
34
- const messages = opts?.messages ?? exampleMessages;
35
- const config = {
36
- ...(opts?.temperature ? { temperature: opts.temperature } : undefined),
37
- max_tokens: opts?.max_tokens ?? 500,
38
- ...(opts?.top_p ? { top_p: opts.top_p } : undefined),
39
- };
40
- return [
41
- {
42
- client: "curl",
43
- content: `curl '${baseUrl}' \\
44
- -H 'Authorization: Bearer ${accessToken || `{API_TOKEN}`}' \\
45
- -H 'Content-Type: application/json' \\
46
- --data '{
47
- "model": "${modelId}",
48
- "messages": ${(0, common_js_1.stringifyMessages)(messages, {
49
- indent: "\t",
50
- attributeKeyQuotes: true,
51
- customContentEscaper: (str) => str.replace(/'/g, "'\\''"),
52
- })},
53
- ${(0, common_js_1.stringifyGenerationConfig)(config, {
54
- indent: "\n ",
55
- attributeKeyQuotes: true,
56
- attributeValueConnector: ": ",
57
- })}
58
- "stream": ${!!streaming}
59
- }'`,
60
- },
61
- ];
62
- }
63
- else {
64
- return (0, exports.snippetBasic)(model, accessToken, provider);
65
- }
66
- };
67
- exports.snippetTextGeneration = snippetTextGeneration;
68
- const snippetZeroShotClassification = (model, accessToken, provider) => {
69
- if (provider !== "hf-inference") {
70
- return [];
71
- }
72
- return [
73
- {
74
- client: "curl",
75
- content: `curl https://router.huggingface.co/hf-inference/models/${model.id} \\
76
- -X POST \\
77
- -d '{"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model, true)}, "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}' \\
78
- -H 'Content-Type: application/json' \\
79
- -H 'Authorization: Bearer ${accessToken || `{API_TOKEN}`}'`,
80
- },
81
- ];
82
- };
83
- exports.snippetZeroShotClassification = snippetZeroShotClassification;
84
- const snippetFile = (model, accessToken, provider) => {
85
- if (provider !== "hf-inference") {
86
- return [];
87
- }
88
- return [
89
- {
90
- client: "curl",
91
- content: `curl https://router.huggingface.co/hf-inference/models/${model.id} \\
92
- -X POST \\
93
- --data-binary '@${(0, inputs_js_1.getModelInputSnippet)(model, true, true)}' \\
94
- -H 'Authorization: Bearer ${accessToken || `{API_TOKEN}`}'`,
95
- },
96
- ];
97
- };
98
- exports.snippetFile = snippetFile;
99
- exports.curlSnippets = {
100
- // Same order as in tasks/src/pipelines.ts
101
- "text-classification": exports.snippetBasic,
102
- "token-classification": exports.snippetBasic,
103
- "table-question-answering": exports.snippetBasic,
104
- "question-answering": exports.snippetBasic,
105
- "zero-shot-classification": exports.snippetZeroShotClassification,
106
- translation: exports.snippetBasic,
107
- summarization: exports.snippetBasic,
108
- "feature-extraction": exports.snippetBasic,
109
- "text-generation": exports.snippetTextGeneration,
110
- "image-text-to-text": exports.snippetTextGeneration,
111
- "text2text-generation": exports.snippetBasic,
112
- "fill-mask": exports.snippetBasic,
113
- "sentence-similarity": exports.snippetBasic,
114
- "automatic-speech-recognition": exports.snippetFile,
115
- "text-to-image": exports.snippetBasic,
116
- "text-to-speech": exports.snippetBasic,
117
- "text-to-audio": exports.snippetBasic,
118
- "audio-to-audio": exports.snippetFile,
119
- "audio-classification": exports.snippetFile,
120
- "image-classification": exports.snippetFile,
121
- "image-to-text": exports.snippetFile,
122
- "object-detection": exports.snippetFile,
123
- "image-segmentation": exports.snippetFile,
124
- };
125
- function getCurlInferenceSnippet(model, accessToken, provider, providerModelId, opts) {
126
- return model.pipeline_tag && model.pipeline_tag in exports.curlSnippets
127
- ? exports.curlSnippets[model.pipeline_tag]?.(model, accessToken, provider, providerModelId, opts) ?? []
128
- : [];
129
- }