@huggingface/tasks 0.15.8 → 0.15.9

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 (75) hide show
  1. package/dist/commonjs/inference-providers.d.ts +5 -4
  2. package/dist/commonjs/inference-providers.d.ts.map +1 -1
  3. package/dist/commonjs/inference-providers.js +15 -6
  4. package/dist/commonjs/library-to-tasks.d.ts +1 -1
  5. package/dist/commonjs/library-to-tasks.js +1 -1
  6. package/dist/commonjs/model-libraries-snippets.d.ts +1 -0
  7. package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -1
  8. package/dist/commonjs/model-libraries-snippets.js +16 -2
  9. package/dist/commonjs/model-libraries.d.ts +8 -1
  10. package/dist/commonjs/model-libraries.d.ts.map +1 -1
  11. package/dist/commonjs/model-libraries.js +7 -0
  12. package/dist/commonjs/pipelines.d.ts +7 -1
  13. package/dist/commonjs/pipelines.d.ts.map +1 -1
  14. package/dist/commonjs/pipelines.js +6 -0
  15. package/dist/commonjs/snippets/common.js +2 -2
  16. package/dist/commonjs/snippets/curl.d.ts +7 -7
  17. package/dist/commonjs/snippets/curl.d.ts.map +1 -1
  18. package/dist/commonjs/snippets/curl.js +5 -5
  19. package/dist/commonjs/snippets/js.d.ts +9 -9
  20. package/dist/commonjs/snippets/js.d.ts.map +1 -1
  21. package/dist/commonjs/snippets/js.js +11 -9
  22. package/dist/commonjs/snippets/python.d.ts +6 -6
  23. package/dist/commonjs/snippets/python.d.ts.map +1 -1
  24. package/dist/commonjs/snippets/python.js +51 -7
  25. package/dist/commonjs/tasks/index.d.ts.map +1 -1
  26. package/dist/commonjs/tasks/index.js +2 -0
  27. package/dist/commonjs/tasks/text-generation/data.d.ts.map +1 -1
  28. package/dist/commonjs/tasks/text-generation/data.js +1 -3
  29. package/dist/esm/inference-providers.d.ts +5 -4
  30. package/dist/esm/inference-providers.d.ts.map +1 -1
  31. package/dist/esm/inference-providers.js +14 -5
  32. package/dist/esm/library-to-tasks.d.ts +1 -1
  33. package/dist/esm/library-to-tasks.js +1 -1
  34. package/dist/esm/model-libraries-snippets.d.ts +1 -0
  35. package/dist/esm/model-libraries-snippets.d.ts.map +1 -1
  36. package/dist/esm/model-libraries-snippets.js +13 -0
  37. package/dist/esm/model-libraries.d.ts +8 -1
  38. package/dist/esm/model-libraries.d.ts.map +1 -1
  39. package/dist/esm/model-libraries.js +7 -0
  40. package/dist/esm/pipelines.d.ts +7 -1
  41. package/dist/esm/pipelines.d.ts.map +1 -1
  42. package/dist/esm/pipelines.js +6 -0
  43. package/dist/esm/snippets/common.js +2 -2
  44. package/dist/esm/snippets/curl.d.ts +7 -7
  45. package/dist/esm/snippets/curl.d.ts.map +1 -1
  46. package/dist/esm/snippets/curl.js +5 -5
  47. package/dist/esm/snippets/js.d.ts +9 -9
  48. package/dist/esm/snippets/js.d.ts.map +1 -1
  49. package/dist/esm/snippets/js.js +11 -9
  50. package/dist/esm/snippets/python.d.ts +6 -6
  51. package/dist/esm/snippets/python.d.ts.map +1 -1
  52. package/dist/esm/snippets/python.js +52 -8
  53. package/dist/esm/tasks/index.d.ts.map +1 -1
  54. package/dist/esm/tasks/index.js +2 -0
  55. package/dist/esm/tasks/text-generation/data.d.ts.map +1 -1
  56. package/dist/esm/tasks/text-generation/data.js +1 -3
  57. package/package.json +1 -1
  58. package/src/inference-providers.ts +16 -7
  59. package/src/library-to-tasks.ts +1 -1
  60. package/src/model-libraries-snippets.ts +14 -0
  61. package/src/model-libraries.ts +7 -0
  62. package/src/pipelines.ts +6 -0
  63. package/src/snippets/common.ts +2 -2
  64. package/src/snippets/curl.ts +19 -19
  65. package/src/snippets/js.ts +22 -20
  66. package/src/snippets/python.ts +67 -16
  67. package/src/tasks/audio-classification/about.md +1 -1
  68. package/src/tasks/audio-to-audio/about.md +1 -1
  69. package/src/tasks/automatic-speech-recognition/about.md +1 -1
  70. package/src/tasks/feature-extraction/spec/input.json +11 -4
  71. package/src/tasks/image-text-to-text/about.md +1 -1
  72. package/src/tasks/index.ts +2 -0
  73. package/src/tasks/sentence-similarity/about.md +2 -2
  74. package/src/tasks/text-generation/data.ts +1 -3
  75. package/src/tasks/text-to-speech/about.md +1 -1
