@huggingface/tasks 0.19.3 → 0.19.5
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/commonjs/gguf.d.ts +54 -4
- package/dist/commonjs/gguf.d.ts.map +1 -1
- package/dist/commonjs/gguf.js +152 -8
- package/dist/commonjs/local-apps.d.ts +7 -0
- package/dist/commonjs/local-apps.d.ts.map +1 -1
- package/dist/commonjs/local-apps.js +40 -0
- package/dist/commonjs/model-libraries-snippets.d.ts +3 -0
- package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -1
- package/dist/commonjs/model-libraries-snippets.js +116 -20
- package/dist/commonjs/model-libraries.d.ts +24 -1
- package/dist/commonjs/model-libraries.d.ts.map +1 -1
- package/dist/commonjs/model-libraries.js +23 -0
- package/dist/commonjs/tasks/index.js +1 -1
- package/dist/esm/gguf.d.ts +54 -4
- package/dist/esm/gguf.d.ts.map +1 -1
- package/dist/esm/gguf.js +150 -7
- package/dist/esm/local-apps.d.ts +7 -0
- package/dist/esm/local-apps.d.ts.map +1 -1
- package/dist/esm/local-apps.js +40 -0
- package/dist/esm/model-libraries-snippets.d.ts +3 -0
- package/dist/esm/model-libraries-snippets.d.ts.map +1 -1
- package/dist/esm/model-libraries-snippets.js +111 -18
- package/dist/esm/model-libraries.d.ts +24 -1
- package/dist/esm/model-libraries.d.ts.map +1 -1
- package/dist/esm/model-libraries.js +23 -0
- package/dist/esm/tasks/index.js +1 -1
- package/package.json +1 -2
- package/src/gguf.ts +169 -9
- package/src/local-apps.ts +42 -0
- package/src/model-libraries-snippets.ts +116 -18
- package/src/model-libraries.ts +23 -0
- package/src/tasks/index.ts +1 -1
- package/src/tasks/reinforcement-learning/about.md +1 -1
|
@@ -226,6 +226,13 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
226
226
|
filter: false;
|
|
227
227
|
countDownloads: string;
|
|
228
228
|
};
|
|
229
|
+
"describe-anything": {
|
|
230
|
+
prettyLabel: string;
|
|
231
|
+
repoName: string;
|
|
232
|
+
repoUrl: string;
|
|
233
|
+
snippets: (model: ModelData) => string[];
|
|
234
|
+
filter: false;
|
|
235
|
+
};
|
|
229
236
|
"dia-tts": {
|
|
230
237
|
prettyLabel: string;
|
|
231
238
|
repoName: string;
|
|
@@ -653,6 +660,14 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
653
660
|
snippets: (model: ModelData) => string[];
|
|
654
661
|
countDownloads: string;
|
|
655
662
|
};
|
|
663
|
+
"phantom-wan": {
|
|
664
|
+
prettyLabel: string;
|
|
665
|
+
repoName: string;
|
|
666
|
+
repoUrl: string;
|
|
667
|
+
snippets: (model: ModelData) => string[];
|
|
668
|
+
filter: false;
|
|
669
|
+
countDownloads: string;
|
|
670
|
+
};
|
|
656
671
|
pxia: {
|
|
657
672
|
prettyLabel: string;
|
|
658
673
|
repoName: string;
|
|
@@ -999,6 +1014,14 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
999
1014
|
countDownloads: string;
|
|
1000
1015
|
snippets: (model: ModelData) => string[];
|
|
1001
1016
|
};
|
|
1017
|
+
zonos: {
|
|
1018
|
+
prettyLabel: string;
|
|
1019
|
+
repoName: string;
|
|
1020
|
+
repoUrl: string;
|
|
1021
|
+
docsUrl: string;
|
|
1022
|
+
snippets: (model: ModelData) => string[];
|
|
1023
|
+
filter: false;
|
|
1024
|
+
};
|
|
1002
1025
|
"3dtopia-xl": {
|
|
1003
1026
|
prettyLabel: string;
|
|
1004
1027
|
repoName: string;
|
|
@@ -1010,5 +1033,5 @@ export declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
1010
1033
|
};
|
|
1011
1034
|
export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
|
|
1012
1035
|
export declare const ALL_MODEL_LIBRARY_KEYS: ModelLibraryKey[];
|
|
1013
|
-
export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "araclip" | "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" | "dia-tts" | "diffree" | "diffusers" | "diffusionkit" | "doctr" | "cartesia_pytorch" | "cartesia_mlx" | "clipscope" | "cosyvoice" | "cotracker" | "edsnlp" | "elm" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gemma.cpp" | "geometry-crafter" | "gliner" | "glyph-byt5" | "grok" | "hallo" | "hezar" | "htrflow" | "hunyuan-dit" | "hunyuan3d-2" | "imstoucan" | "index-tts" | "infinite-you" | "keras" | "tf-keras" | "keras-hub" | "k2" | "lightning-ir" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "matanyone" | "mesh-anything" | "merlin" | "medvae" | "mitie" | "ml-agents" | "mlx" | "mlx-image" | "mlc-llm" | "model2vec" | "moshi" | "nemo" | "open-oasis" | "open_clip" | "open-sora" | "outetts" | "paddlenlp" | "peft" | "perception-encoder" | "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" | "uni-3dar" | "unity-sentis" | "sana" | "vfi-mamba" | "voicecraft" | "wham" | "whisperkit" | "yolov10" | "3dtopia-xl")[];
|
|
1036
|
+
export declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("adapter-transformers" | "allennlp" | "anemoi" | "araclip" | "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" | "describe-anything" | "dia-tts" | "diffree" | "diffusers" | "diffusionkit" | "doctr" | "cartesia_pytorch" | "cartesia_mlx" | "clipscope" | "cosyvoice" | "cotracker" | "edsnlp" | "elm" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gemma.cpp" | "geometry-crafter" | "gliner" | "glyph-byt5" | "grok" | "hallo" | "hezar" | "htrflow" | "hunyuan-dit" | "hunyuan3d-2" | "imstoucan" | "index-tts" | "infinite-you" | "keras" | "tf-keras" | "keras-hub" | "k2" | "lightning-ir" | "liveportrait" | "llama-cpp-python" | "mini-omni2" | "mindspore" | "mamba-ssm" | "mars5-tts" | "matanyone" | "mesh-anything" | "merlin" | "medvae" | "mitie" | "ml-agents" | "mlx" | "mlx-image" | "mlc-llm" | "model2vec" | "moshi" | "nemo" | "open-oasis" | "open_clip" | "open-sora" | "outetts" | "paddlenlp" | "peft" | "perception-encoder" | "phantom-wan" | "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" | "uni-3dar" | "unity-sentis" | "sana" | "vfi-mamba" | "voicecraft" | "wham" | "whisperkit" | "yolov10" | "zonos" | "3dtopia-xl")[];
|
|
1014
1037
|
//# 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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAu9BI,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAEvE,eAAO,MAAM,sBAAsB,EAA+C,eAAe,EAAE,CAAC;AAEpG,eAAO,MAAM,8BAA8B,qzDAQ1B,CAAC"}
|
|
@@ -186,6 +186,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
186
186
|
filter: false,
|
|
187
187
|
countDownloads: `path:"scin_dataset_precomputed_embeddings.npz" OR path:"saved_model.pb"`,
|
|
188
188
|
},
|
|
189
|
+
"describe-anything": {
|
|
190
|
+
prettyLabel: "Describe Anything",
|
|
191
|
+
repoName: "Describe Anything",
|
|
192
|
+
repoUrl: "https://github.com/NVlabs/describe-anything",
|
|
193
|
+
snippets: snippets.describe_anything,
|
|
194
|
+
filter: false,
|
|
195
|
+
},
|
|
189
196
|
"dia-tts": {
|
|
190
197
|
prettyLabel: "Dia",
|
|
191
198
|
repoName: "Dia",
|
|
@@ -618,6 +625,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
618
625
|
snippets: snippets.perception_encoder,
|
|
619
626
|
countDownloads: `path_extension:"pt"`,
|
|
620
627
|
},
|
|
628
|
+
"phantom-wan": {
|
|
629
|
+
prettyLabel: "Phantom",
|
|
630
|
+
repoName: "Phantom",
|
|
631
|
+
repoUrl: "https://github.com/Phantom-video/Phantom",
|
|
632
|
+
snippets: snippets.phantom_wan,
|
|
633
|
+
filter: false,
|
|
634
|
+
countDownloads: `path_extension:"pth"`,
|
|
635
|
+
},
|
|
621
636
|
pxia: {
|
|
622
637
|
prettyLabel: "pxia",
|
|
623
638
|
repoName: "pxia",
|
|
@@ -965,6 +980,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
965
980
|
countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
|
|
966
981
|
snippets: snippets.ultralytics,
|
|
967
982
|
},
|
|
983
|
+
zonos: {
|
|
984
|
+
prettyLabel: "Zonos",
|
|
985
|
+
repoName: "Zonos",
|
|
986
|
+
repoUrl: "https://github.com/Zyphra/Zonos",
|
|
987
|
+
docsUrl: "https://github.com/Zyphra/Zonos",
|
|
988
|
+
snippets: snippets.zonos,
|
|
989
|
+
filter: false,
|
|
990
|
+
},
|
|
968
991
|
"3dtopia-xl": {
|
|
969
992
|
prettyLabel: "3DTopia-XL",
|
|
970
993
|
repoName: "3DTopia-XL",
|
package/dist/esm/tasks/index.js
CHANGED
|
@@ -113,7 +113,7 @@ export const TASKS_MODEL_LIBRARIES = {
|
|
|
113
113
|
/**
|
|
114
114
|
* Return the whole TaskData object for a certain task.
|
|
115
115
|
* If the partialTaskData argument is left undefined,
|
|
116
|
-
* the default
|
|
116
|
+
* the default placeholder data will be used.
|
|
117
117
|
*/
|
|
118
118
|
function getData(type, partialTaskData = placeholder) {
|
|
119
119
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huggingface/tasks",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.19.3",
|
|
3
|
+
"version": "0.19.5",
|
|
5
4
|
"description": "List of ML tasks for huggingface.co/tasks",
|
|
6
5
|
"repository": "https://github.com/huggingface/huggingface.js.git",
|
|
7
6
|
"publishConfig": {
|
package/src/gguf.ts
CHANGED
|
@@ -1,3 +1,170 @@
|
|
|
1
|
+
// This list is copied from gguf/types.ts, but will all types available (for backward compatibility)
|
|
2
|
+
// NOT to be confused with GGMLQuantizationType, a FileQuantization can contain multiple GGMLQuantizationType
|
|
3
|
+
// For example, Q4_K_M model can contains Q4_K and Q6_K tensors
|
|
4
|
+
export enum GGMLFileQuantizationType {
|
|
5
|
+
F32 = 0,
|
|
6
|
+
F16 = 1,
|
|
7
|
+
Q4_0 = 2,
|
|
8
|
+
Q4_1 = 3,
|
|
9
|
+
Q4_1_SOME_F16 = 4,
|
|
10
|
+
Q4_2 = 5,
|
|
11
|
+
Q4_3 = 6,
|
|
12
|
+
Q8_0 = 7,
|
|
13
|
+
Q5_0 = 8,
|
|
14
|
+
Q5_1 = 9,
|
|
15
|
+
Q2_K = 10,
|
|
16
|
+
Q3_K_S = 11,
|
|
17
|
+
Q3_K_M = 12,
|
|
18
|
+
Q3_K_L = 13,
|
|
19
|
+
Q4_K_S = 14,
|
|
20
|
+
Q4_K_M = 15,
|
|
21
|
+
Q5_K_S = 16,
|
|
22
|
+
Q5_K_M = 17,
|
|
23
|
+
Q6_K = 18,
|
|
24
|
+
IQ2_XXS = 19,
|
|
25
|
+
IQ2_XS = 20,
|
|
26
|
+
Q2_K_S = 21,
|
|
27
|
+
IQ3_XS = 22,
|
|
28
|
+
IQ3_XXS = 23,
|
|
29
|
+
IQ1_S = 24,
|
|
30
|
+
IQ4_NL = 25,
|
|
31
|
+
IQ3_S = 26,
|
|
32
|
+
IQ3_M = 27,
|
|
33
|
+
IQ2_S = 28,
|
|
34
|
+
IQ2_M = 29,
|
|
35
|
+
IQ4_XS = 30,
|
|
36
|
+
IQ1_M = 31,
|
|
37
|
+
BF16 = 32,
|
|
38
|
+
Q4_0_4_4 = 33,
|
|
39
|
+
Q4_0_4_8 = 34,
|
|
40
|
+
Q4_0_8_8 = 35,
|
|
41
|
+
TQ1_0 = 36,
|
|
42
|
+
TQ2_0 = 37,
|
|
43
|
+
|
|
44
|
+
// custom quants used by unsloth
|
|
45
|
+
// they are not officially a scheme enum value in GGUF, but only here for naming
|
|
46
|
+
Q2_K_XL = 1000,
|
|
47
|
+
Q3_K_XL = 1001,
|
|
48
|
+
Q4_K_XL = 1002,
|
|
49
|
+
Q5_K_XL = 1003,
|
|
50
|
+
Q6_K_XL = 1004,
|
|
51
|
+
Q8_K_XL = 1005,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const ggufQuants = Object.values(GGMLFileQuantizationType).filter((v): v is string => typeof v === "string");
|
|
55
|
+
export const GGUF_QUANT_RE = new RegExp(`(?<quant>${ggufQuants.join("|")})` + "(_(?<sizeVariation>[A-Z]+))?");
|
|
56
|
+
export const GGUF_QUANT_RE_GLOBAL = new RegExp(GGUF_QUANT_RE, "g");
|
|
57
|
+
|
|
58
|
+
export function parseGGUFQuantLabel(fname: string): string | undefined {
|
|
59
|
+
const quantLabel = fname.toUpperCase().match(GGUF_QUANT_RE_GLOBAL)?.at(-1); // if there is multiple quant substrings in a name, we prefer the last one
|
|
60
|
+
return quantLabel;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// order of quantization, from biggest to smallest
|
|
64
|
+
// this list must be in sync with the order in GGMLFileQuantizationType
|
|
65
|
+
// the gguf.spec.ts tests are using verify if the order is correct
|
|
66
|
+
export const GGUF_QUANT_ORDER: GGMLFileQuantizationType[] = [
|
|
67
|
+
GGMLFileQuantizationType.F32,
|
|
68
|
+
GGMLFileQuantizationType.BF16,
|
|
69
|
+
GGMLFileQuantizationType.F16,
|
|
70
|
+
GGMLFileQuantizationType.Q8_K_XL,
|
|
71
|
+
GGMLFileQuantizationType.Q8_0,
|
|
72
|
+
|
|
73
|
+
// 6-bit quantizations
|
|
74
|
+
GGMLFileQuantizationType.Q6_K_XL,
|
|
75
|
+
GGMLFileQuantizationType.Q6_K,
|
|
76
|
+
|
|
77
|
+
// 5-bit quantizations
|
|
78
|
+
GGMLFileQuantizationType.Q5_K_XL,
|
|
79
|
+
GGMLFileQuantizationType.Q5_K_M,
|
|
80
|
+
GGMLFileQuantizationType.Q5_K_S,
|
|
81
|
+
GGMLFileQuantizationType.Q5_0,
|
|
82
|
+
GGMLFileQuantizationType.Q5_1,
|
|
83
|
+
|
|
84
|
+
// 4-bit quantizations
|
|
85
|
+
GGMLFileQuantizationType.Q4_K_XL,
|
|
86
|
+
GGMLFileQuantizationType.Q4_K_M,
|
|
87
|
+
GGMLFileQuantizationType.Q4_K_S,
|
|
88
|
+
GGMLFileQuantizationType.IQ4_NL,
|
|
89
|
+
GGMLFileQuantizationType.IQ4_XS,
|
|
90
|
+
GGMLFileQuantizationType.Q4_0_4_4,
|
|
91
|
+
GGMLFileQuantizationType.Q4_0_4_8,
|
|
92
|
+
GGMLFileQuantizationType.Q4_0_8_8,
|
|
93
|
+
GGMLFileQuantizationType.Q4_1_SOME_F16,
|
|
94
|
+
GGMLFileQuantizationType.Q4_0,
|
|
95
|
+
GGMLFileQuantizationType.Q4_1,
|
|
96
|
+
GGMLFileQuantizationType.Q4_2,
|
|
97
|
+
GGMLFileQuantizationType.Q4_3,
|
|
98
|
+
|
|
99
|
+
// 3-bit quantizations
|
|
100
|
+
GGMLFileQuantizationType.Q3_K_XL,
|
|
101
|
+
GGMLFileQuantizationType.Q3_K_L,
|
|
102
|
+
GGMLFileQuantizationType.Q3_K_M,
|
|
103
|
+
GGMLFileQuantizationType.Q3_K_S,
|
|
104
|
+
GGMLFileQuantizationType.IQ3_M,
|
|
105
|
+
GGMLFileQuantizationType.IQ3_S,
|
|
106
|
+
GGMLFileQuantizationType.IQ3_XS,
|
|
107
|
+
GGMLFileQuantizationType.IQ3_XXS,
|
|
108
|
+
|
|
109
|
+
// 2-bit quantizations
|
|
110
|
+
GGMLFileQuantizationType.Q2_K_XL,
|
|
111
|
+
GGMLFileQuantizationType.Q2_K,
|
|
112
|
+
GGMLFileQuantizationType.Q2_K_S,
|
|
113
|
+
GGMLFileQuantizationType.IQ2_M,
|
|
114
|
+
GGMLFileQuantizationType.IQ2_S,
|
|
115
|
+
GGMLFileQuantizationType.IQ2_XS,
|
|
116
|
+
GGMLFileQuantizationType.IQ2_XXS,
|
|
117
|
+
|
|
118
|
+
// 1-bit quantizations
|
|
119
|
+
GGMLFileQuantizationType.IQ1_S,
|
|
120
|
+
GGMLFileQuantizationType.IQ1_M,
|
|
121
|
+
GGMLFileQuantizationType.TQ1_0,
|
|
122
|
+
GGMLFileQuantizationType.TQ2_0,
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
// This function finds the nearest quantization type that is less than or equal to the given quantization type.
|
|
126
|
+
// It returns undefined if no such quantization type is found.
|
|
127
|
+
export function findNearestQuantType(
|
|
128
|
+
quant: GGMLFileQuantizationType,
|
|
129
|
+
availableQuants: GGMLFileQuantizationType[]
|
|
130
|
+
): GGMLFileQuantizationType | undefined {
|
|
131
|
+
// Create a map for quick index lookup from the defined order
|
|
132
|
+
const orderMap = new Map<GGMLFileQuantizationType, number>();
|
|
133
|
+
GGUF_QUANT_ORDER.forEach((q, index) => {
|
|
134
|
+
orderMap.set(q, index);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const targetIndex = orderMap.get(quant) ?? 0; // the 0 case should never happen
|
|
138
|
+
|
|
139
|
+
// Filter the available quantizations to include only those defined in the order map,
|
|
140
|
+
// then sort them according to the GGUF_QUANT_ORDER (from largest/index 0 to smallest/highest index).
|
|
141
|
+
const sortedAvailable = availableQuants
|
|
142
|
+
.filter((q) => orderMap.has(q))
|
|
143
|
+
.sort((a, b) => (orderMap.get(a) ?? Infinity) - (orderMap.get(b) ?? Infinity));
|
|
144
|
+
|
|
145
|
+
// If no valid quantizations are available after filtering
|
|
146
|
+
if (sortedAvailable.length === 0) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Iterate through the sorted available quantizations (largest to smallest).
|
|
151
|
+
// Find the first one whose order index is >= the target index.
|
|
152
|
+
// This means finding the largest quantization that is smaller than or equal to the target.
|
|
153
|
+
for (const availableQuant of sortedAvailable) {
|
|
154
|
+
// We know the key exists due to the filter above.
|
|
155
|
+
const availableIndex = orderMap.get(availableQuant) ?? 0;
|
|
156
|
+
if (availableIndex >= targetIndex) {
|
|
157
|
+
return availableQuant;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// If the loop completes, it means all available quantizations are larger (have a smaller index)
|
|
162
|
+
// than the target quantization. In this case, return the "smallest" available quantization,
|
|
163
|
+
// which is the last element in the sorted list (highest index among available).
|
|
164
|
+
return sortedAvailable[sortedAvailable.length - 1];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// This list is only used to calculate the size of the model, NOT to be confused with the quantization FILE type
|
|
1
168
|
export enum GGMLQuantizationType {
|
|
2
169
|
F32 = 0,
|
|
3
170
|
F16 = 1,
|
|
@@ -28,13 +195,6 @@ export enum GGMLQuantizationType {
|
|
|
28
195
|
F64 = 28,
|
|
29
196
|
IQ1_M = 29,
|
|
30
197
|
BF16 = 30,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const ggufQuants = Object.values(GGMLQuantizationType).filter((v): v is string => typeof v === "string");
|
|
34
|
-
export const GGUF_QUANT_RE = new RegExp(`(?<quant>${ggufQuants.join("|")})` + "(_(?<sizeVariation>[A-Z]+))?");
|
|
35
|
-
export const GGUF_QUANT_RE_GLOBAL = new RegExp(GGUF_QUANT_RE, "g");
|
|
36
|
-
|
|
37
|
-
export function parseGGUFQuantLabel(fname: string): string | undefined {
|
|
38
|
-
const quantLabel = fname.toUpperCase().match(GGUF_QUANT_RE_GLOBAL)?.at(-1); // if there is multiple quant substrings in a name, we prefer the last one
|
|
39
|
-
return quantLabel;
|
|
198
|
+
TQ1_0 = 34,
|
|
199
|
+
TQ2_0 = 35,
|
|
40
200
|
}
|
package/src/local-apps.ts
CHANGED
|
@@ -262,6 +262,41 @@ const snippetTgi = (model: ModelData): LocalAppSnippet[] => {
|
|
|
262
262
|
];
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
+
const snippetMlxLm = (model: ModelData): LocalAppSnippet[] => {
|
|
266
|
+
const openaiCurl = [
|
|
267
|
+
"# Calling the OpenAI-compatible server with curl",
|
|
268
|
+
`curl -X POST "http://localhost:8000/v1/chat/completions" \\`,
|
|
269
|
+
` -H "Content-Type: application/json" \\`,
|
|
270
|
+
` --data '{`,
|
|
271
|
+
` "model": "${model.id}",`,
|
|
272
|
+
` "messages": [`,
|
|
273
|
+
` {"role": "user", "content": "Hello"}`,
|
|
274
|
+
` ]`,
|
|
275
|
+
` }'`,
|
|
276
|
+
];
|
|
277
|
+
|
|
278
|
+
return [
|
|
279
|
+
{
|
|
280
|
+
title: "Generate or start a chat session",
|
|
281
|
+
setup: ["# Install MLX LM", "uv tool install mlx-lm"].join("\n"),
|
|
282
|
+
content: [
|
|
283
|
+
...(model.tags.includes("conversational")
|
|
284
|
+
? ["# Interactive chat REPL", `mlx_lm.chat --model "${model.id}"`]
|
|
285
|
+
: ["# Generate some text", `mlx_lm.generate --model "${model.id}" --prompt "Once upon a time"`]),
|
|
286
|
+
].join("\n"),
|
|
287
|
+
},
|
|
288
|
+
...(model.tags.includes("conversational")
|
|
289
|
+
? [
|
|
290
|
+
{
|
|
291
|
+
title: "Run an OpenAI-compatible server",
|
|
292
|
+
setup: ["# Install MLX LM", "uv tool install mlx-lm"].join("\n"),
|
|
293
|
+
content: ["# Start the server", `mlx_lm.server --model "${model.id}"`, ...openaiCurl].join("\n"),
|
|
294
|
+
},
|
|
295
|
+
]
|
|
296
|
+
: []),
|
|
297
|
+
];
|
|
298
|
+
};
|
|
299
|
+
|
|
265
300
|
/**
|
|
266
301
|
* Add your new local app here.
|
|
267
302
|
*
|
|
@@ -302,6 +337,13 @@ export const LOCAL_APPS = {
|
|
|
302
337
|
(model.pipeline_tag === "text-generation" || model.pipeline_tag === "image-text-to-text"),
|
|
303
338
|
snippet: snippetVllm,
|
|
304
339
|
},
|
|
340
|
+
"mlx-lm": {
|
|
341
|
+
prettyLabel: "MLX LM",
|
|
342
|
+
docsUrl: "https://github.com/ml-explore/mlx-lm",
|
|
343
|
+
mainTask: "text-generation",
|
|
344
|
+
displayOnModelPage: (model) => model.pipeline_tag === "text-generation" && isMlxModel(model),
|
|
345
|
+
snippet: snippetMlxLm,
|
|
346
|
+
},
|
|
305
347
|
tgi: {
|
|
306
348
|
prettyLabel: "TGI",
|
|
307
349
|
docsUrl: "https://huggingface.co/docs/text-generation-inference/",
|
|
@@ -237,6 +237,20 @@ output = model.generate(text)
|
|
|
237
237
|
sf.write("simple.mp3", output, 44100)`,
|
|
238
238
|
];
|
|
239
239
|
|
|
240
|
+
export const describe_anything = (model: ModelData): string[] => [
|
|
241
|
+
`# pip install git+https://github.com/NVlabs/describe-anything
|
|
242
|
+
from huggingface_hub import snapshot_download
|
|
243
|
+
from dam import DescribeAnythingModel
|
|
244
|
+
|
|
245
|
+
snapshot_download(${model.id}, local_dir="checkpoints")
|
|
246
|
+
|
|
247
|
+
dam = DescribeAnythingModel(
|
|
248
|
+
model_path="checkpoints",
|
|
249
|
+
conv_mode="v1",
|
|
250
|
+
prompt_mode="focal_prompt",
|
|
251
|
+
)`,
|
|
252
|
+
];
|
|
253
|
+
|
|
240
254
|
const diffusersDefaultPrompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k";
|
|
241
255
|
|
|
242
256
|
const diffusers_default = (model: ModelData) => [
|
|
@@ -727,6 +741,17 @@ model = pe.VisionTransformer.from_config("${model.id}", pretrained=True)`;
|
|
|
727
741
|
return [vision_encoder];
|
|
728
742
|
}
|
|
729
743
|
};
|
|
744
|
+
export const phantom_wan = (model: ModelData): string[] => [
|
|
745
|
+
`from huggingface_hub import snapshot_download
|
|
746
|
+
from phantom_wan import WANI2V, configs
|
|
747
|
+
|
|
748
|
+
checkpoint_dir = snapshot_download("${model.id}")
|
|
749
|
+
wan_i2v = WanI2V(
|
|
750
|
+
config=configs.WAN_CONFIGS['i2v-14B'],
|
|
751
|
+
checkpoint_dir=checkpoint_dir,
|
|
752
|
+
)
|
|
753
|
+
video = wan_i2v.generate(text_prompt, image_prompt)`,
|
|
754
|
+
];
|
|
730
755
|
|
|
731
756
|
export const pyannote_audio_pipeline = (model: ModelData): string[] => [
|
|
732
757
|
`from pyannote.audio import Pipeline
|
|
@@ -1117,13 +1142,31 @@ export const transformers = (model: ModelData): string[] => {
|
|
|
1117
1142
|
}
|
|
1118
1143
|
|
|
1119
1144
|
if (model.pipeline_tag && LIBRARY_TASK_MAPPING.transformers?.includes(model.pipeline_tag)) {
|
|
1120
|
-
const pipelineSnippet = [
|
|
1145
|
+
const pipelineSnippet = [
|
|
1146
|
+
"# Use a pipeline as a high-level helper",
|
|
1147
|
+
"from transformers import pipeline",
|
|
1148
|
+
"",
|
|
1149
|
+
`pipe = pipeline("${model.pipeline_tag}", model="${model.id}"` + remote_code_snippet + ")",
|
|
1150
|
+
];
|
|
1121
1151
|
|
|
1122
|
-
if (model.tags.includes("conversational")
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1152
|
+
if (model.tags.includes("conversational")) {
|
|
1153
|
+
if (model.tags.includes("image-text-to-text")) {
|
|
1154
|
+
pipelineSnippet.push(
|
|
1155
|
+
"messages = [",
|
|
1156
|
+
[
|
|
1157
|
+
" {",
|
|
1158
|
+
' "role": "user",',
|
|
1159
|
+
' "content": [',
|
|
1160
|
+
' {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},',
|
|
1161
|
+
' {"type": "text", "text": "What animal is on the candy?"}',
|
|
1162
|
+
" ]",
|
|
1163
|
+
" },",
|
|
1164
|
+
].join("\n"),
|
|
1165
|
+
"]"
|
|
1166
|
+
);
|
|
1167
|
+
} else {
|
|
1168
|
+
pipelineSnippet.push("messages = [", ' {"role": "user", "content": "Who are you?"},', "]");
|
|
1169
|
+
}
|
|
1127
1170
|
pipelineSnippet.push("pipe(messages)");
|
|
1128
1171
|
}
|
|
1129
1172
|
|
|
@@ -1310,30 +1353,66 @@ model = SwarmFormerModel.from_pretrained("${model.id}")
|
|
|
1310
1353
|
];
|
|
1311
1354
|
|
|
1312
1355
|
const mlx_unknown = (model: ModelData): string[] => [
|
|
1313
|
-
|
|
1356
|
+
`# Download the model from the Hub
|
|
1357
|
+
pip install huggingface_hub hf_transfer
|
|
1314
1358
|
|
|
1315
1359
|
export HF_HUB_ENABLE_HF_TRANSFER=1
|
|
1316
1360
|
huggingface-cli download --local-dir ${nameWithoutNamespace(model.id)} ${model.id}`,
|
|
1317
1361
|
];
|
|
1318
1362
|
|
|
1319
1363
|
const mlxlm = (model: ModelData): string[] => [
|
|
1320
|
-
|
|
1364
|
+
`# Make sure mlx-lm is installed
|
|
1365
|
+
pip install --upgrade mlx-lm
|
|
1366
|
+
|
|
1367
|
+
# Generate text with mlx-lm
|
|
1368
|
+
from mlx_lm import load, generate
|
|
1369
|
+
|
|
1370
|
+
model, tokenizer = load("${model.id}")
|
|
1321
1371
|
|
|
1322
|
-
|
|
1372
|
+
prompt = "Once upon a time in"
|
|
1373
|
+
text = generate(model, tokenizer, prompt=prompt, verbose=True)`,
|
|
1323
1374
|
];
|
|
1324
1375
|
|
|
1325
1376
|
const mlxchat = (model: ModelData): string[] => [
|
|
1326
|
-
|
|
1377
|
+
`# Make sure mlx-lm is installed
|
|
1378
|
+
pip install --upgrade mlx-lm
|
|
1327
1379
|
|
|
1328
|
-
|
|
1380
|
+
# Generate text with mlx-lm
|
|
1381
|
+
from mlx_lm import load, generate
|
|
1382
|
+
|
|
1383
|
+
model, tokenizer = load("${model.id}")
|
|
1384
|
+
|
|
1385
|
+
prompt = "Write a story about Einstein"
|
|
1386
|
+
messages = [{"role": "user", "content": prompt}]
|
|
1387
|
+
prompt = tokenizer.apply_chat_template(
|
|
1388
|
+
messages, add_generation_prompt=True
|
|
1389
|
+
)
|
|
1390
|
+
|
|
1391
|
+
text = generate(model, tokenizer, prompt=prompt, verbose=True)`,
|
|
1329
1392
|
];
|
|
1330
1393
|
|
|
1331
1394
|
const mlxvlm = (model: ModelData): string[] => [
|
|
1332
|
-
`
|
|
1395
|
+
`Make sure mlx-vlm is installed
|
|
1396
|
+
from mlx_vlm import load, generate
|
|
1397
|
+
from mlx_vlm.prompt_utils import apply_chat_template
|
|
1398
|
+
from mlx_vlm.utils import load_config
|
|
1399
|
+
|
|
1400
|
+
# Load the model
|
|
1401
|
+
model, processor = load("${model.id}")
|
|
1402
|
+
config = load_config("${model.id}")
|
|
1403
|
+
|
|
1404
|
+
# Prepare input
|
|
1405
|
+
image = ["http://images.cocodataset.org/val2017/000000039769.jpg"]
|
|
1406
|
+
prompt = "Describe this image."
|
|
1407
|
+
|
|
1408
|
+
# Apply chat template
|
|
1409
|
+
formatted_prompt = apply_chat_template(
|
|
1410
|
+
processor, config, prompt, num_images=1
|
|
1411
|
+
)
|
|
1333
1412
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1413
|
+
# Generate output
|
|
1414
|
+
output = generate(model, processor, formatted_prompt, image)
|
|
1415
|
+
print(output)`,
|
|
1337
1416
|
];
|
|
1338
1417
|
|
|
1339
1418
|
export const mlxim = (model: ModelData): string[] => [
|
|
@@ -1343,11 +1422,11 @@ model = create_model(${model.id})`,
|
|
|
1343
1422
|
];
|
|
1344
1423
|
|
|
1345
1424
|
export const mlx = (model: ModelData): string[] => {
|
|
1346
|
-
if (model.
|
|
1425
|
+
if (model.pipeline_tag === "image-text-to-text") {
|
|
1347
1426
|
return mlxvlm(model);
|
|
1348
1427
|
}
|
|
1349
|
-
if (model.
|
|
1350
|
-
if (model.
|
|
1428
|
+
if (model.pipeline_tag === "text-generation") {
|
|
1429
|
+
if (model.tags.includes("conversational")) {
|
|
1351
1430
|
return mlxchat(model);
|
|
1352
1431
|
} else {
|
|
1353
1432
|
return mlxlm(model);
|
|
@@ -1482,4 +1561,23 @@ export const hezar = (model: ModelData): string[] => [
|
|
|
1482
1561
|
|
|
1483
1562
|
model = Model.load("${model.id}")`,
|
|
1484
1563
|
];
|
|
1564
|
+
|
|
1565
|
+
export const zonos = (model: ModelData): string[] => [
|
|
1566
|
+
`# pip install git+https://github.com/Zyphra/Zonos.git
|
|
1567
|
+
import torchaudio
|
|
1568
|
+
from zonos.model import Zonos
|
|
1569
|
+
from zonos.conditioning import make_cond_dict
|
|
1570
|
+
|
|
1571
|
+
model = Zonos.from_pretrained("${model.id}", device="cuda")
|
|
1572
|
+
|
|
1573
|
+
wav, sr = torchaudio.load("speaker.wav") # 5-10s reference clip
|
|
1574
|
+
speaker = model.make_speaker_embedding(wav, sr)
|
|
1575
|
+
|
|
1576
|
+
cond = make_cond_dict(text="Hello, world!", speaker=speaker, language="en-us")
|
|
1577
|
+
codes = model.generate(model.prepare_conditioning(cond))
|
|
1578
|
+
|
|
1579
|
+
audio = model.autoencoder.decode(codes)[0].cpu()
|
|
1580
|
+
torchaudio.save("sample.wav", audio, model.autoencoder.sampling_rate)
|
|
1581
|
+
`,
|
|
1582
|
+
];
|
|
1485
1583
|
//#endregion
|
package/src/model-libraries.ts
CHANGED
|
@@ -230,6 +230,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
230
230
|
filter: false,
|
|
231
231
|
countDownloads: `path:"scin_dataset_precomputed_embeddings.npz" OR path:"saved_model.pb"`,
|
|
232
232
|
},
|
|
233
|
+
"describe-anything": {
|
|
234
|
+
prettyLabel: "Describe Anything",
|
|
235
|
+
repoName: "Describe Anything",
|
|
236
|
+
repoUrl: "https://github.com/NVlabs/describe-anything",
|
|
237
|
+
snippets: snippets.describe_anything,
|
|
238
|
+
filter: false,
|
|
239
|
+
},
|
|
233
240
|
"dia-tts": {
|
|
234
241
|
prettyLabel: "Dia",
|
|
235
242
|
repoName: "Dia",
|
|
@@ -662,6 +669,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
662
669
|
snippets: snippets.perception_encoder,
|
|
663
670
|
countDownloads: `path_extension:"pt"`,
|
|
664
671
|
},
|
|
672
|
+
"phantom-wan": {
|
|
673
|
+
prettyLabel: "Phantom",
|
|
674
|
+
repoName: "Phantom",
|
|
675
|
+
repoUrl: "https://github.com/Phantom-video/Phantom",
|
|
676
|
+
snippets: snippets.phantom_wan,
|
|
677
|
+
filter: false,
|
|
678
|
+
countDownloads: `path_extension:"pth"`,
|
|
679
|
+
},
|
|
665
680
|
pxia: {
|
|
666
681
|
prettyLabel: "pxia",
|
|
667
682
|
repoName: "pxia",
|
|
@@ -1009,6 +1024,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
1009
1024
|
countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
|
|
1010
1025
|
snippets: snippets.ultralytics,
|
|
1011
1026
|
},
|
|
1027
|
+
zonos: {
|
|
1028
|
+
prettyLabel: "Zonos",
|
|
1029
|
+
repoName: "Zonos",
|
|
1030
|
+
repoUrl: "https://github.com/Zyphra/Zonos",
|
|
1031
|
+
docsUrl: "https://github.com/Zyphra/Zonos",
|
|
1032
|
+
snippets: snippets.zonos,
|
|
1033
|
+
filter: false,
|
|
1034
|
+
},
|
|
1012
1035
|
"3dtopia-xl": {
|
|
1013
1036
|
prettyLabel: "3DTopia-XL",
|
|
1014
1037
|
repoName: "3DTopia-XL",
|
package/src/tasks/index.ts
CHANGED
|
@@ -184,7 +184,7 @@ export const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]> = {
|
|
|
184
184
|
/**
|
|
185
185
|
* Return the whole TaskData object for a certain task.
|
|
186
186
|
* If the partialTaskData argument is left undefined,
|
|
187
|
-
* the default
|
|
187
|
+
* the default placeholder data will be used.
|
|
188
188
|
*/
|
|
189
189
|
function getData(type: PipelineType, partialTaskData: TaskDataCustom = placeholder): TaskData {
|
|
190
190
|
return {
|
|
@@ -111,7 +111,7 @@ env = gym.make("LunarLander-v2")
|
|
|
111
111
|
# Loading the saved model
|
|
112
112
|
model = PPO.load("PPO-LunarLander-v2",env=env)
|
|
113
113
|
|
|
114
|
-
#
|
|
114
|
+
# Initializing the evaluation environment
|
|
115
115
|
eval_env = gym.make("LunarLander-v2")
|
|
116
116
|
|
|
117
117
|
# Running the trained agent on eval_env for 10 time steps and getting the mean reward
|