@@ -1,10 +1,11 @@
1
- export declare const INFERENCE_PROVIDERS: readonly ["hf-inference", "fal-ai", "replicate", "sambanova", "together"];
2
- export type InferenceProvider = (typeof INFERENCE_PROVIDERS)[number];
3
- export declare const HF_HUB_INFERENCE_PROXY_TEMPLATE = "https://huggingface.co/api/inference-proxy/{{PROVIDER}}";
1
+ declare const INFERENCE_PROVIDERS: readonly ["fal-ai", "fireworks-ai", "hf-inference", "hyperbolic", "replicate", "sambanova", "together"];
2
+ export type SnippetInferenceProvider = (typeof INFERENCE_PROVIDERS)[number] | string;
3
+ export declare const HF_HUB_INFERENCE_PROXY_TEMPLATE = "https://router.huggingface.co/{{PROVIDER}}";
4
4
  /**
5
5
  * URL to set as baseUrl in the OpenAI SDK.
6
6
  *
7
7
  * TODO(Expose this from HfInference in the future?)
8
8
  */
9
- export declare function openAIbaseUrl(provider: InferenceProvider): string;
9
+ export declare function openAIbaseUrl(provider: SnippetInferenceProvider): string;
10
+ export {};
10
11
  //# sourceMappingURL=inference-providers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inference-providers.d.ts","sourceRoot":"","sources":["../../src/inference-providers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,2EAA4E,CAAC;AAE7G,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,+BAA+B,4DAA4D,CAAC;AAEzG;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAIjE"}
1
+ {"version":3,"file":"inference-providers.d.ts","sourceRoot":"","sources":["../../src/inference-providers.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,mBAAmB,yGAQf,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAErF,eAAO,MAAM,+BAA+B,+CAA+C,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,CAGxE"}
@@ -1,16 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = exports.INFERENCE_PROVIDERS = void 0;
3
+ exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = void 0;
4
4
  exports.openAIbaseUrl = openAIbaseUrl;
5
- exports.INFERENCE_PROVIDERS = ["hf-inference", "fal-ai", "replicate", "sambanova", "together"];
6
- exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = `https://huggingface.co/api/inference-proxy/{{PROVIDER}}`;
5
+ /// This list is for illustration purposes only.
6
+ /// in the `tasks` sub-package, we do not need actual strong typing of the inference providers.
7
+ const INFERENCE_PROVIDERS = [
8
+ "fal-ai",
9
+ "fireworks-ai",
10
+ "hf-inference",
11
+ "hyperbolic",
12
+ "replicate",
13
+ "sambanova",
14
+ "together",
15
+ ];
16
+ exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = `https://router.huggingface.co/{{PROVIDER}}`;
7
17
  /**
8
18
  * URL to set as baseUrl in the OpenAI SDK.
9
19
  *
10
20
  * TODO(Expose this from HfInference in the future?)
11
21
  */
12
22
  function openAIbaseUrl(provider) {
13
- return provider === "hf-inference"
14
- ? "https://api-inference.huggingface.co/v1/"
15
- : exports.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider);
23
+ const url = exports.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider);
24
+ return provider === "hf-inference" ? `${url}/v1` : url;
16
25
  }
@@ -2,7 +2,7 @@ import type { ModelLibraryKey } from "./model-libraries.js";
2
2
  import type { PipelineType } from "./pipelines.js";
3
3
  /**
4
4
  * Mapping from library name to its supported tasks.
5
- * Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
5
+ * HF-Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
6
6
  * This mapping is partially generated automatically by "python-api-export-tasks" action in
7
7
  * huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually
8
8
  * based on api-inference (hf_types.rs).
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIBRARY_TASK_MAPPING = void 0;
4
4
  /**
5
5
  * Mapping from library name to its supported tasks.
6
- * Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
6
+ * HF-Inference API (serverless) should be disabled for all other (library, task) pairs beyond this mapping.
7
7
  * This mapping is partially generated automatically by "python-api-export-tasks" action in
8
8
  * huggingface/api-inference-community repo upon merge. For transformers, the mapping is manually
9
9
  * based on api-inference (hf_types.rs).
@@ -3,6 +3,7 @@ export declare const adapters: (model: ModelData) => string[];
3
3
  export declare const allennlp: (model: ModelData) => string[];
4
4
  export declare const asteroid: (model: ModelData) => string[];
5
5
  export declare const audioseal: (model: ModelData) => string[];
6
+ export declare const ben2: (model: ModelData) => string[];
6
7
  export declare const bertopic: (model: ModelData) => string[];
7
8
  export declare const bm25s: (model: ModelData) => string[];
8
9
  export declare const cxr_foundation: () => string[];
@@ -1 +1 @@
1
- {"version":3,"file":"model-libraries-snippets.d.ts","sourceRoot":"","sources":["../../src/model-libraries-snippets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAkBjD,eAAO,MAAM,QAAQ,UAAW,SAAS,KAAG,MAAM,EAKjD,CAAC;AAkBF,eAAO,MAAM,QAAQ,UAAW,SAAS,KAAG,MAAM,EAKjD,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,SAAS,KAAG,MAAM,EAIjD,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,SAAS,KAAG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AAEF,eAAO,MAAM,IAAI,UAAW,SAAS,KAAG,MAAM,EAQ7C,CAAC;AAEF,eAAO,MAAM,IAAI,UAAW,SAAS,KAAG,MAAM,EAI7C,CAAC;AAEF,eAAO,MAAM,MAAM,UAAW,SAAS,KAAG,MAAM,EAI/C,CAAC;AA4BF,eAAO,MAAM,MAAM,UAAW,SAAS,KAAG,MAAM,EAO/C,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,SAAS,KAAG,MAAM,EAUnD,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,MAAM,EAYnC,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,SAAS,KAAG,MAAM,EAKvD,CAAC;AAEF,eAAO,MAAM,KAAK,UAAW,SAAS,KAAG,MAAM,EAI9C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.terratorch = exports.speechbrain = exports.stanza = exports.span_marker = exports.spacy = exports.setfit = exports.sentenceTransformers = exports.sampleFactory = exports.sam2 = exports.fastai = exports.stable_audio_tools = exports.sklearn = exports.seed_story = exports.saelens = exports.timm = exports.tensorflowtts = exports.relik = exports.pyannote_audio = exports.pyannote_audio_pipeline = exports.paddlenlp = exports.open_clip = exports.mesh_anything = exports.mars5_tts = exports.mamba_ssm = exports.tf_keras = exports.llama_cpp_python = exports.keras_hub = exports.keras = exports.htrflow = exports.gliner = exports.flair = exports.fairseq = exports.espnet = exports.espnetASR = exports.espnetTTS = exports.edsnlp = exports.cartesia_mlx = exports.cartesia_pytorch = exports.diffusionkit = exports.diffusers = exports.derm_foundation = exports.depth_pro = exports.depth_anything_v2 = exports.cxr_foundation = exports.bm25s = exports.bertopic = exports.audioseal = exports.asteroid = exports.allennlp = exports.adapters = void 0;
4
- exports.hezar = exports.threedtopia_xl = exports.whisperkit = exports.audiocraft = exports.anemoi = exports.pythae = exports.pxia = exports.nemo = exports.model2vec = exports.mlxim = exports.mlx = exports.swarmformer = exports.birefnet = exports.ultralytics = exports.chattts = exports.voicecraft = exports.vfimamba = exports.sana = exports.sentis = exports.mlAgents = exports.stableBaselines3 = exports.fasttext = exports.peft = exports.transformersJS = exports.transformers = void 0;
3
+ exports.speechbrain = exports.stanza = exports.span_marker = exports.spacy = exports.setfit = exports.sentenceTransformers = exports.sampleFactory = exports.sam2 = exports.fastai = exports.stable_audio_tools = exports.sklearn = exports.seed_story = exports.saelens = exports.timm = exports.tensorflowtts = exports.relik = exports.pyannote_audio = exports.pyannote_audio_pipeline = exports.paddlenlp = exports.open_clip = exports.mesh_anything = exports.mars5_tts = exports.mamba_ssm = exports.tf_keras = exports.llama_cpp_python = exports.keras_hub = exports.keras = exports.htrflow = exports.gliner = exports.flair = exports.fairseq = exports.espnet = exports.espnetASR = exports.espnetTTS = exports.edsnlp = exports.cartesia_mlx = exports.cartesia_pytorch = exports.diffusionkit = exports.diffusers = exports.derm_foundation = exports.depth_pro = exports.depth_anything_v2 = exports.cxr_foundation = exports.bm25s = exports.bertopic = exports.ben2 = exports.audioseal = exports.asteroid = exports.allennlp = exports.adapters = void 0;
4
+ exports.hezar = exports.threedtopia_xl = exports.whisperkit = exports.audiocraft = exports.anemoi = exports.pythae = exports.pxia = exports.nemo = exports.model2vec = exports.mlxim = exports.mlx = exports.swarmformer = exports.birefnet = exports.ultralytics = exports.chattts = exports.voicecraft = exports.vfimamba = exports.sana = exports.sentis = exports.mlAgents = exports.stableBaselines3 = exports.fasttext = exports.peft = exports.transformersJS = exports.transformers = exports.terratorch = void 0;
5
5
  const library_to_tasks_js_1 = require("./library-to-tasks.js");
6
6
  const inputs_js_1 = require("./snippets/inputs.js");
7
7
  const common_js_1 = require("./snippets/common.js");
@@ -74,6 +74,20 @@ function get_prompt_from_diffusers_model(model) {
74
74
  return escapeStringForJson(prompt);
75
75
  }
76
76
  }
77
+ const ben2 = (model) => [
78
+ `import requests
79
+ from PIL import Image
80
+ from ben2 import AutoModel
81
+
82
+ url = "https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg"
83
+ image = Image.open(requests.get(url, stream=True).raw)
84
+
85
+ model = AutoModel.from_pretrained("${model.id}")
86
+ model.to("cuda").eval()
87
+ foreground = model.inference(image)
88
+ `,
89
+ ];
90
+ exports.ben2 = ben2;
77
91
  const bertopic = (model) => [
78
92
  `from bertopic import BERTopic
79
93
 
@@ -105,6 +105,13 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
105
105
  countDownloads: string;
106
106
  snippets: (model: ModelData) => string[];
107
107
  };
108
+ ben2: {
109
+ prettyLabel: string;
110
+ repoName: string;
111
+ repoUrl: string;
112
+ snippets: (model: ModelData) => string[];
113
+ filter: false;
114
+ };
108
115
  bertopic: {
109
116
  prettyLabel: string;
110
117
  repoName: string;
@@ -894,5 +901,5 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
894
901
  };
895
902
  export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
896
903
  export declare const ALL_MODEL_LIBRARY_KEYS: ModelLibraryKey[];
897
- export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "asteroid" | "audiocraft" | "audioseal" | "bertopic" | "big_vision" | "birder" | "birefnet" | "bm25s" | "champ" | "chat_tts" | "colpali" | "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" | "imstoucan" | "keras" | "tf-keras" | "keras-hub" | "k2" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "mesh-anything" | "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")[];
904
+ 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" | "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" | "imstoucan" | "keras" | "tf-keras" | "keras-hub" | "k2" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "mesh-anything" | "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")[];
898
905
  //# 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,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,MAAM,EAAE,CAAC;IAC1C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAm1BI,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAEvE,eAAO,MAAM,sBAAsB,EAA+C,eAAe,EAAE,CAAC;AAEpG,eAAO,MAAM,8BAA8B,miDAQ1B,CAAC"}
@@ -91,6 +91,13 @@ exports.MODEL_LIBRARIES_UI_ELEMENTS = {
91
91
  countDownloads: `path_extension:"pth"`,
92
92
  snippets: snippets.audioseal,
93
93
  },
94
+ ben2: {
95
+ prettyLabel: "BEN2",
96
+ repoName: "BEN2",
97
+ repoUrl: "https://github.com/PramaLLC/BEN2",
98
+ snippets: snippets.ben2,
99
+ filter: false,
100
+ },
94
101
  bertopic: {
95
102
  prettyLabel: "BERTopic",
96
103
  repoName: "BERTopic",
@@ -409,6 +409,12 @@ export declare const PIPELINE_DATA: {
409
409
  color: "red";
410
410
  hideInDatasets: true;
411
411
  };
412
+ "visual-document-retrieval": {
413
+ name: string;
414
+ modality: "multimodal";
415
+ color: "yellow";
416
+ hideInDatasets: true;
417
+ };
412
418
  "any-to-any": {
413
419
  name: string;
414
420
  modality: "multimodal";
@@ -427,5 +433,5 @@ export type PipelineType = keyof typeof PIPELINE_DATA;
427
433
  export type WidgetType = PipelineType | "conversational";
428
434
  export declare const PIPELINE_TYPES: PipelineType[];
429
435
  export declare const SUBTASK_TYPES: string[];
430
- export declare const PIPELINE_TYPES_SET: Set<"other" | "text-classification" | "token-classification" | "table-question-answering" | "question-answering" | "zero-shot-classification" | "translation" | "summarization" | "feature-extraction" | "text-generation" | "text2text-generation" | "fill-mask" | "sentence-similarity" | "text-to-speech" | "text-to-audio" | "automatic-speech-recognition" | "audio-to-audio" | "audio-classification" | "audio-text-to-text" | "voice-activity-detection" | "depth-estimation" | "image-classification" | "object-detection" | "image-segmentation" | "text-to-image" | "image-to-text" | "image-to-image" | "image-to-video" | "unconditional-image-generation" | "video-classification" | "reinforcement-learning" | "robotics" | "tabular-classification" | "tabular-regression" | "tabular-to-text" | "table-to-text" | "multiple-choice" | "text-retrieval" | "time-series-forecasting" | "text-to-video" | "image-text-to-text" | "visual-question-answering" | "document-question-answering" | "zero-shot-image-classification" | "graph-ml" | "mask-generation" | "zero-shot-object-detection" | "text-to-3d" | "image-to-3d" | "image-feature-extraction" | "video-text-to-text" | "keypoint-detection" | "any-to-any">;
436
+ export declare const PIPELINE_TYPES_SET: Set<"other" | "text-classification" | "token-classification" | "table-question-answering" | "question-answering" | "zero-shot-classification" | "translation" | "summarization" | "feature-extraction" | "text-generation" | "text2text-generation" | "fill-mask" | "sentence-similarity" | "text-to-speech" | "text-to-audio" | "automatic-speech-recognition" | "audio-to-audio" | "audio-classification" | "audio-text-to-text" | "voice-activity-detection" | "depth-estimation" | "image-classification" | "object-detection" | "image-segmentation" | "text-to-image" | "image-to-text" | "image-to-image" | "image-to-video" | "unconditional-image-generation" | "video-classification" | "reinforcement-learning" | "robotics" | "tabular-classification" | "tabular-regression" | "tabular-to-text" | "table-to-text" | "multiple-choice" | "text-retrieval" | "time-series-forecasting" | "text-to-video" | "image-text-to-text" | "visual-question-answering" | "document-question-answering" | "zero-shot-image-classification" | "graph-ml" | "mask-generation" | "zero-shot-object-detection" | "text-to-3d" | "image-to-3d" | "image-feature-extraction" | "video-text-to-text" | "keypoint-detection" | "visual-document-retrieval" | "any-to-any">;
431
437
  //# sourceMappingURL=pipelines.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipelines.d.ts","sourceRoot":"","sources":["../../src/pipelines.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,yEAA0E,CAAC;AAElG,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC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;;;;;;;;;;;;;;;CAknBc,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,aAAa,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEzD,eAAO,MAAM,cAAc,EAAiC,YAAY,EAAE,CAAC;AAE3E,eAAO,MAAM,aAAa,UAEN,CAAC;AAErB,eAAO,MAAM,kBAAkB,ssCAA0B,CAAC"}
@@ -630,6 +630,12 @@ exports.PIPELINE_DATA = {
630
630
  color: "red",
631
631
  hideInDatasets: true,
632
632
  },
633
+ "visual-document-retrieval": {
634
+ name: "Visual Document Retrieval",
635
+ modality: "multimodal",
636
+ color: "yellow",
637
+ hideInDatasets: true,
638
+ },
633
639
  "any-to-any": {
634
640
  name: "Any-to-Any",
635
641
  modality: "multimodal",
@@ -18,6 +18,6 @@ function stringifyMessages(messages, opts) {
18
18
  function stringifyGenerationConfig(config, opts) {
19
19
  const quote = opts.attributeKeyQuotes ? `"` : "";
20
20
  return Object.entries(config)
21
- .map(([key, val]) => `${quote}${key}${quote}${opts.attributeValueConnector}${val}`)
22
- .join(`,${opts.indent}`);
21
+ .map(([key, val]) => `${quote}${key}${quote}${opts.attributeValueConnector}${val},`)
22
+ .join(`${opts.indent}`);
23
23
  }
@@ -1,17 +1,17 @@
1
- import { type InferenceProvider } from "../inference-providers.js";
1
+ import { type SnippetInferenceProvider } from "../inference-providers.js";
2
2
  import type { PipelineType } from "../pipelines.js";
3
3
  import type { ChatCompletionInputMessage, GenerationParameters } from "../tasks/index.js";
4
4
  import type { InferenceSnippet, ModelDataMinimal } from "./types.js";
5
- export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
6
- export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: {
5
+ export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
6
+ export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: {
7
7
  streaming?: boolean;
8
8
  messages?: ChatCompletionInputMessage[];
9
9
  temperature?: GenerationParameters["temperature"];
10
10
  max_tokens?: GenerationParameters["max_tokens"];
11
11
  top_p?: GenerationParameters["top_p"];
12
12
  }) => InferenceSnippet[];
13
- export declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
14
- export declare const snippetFile: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
15
- export declare const curlSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
16
- export declare function getCurlInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: Record<string, unknown>): 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, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
16
+ export declare function getCurlInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: Record<string, unknown>): InferenceSnippet[];
17
17
  //# sourceMappingURL=curl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../src/snippets/curl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO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AAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CAIpB"}
@@ -13,7 +13,7 @@ const snippetBasic = (model, accessToken, provider) => {
13
13
  {
14
14
  client: "curl",
15
15
  content: `\
16
- curl https://api-inference.huggingface.co/models/${model.id} \\
16
+ curl https://router.huggingface.co/hf-inference/models/${model.id} \\
17
17
  -X POST \\
18
18
  -d '{"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model, true)}}' \\
19
19
  -H 'Content-Type: application/json' \\
@@ -25,7 +25,7 @@ exports.snippetBasic = snippetBasic;
25
25
  const snippetTextGeneration = (model, accessToken, provider, opts) => {
26
26
  if (model.tags.includes("conversational")) {
27
27
  const baseUrl = provider === "hf-inference"
28
- ? `https://api-inference.huggingface.co/models/${model.id}/v1/chat/completions`
28
+ ? `https://router.huggingface.co/hf-inference/models/${model.id}/v1/chat/completions`
29
29
  : inference_providers_js_1.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider) + "/v1/chat/completions";
30
30
  // Conversational model detected, so we display a code snippet that features the Messages API
31
31
  const streaming = opts?.streaming ?? true;
@@ -53,7 +53,7 @@ const snippetTextGeneration = (model, accessToken, provider, opts) => {
53
53
  indent: "\n ",
54
54
  attributeKeyQuotes: true,
55
55
  attributeValueConnector: ": ",
56
- })},
56
+ })}
57
57
  "stream": ${!!streaming}
58
58
  }'`,
59
59
  },
@@ -71,7 +71,7 @@ const snippetZeroShotClassification = (model, accessToken, provider) => {
71
71
  return [
72
72
  {
73
73
  client: "curl",
74
- content: `curl https://api-inference.huggingface.co/models/${model.id} \\
74
+ content: `curl https://router.huggingface.co/hf-inference/models/${model.id} \\
75
75
  -X POST \\
76
76
  -d '{"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model, true)}, "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}' \\
77
77
  -H 'Content-Type: application/json' \\
@@ -87,7 +87,7 @@ const snippetFile = (model, accessToken, provider) => {
87
87
  return [
88
88
  {
89
89
  client: "curl",
90
- content: `curl https://api-inference.huggingface.co/models/${model.id} \\
90
+ content: `curl https://router.huggingface.co/hf-inference/models/${model.id} \\
91
91
  -X POST \\
92
92
  --data-binary '@${(0, inputs_js_1.getModelInputSnippet)(model, true, true)}' \\
93
93
  -H 'Authorization: Bearer ${accessToken || `{API_TOKEN}`}'`,
@@ -1,9 +1,9 @@
1
- import { type InferenceProvider } from "../inference-providers.js";
1
+ import { type SnippetInferenceProvider } from "../inference-providers.js";
2
2
  import type { PipelineType } from "../pipelines.js";
3
3
  import type { ChatCompletionInputMessage, GenerationParameters } from "../tasks/index.js";
4
4
  import type { InferenceSnippet, ModelDataMinimal } from "./types.js";
5
- export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
6
- export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: {
5
+ export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
6
+ export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: {
7
7
  streaming?: boolean;
8
8
  messages?: ChatCompletionInputMessage[];
9
9
  temperature?: GenerationParameters["temperature"];
@@ -11,10 +11,10 @@ export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToke
11
11
  top_p?: GenerationParameters["top_p"];
12
12
  }) => InferenceSnippet[];
13
13
  export declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string) => InferenceSnippet[];
14
- export declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
15
- export declare const snippetTextToAudio: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
16
- export declare const snippetAutomaticSpeechRecognition: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
17
- export declare const snippetFile: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
18
- export declare const jsSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
19
- export declare function getJsInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: Record<string, unknown>): InferenceSnippet[];
14
+ export declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
15
+ export declare const snippetTextToAudio: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
16
+ export declare const snippetAutomaticSpeechRecognition: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
17
+ export declare const snippetFile: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
18
+ export declare const jsSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
19
+ export declare function getJsInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: Record<string, unknown>): InferenceSnippet[];
20
20
  //# sourceMappingURL=js.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../../src/snippets/js.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAClF,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;AAgBrE,eAAO,MAAM,YAAY,UACjB,gBAAgB,eACV,MAAM,YACT,iBAAiB,KACzB,gBAAgB,EA8ClB,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAC1B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eAAO,MAAM,UAAU,EAAE,OAAO,CAC/B,MAAM,CACL,YAAY,EACZ,CACC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,gBAAgB,EAAE,CACvB,CA0BD,CAAC;AAEF,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CAIpB"}
@@ -35,7 +35,7 @@ const output = await client.${HFJS_METHODS[model.pipeline_tag]}({
35
35
  provider: "${provider}",
36
36
  });
37
37
 
38
- console.log(output)
38
+ console.log(output);
39
39
  `,
40
40
  },
41
41
  ]
@@ -45,7 +45,7 @@ console.log(output)
45
45
  content: `\
46
46
  async function query(data) {
47
47
  const response = await fetch(
48
- "https://api-inference.huggingface.co/models/${model.id}",
48
+ "https://router.huggingface.co/hf-inference/models/${model.id}",
49
49
  {
50
50
  headers: {
51
51
  Authorization: "Bearer ${accessToken || `{API_TOKEN}`}",
@@ -121,7 +121,7 @@ let out = "";
121
121
  const stream = await client.chat.completions.create({
122
122
  model: "${model.id}",
123
123
  messages: ${messagesStr},
124
- ${configStr},
124
+ ${configStr}
125
125
  stream: true,
126
126
  });
127
127
 
@@ -150,7 +150,8 @@ const chatCompletion = await client.chatCompletion({
150
150
  ${configStr}
151
151
  });
152
152
 
153
- console.log(chatCompletion.choices[0].message);`,
153
+ console.log(chatCompletion.choices[0].message);
154
+ `,
154
155
  },
155
156
  {
156
157
  client: "openai",
@@ -167,7 +168,8 @@ const chatCompletion = await client.chat.completions.create({
167
168
  ${configStr}
168
169
  });
169
170
 
170
- console.log(chatCompletion.choices[0].message);`,
171
+ console.log(chatCompletion.choices[0].message);
172
+ `,
171
173
  },
172
174
  ];
173
175
  }
@@ -183,7 +185,7 @@ const snippetZeroShotClassification = (model, accessToken) => {
183
185
  client: "fetch",
184
186
  content: `async function query(data) {
185
187
  const response = await fetch(
186
- "https://api-inference.huggingface.co/models/${model.id}",
188
+ "https://router.huggingface.co/hf-inference/models/${model.id}",
187
189
  {
188
190
  headers: {
189
191
  Authorization: "Bearer ${accessToken || `{API_TOKEN}`}",
@@ -228,7 +230,7 @@ const image = await client.textToImage({
228
230
  client: "fetch",
229
231
  content: `async function query(data) {
230
232
  const response = await fetch(
231
- "https://api-inference.huggingface.co/models/${model.id}",
233
+ "https://router.huggingface.co/hf-inference/models/${model.id}",
232
234
  {
233
235
  headers: {
234
236
  Authorization: "Bearer ${accessToken || `{API_TOKEN}`}",
@@ -256,7 +258,7 @@ const snippetTextToAudio = (model, accessToken, provider) => {
256
258
  }
257
259
  const commonSnippet = `async function query(data) {
258
260
  const response = await fetch(
259
- "https://api-inference.huggingface.co/models/${model.id}",
261
+ "https://router.huggingface.co/hf-inference/models/${model.id}",
260
262
  {
261
263
  headers: {
262
264
  Authorization: "Bearer ${accessToken || `{API_TOKEN}`}",
@@ -333,7 +335,7 @@ const snippetFile = (model, accessToken, provider) => {
333
335
  content: `async function query(filename) {
334
336
  const data = fs.readFileSync(filename);
335
337
  const response = await fetch(
336
- "https://api-inference.huggingface.co/models/${model.id}",
338
+ "https://router.huggingface.co/hf-inference/models/${model.id}",
337
339
  {
338
340
  headers: {
339
341
  Authorization: "Bearer ${accessToken || `{API_TOKEN}`}",
@@ -1,8 +1,8 @@
1
- import { type InferenceProvider } from "../inference-providers.js";
1
+ import { type SnippetInferenceProvider } from "../inference-providers.js";
2
2
  import type { PipelineType } from "../pipelines.js";
3
3
  import type { ChatCompletionInputMessage, GenerationParameters } from "../tasks/index.js";
4
4
  import type { InferenceSnippet, ModelDataMinimal } from "./types.js";
5
- export declare const snippetConversational: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: {
5
+ export declare const snippetConversational: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: {
6
6
  streaming?: boolean;
7
7
  messages?: ChatCompletionInputMessage[];
8
8
  temperature?: GenerationParameters["temperature"];
@@ -11,12 +11,12 @@ export declare const snippetConversational: (model: ModelDataMinimal, accessToke
11
11
  }) => InferenceSnippet[];
12
12
  export declare const snippetZeroShotClassification: (model: ModelDataMinimal) => InferenceSnippet[];
13
13
  export declare const snippetZeroShotImageClassification: (model: ModelDataMinimal) => InferenceSnippet[];
14
- export declare const snippetBasic: (model: ModelDataMinimal) => InferenceSnippet[];
14
+ export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
15
15
  export declare const snippetFile: (model: ModelDataMinimal) => InferenceSnippet[];
16
- export declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider) => InferenceSnippet[];
16
+ export declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
17
17
  export declare const snippetTabular: (model: ModelDataMinimal) => InferenceSnippet[];
18
18
  export declare const snippetTextToAudio: (model: ModelDataMinimal) => InferenceSnippet[];
19
19
  export declare const snippetDocumentQuestionAnswering: (model: ModelDataMinimal) => InferenceSnippet[];
20
- export declare const pythonSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
21
- export declare function getPythonInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: InferenceProvider, opts?: Record<string, unknown>): InferenceSnippet[];
20
+ export declare const pythonSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
21
+ export declare function getPythonInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, opts?: Record<string, unknown>): InferenceSnippet[];
22
22
  //# sourceMappingURL=python.d.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B,EAevF,CAAC;AAEF,eAAO,MAAM,kCAAkC,UAAW,gBAAgB,KAAG,gBAAgB,EAqB5F,CAAC;AAEF,eAAO,MAAM,YAAY,UACjB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAgClB,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,KAAG,gBAAgB,EAcrE,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACvB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAqDlB,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,gBAAgB,KAAG,gBAAgB,EAcxE,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,gBAAgB,KAAG,gBAAgB,EAuC5E,CAAC;AAEF,eAAO,MAAM,gCAAgC,UAAW,gBAAgB,KAAG,gBAAgB,EAiB1F,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAAO,CACnC,MAAM,CACL,YAAY,EACZ,CACC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,gBAAgB,EAAE,CACvB,CA8BD,CAAC;AAEF,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CA0BpB"}
@@ -5,6 +5,35 @@ exports.getPythonInferenceSnippet = getPythonInferenceSnippet;
5
5
  const inference_providers_js_1 = require("../inference-providers.js");
6
6
  const common_js_1 = require("./common.js");
7
7
  const inputs_js_1 = require("./inputs.js");
8
+ const HFH_INFERENCE_CLIENT_METHODS = {
9
+ "audio-classification": "audio_classification",
10
+ "audio-to-audio": "audio_to_audio",
11
+ "automatic-speech-recognition": "automatic_speech_recognition",
12
+ "text-to-speech": "text_to_speech",
13
+ "image-classification": "image_classification",
14
+ "image-segmentation": "image_segmentation",
15
+ "image-to-image": "image_to_image",
16
+ "image-to-text": "image_to_text",
17
+ "object-detection": "object_detection",
18
+ "text-to-image": "text_to_image",
19
+ "text-to-video": "text_to_video",
20
+ "zero-shot-image-classification": "zero_shot_image_classification",
21
+ "document-question-answering": "document_question_answering",
22
+ "visual-question-answering": "visual_question_answering",
23
+ "feature-extraction": "feature_extraction",
24
+ "fill-mask": "fill_mask",
25
+ "question-answering": "question_answering",
26
+ "sentence-similarity": "sentence_similarity",
27
+ summarization: "summarization",
28
+ "table-question-answering": "table_question_answering",
29
+ "text-classification": "text_classification",
30
+ "text-generation": "text_generation",
31
+ "token-classification": "token_classification",
32
+ translation: "translation",
33
+ "zero-shot-classification": "zero_shot_classification",
34
+ "tabular-classification": "tabular_classification",
35
+ "tabular-regression": "tabular_regression",
36
+ };
8
37
  const snippetImportInferenceClient = (accessToken, provider) => `\
9
38
  from huggingface_hub import InferenceClient
10
39
 
@@ -38,7 +67,7 @@ messages = ${messagesStr}
38
67
  stream = client.chat.completions.create(
39
68
  model="${model.id}",
40
69
  messages=messages,
41
- ${configStr},
70
+ ${configStr}
42
71
  stream=True
43
72
  )
44
73
 
@@ -60,7 +89,7 @@ messages = ${messagesStr}
60
89
  stream = client.chat.completions.create(
61
90
  model="${model.id}",
62
91
  messages=messages,
63
- ${configStr},
92
+ ${configStr}
64
93
  stream=True
65
94
  )
66
95
 
@@ -150,8 +179,26 @@ output = query({
150
179
  ];
151
180
  };
152
181
  exports.snippetZeroShotImageClassification = snippetZeroShotImageClassification;
153
- const snippetBasic = (model) => {
182
+ const snippetBasic = (model, accessToken, provider) => {
154
183
  return [
184
+ ...(model.pipeline_tag && model.pipeline_tag in HFH_INFERENCE_CLIENT_METHODS
185
+ ? [
186
+ {
187
+ client: "huggingface_hub",
188
+ content: `\
189
+ ${snippetImportInferenceClient(accessToken, provider)}
190
+
191
+ result = client.${HFH_INFERENCE_CLIENT_METHODS[model.pipeline_tag]}(
192
+ model="${model.id}",
193
+ inputs=${(0, inputs_js_1.getModelInputSnippet)(model)},
194
+ provider="${provider}",
195
+ )
196
+
197
+ print(result)
198
+ `,
199
+ },
200
+ ]
201
+ : []),
155
202
  {
156
203
  client: "requests",
157
204
  content: `\
@@ -353,9 +400,6 @@ function getPythonInferenceSnippet(model, accessToken, provider, opts) {
353
400
  const snippets = model.pipeline_tag && model.pipeline_tag in exports.pythonSnippets
354
401
  ? exports.pythonSnippets[model.pipeline_tag]?.(model, accessToken, provider) ?? []
355
402
  : [];
356
- const baseUrl = provider === "hf-inference"
357
- ? `https://api-inference.huggingface.co/models/${model.id}`
358
- : inference_providers_js_1.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider);
359
403
  return snippets.map((snippet) => {
360
404
  return {
361
405
  ...snippet,
@@ -363,7 +407,7 @@ function getPythonInferenceSnippet(model, accessToken, provider, opts) {
363
407
  ? `\
364
408
  import requests
365
409
 
366
- API_URL = "${baseUrl}"
410
+ API_URL = "${(0, inference_providers_js_1.openAIbaseUrl)(provider)}"
367
411
  headers = {"Authorization": ${accessToken ? `"Bearer ${accessToken}"` : `f"Bearer {API_TOKEN}"`}}
368
412
 
369
413
  ${snippet.content}`