@huggingface/tasks 0.20.3 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,7 @@ export declare enum GGMLFileQuantizationType {
38
38
  TQ1_0 = 36,
39
39
  TQ2_0 = 37,
40
40
  MXFP4_MOE = 38,
41
+ NVFP4 = 39,
41
42
  Q2_K_XL = 1000,
42
43
  Q3_K_XL = 1001,
43
44
  Q4_K_XL = 1002,
@@ -82,6 +83,7 @@ export declare enum GGMLQuantizationType {
82
83
  BF16 = 30,
83
84
  TQ1_0 = 34,
84
85
  TQ2_0 = 35,
85
- MXFP4 = 39
86
+ MXFP4 = 39,
87
+ NVFP4 = 40
86
88
  }
87
89
  //# sourceMappingURL=gguf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gguf.d.ts","sourceRoot":"","sources":["../../src/gguf.ts"],"names":[],"mappings":"AAGA,oBAAY,wBAAwB;IACnC,GAAG,IAAI;IACP,GAAG,IAAI;IACP,IAAI,IAAI;IACR,IAAI,IAAI;IACR,aAAa,IAAI;IACjB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,KAAK;IACT,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,OAAO,KAAK;IACZ,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,IAAI,KAAK;IACT,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,KAAK,KAAK;I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IAAI,KAAK;IACT,IAAI,KAAK;IACT,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,OAAO,KAAK;IACZ,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,KAAK,KAAK;IACV,MAAM,KAAK;IACX,EAAE,KAAK;IACP,GAAG,KAAK;IACR,GAAG,KAAK;IACR,GAAG,KAAK;IACR,GAAG,KAAK;IACR,KAAK,KAAK;IACV,IAAI,KAAK;IACT,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;CACV"}
@@ -47,6 +47,7 @@ var GGMLFileQuantizationType;
47
47
  GGMLFileQuantizationType[GGMLFileQuantizationType["TQ1_0"] = 36] = "TQ1_0";
48
48
  GGMLFileQuantizationType[GGMLFileQuantizationType["TQ2_0"] = 37] = "TQ2_0";
49
49
  GGMLFileQuantizationType[GGMLFileQuantizationType["MXFP4_MOE"] = 38] = "MXFP4_MOE";
50
+ GGMLFileQuantizationType[GGMLFileQuantizationType["NVFP4"] = 39] = "NVFP4";
50
51
  // custom quants used by unsloth
51
52
  // they are not officially a scheme enum value in GGUF, but only here for naming
52
53
  GGMLFileQuantizationType[GGMLFileQuantizationType["Q2_K_XL"] = 1000] = "Q2_K_XL";
@@ -96,6 +97,7 @@ exports.GGUF_QUANT_ORDER = [
96
97
  GGMLFileQuantizationType.Q4_2,
97
98
  GGMLFileQuantizationType.Q4_3,
98
99
  GGMLFileQuantizationType.MXFP4_MOE,
100
+ GGMLFileQuantizationType.NVFP4,
99
101
  // 3-bit quantizations
100
102
  GGMLFileQuantizationType.Q3_K_XL,
101
103
  GGMLFileQuantizationType.Q3_K_L,
@@ -187,4 +189,5 @@ var GGMLQuantizationType;
187
189
  GGMLQuantizationType[GGMLQuantizationType["TQ1_0"] = 34] = "TQ1_0";
188
190
  GGMLQuantizationType[GGMLQuantizationType["TQ2_0"] = 35] = "TQ2_0";
189
191
  GGMLQuantizationType[GGMLQuantizationType["MXFP4"] = 39] = "MXFP4";
192
+ GGMLQuantizationType[GGMLQuantizationType["NVFP4"] = 40] = "NVFP4";
190
193
  })(GGMLQuantizationType || (exports.GGMLQuantizationType = GGMLQuantizationType = {}));
@@ -56,6 +56,7 @@ declare function isTgiModel(model: ModelData): boolean;
56
56
  declare function isLlamaCppGgufModel(model: ModelData): boolean;
57
57
  declare function isVllmModel(model: ModelData): boolean;
58
58
  declare function isDockerModelRunnerModel(model: ModelData): boolean;
59
+ declare function isUnslothModel(model: ModelData): boolean;
59
60
  /**
60
61
  * Add your new local app here.
61
62
  *
@@ -198,6 +199,13 @@ export declare const LOCAL_APPS: {
198
199
  displayOnModelPage: typeof isLlamaCppGgufModel;
199
200
  snippet: (model: ModelData, filepath?: string) => string;
200
201
  };
202
+ unsloth: {
203
+ prettyLabel: string;
204
+ docsUrl: string;
205
+ mainTask: "text-generation";
206
+ displayOnModelPage: typeof isUnslothModel;
207
+ snippet: (model: ModelData) => LocalAppSnippet[];
208
+ };
201
209
  "docker-model-runner": {
202
210
  prettyLabel: string;
203
211
  docsUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"local-apps.d.ts","sourceRoot":"","sources":["../../src/local-apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKnD,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB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EAAE,SAAS,GAAG,OAAO,CAE7C;AAED,iBAAS,mBAAmB,CAAC,KAAK,EAAE,SAAS,WAE5C;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAU9C;AAED,iBAAS,wBAAwB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE3D;AAUD,iBAAS,cAAc,CAAC,KAAK,EAAE,SAAS,WAEvC;AAmZD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;;;;;;yBAjZS,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;yBAiDzC,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;yBAmF3D,SAAS,KAAG,eAAe,EAAE;;;;;;oCAuS3B,SAAS;yBAjPT,SAAS,KAAG,eAAe,EAAE;;;;;;;yBAoF9B,SAAS,KAAG,eAAe,EAAE;;;;;;;yBA7B/B,SAAS,KAAG,eAAe,EAAE;;;;;;;;;;;;;;yBApIzB,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA9CjD,SAAS,aAAa,MAAM,KAAG,MAAM;;;;;;;yBAIpC,SAAS,KAAG,eAAe,EAAE;;;;;;;yBAmRnB,SAAS,aAAa,MAAM,KAAG,MAAM;;;;;;;yBAM9C,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;yBA3CtD,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;CA0RtC,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,UAAU,CAAC"}
@@ -43,6 +43,9 @@ function isAmdRyzenModel(model) {
43
43
  function isMlxModel(model) {
44
44
  return model.tags.includes("mlx");
45
45
  }
46
+ function isUnslothModel(model) {
47
+ return model.tags.includes("unsloth") || isLlamaCppGgufModel(model);
48
+ }
46
49
  function getQuantTag(filepath) {
47
50
  const defaultTag = ":{{QUANT_TAG}}";
48
51
  if (!filepath) {
@@ -115,6 +118,43 @@ const snippetNodeLlamaCppCli = (model, filepath) => {
115
118
  const snippetOllama = (model, filepath) => {
116
119
  return `ollama run hf.co/${model.id}${getQuantTag(filepath)}`;
117
120
  };
121
+ const snippetUnsloth = (model) => {
122
+ const isGguf = isLlamaCppGgufModel(model);
123
+ const studio_instructions = {
124
+ title: "Open model in Unsloth Studio",
125
+ setup: ["pip install unsloth", "unsloth studio setup"].join("\n"),
126
+ content: [
127
+ "# Run unsloth studio",
128
+ "unsloth studio -H 0.0.0.0 -p 8000",
129
+ "# Then open http://localhost:8000/chat in your browser",
130
+ "# Search for " + model.id + " to start chatting",
131
+ ].join("\n"),
132
+ };
133
+ const hf_spaces_instructions = {
134
+ title: "Using HuggingFace Spaces for Unsloth",
135
+ setup: "# No setup required",
136
+ content: "# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for " +
137
+ model.id +
138
+ " to start chatting",
139
+ };
140
+ const fastmodel_instructions = {
141
+ title: "Load model with FastModel",
142
+ setup: "pip install unsloth",
143
+ content: [
144
+ "from unsloth import FastModel",
145
+ "model, tokenizer = FastModel.from_pretrained(",
146
+ ' model_name="' + model.id + '",',
147
+ " max_seq_length=2048,",
148
+ ")",
149
+ ].join("\n"),
150
+ };
151
+ if (isGguf) {
152
+ return [studio_instructions, hf_spaces_instructions];
153
+ }
154
+ else {
155
+ return [studio_instructions, hf_spaces_instructions, fastmodel_instructions];
156
+ }
157
+ };
118
158
  const snippetLocalAI = (model, filepath) => {
119
159
  const command = (binary) => ["# Load and run the model:", `${binary} huggingface://${model.id}/${filepath ?? "{{GGUF_FILE}}"}`].join("\n");
120
160
  return [
@@ -539,6 +579,13 @@ exports.LOCAL_APPS = {
539
579
  displayOnModelPage: isLlamaCppGgufModel,
540
580
  snippet: snippetOllama,
541
581
  },
582
+ unsloth: {
583
+ prettyLabel: "Unsloth",
584
+ docsUrl: "https://unsloth.ai/docs",
585
+ mainTask: "text-generation",
586
+ displayOnModelPage: isUnslothModel,
587
+ snippet: snippetUnsloth,
588
+ },
542
589
  "docker-model-runner": {
543
590
  prettyLabel: "Docker Model Runner",
544
591
  docsUrl: "https://docs.docker.com/ai/model-runner/",
@@ -137,4 +137,55 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
137
137
  const snippet = snippetFunc(model);
138
138
  (0, vitest_1.expect)(snippet).toEqual(`docker model run hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
139
139
  });
140
+ (0, vitest_1.it)("unsloth tagged model", async () => {
141
+ const { displayOnModelPage, snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS.unsloth;
142
+ const model = {
143
+ id: "some-user/my-unsloth-finetune",
144
+ tags: ["unsloth", "conversational"],
145
+ inference: "",
146
+ };
147
+ (0, vitest_1.expect)(displayOnModelPage(model)).toBe(true);
148
+ const snippet = snippetFunc(model);
149
+ (0, vitest_1.expect)(snippet[0].setup).toBe("pip install unsloth\nunsloth studio setup");
150
+ (0, vitest_1.expect)(snippet[0].content).toBe("# Run unsloth studio\nunsloth studio -H 0.0.0.0 -p 8000\n# Then open http://localhost:8000/chat in your browser\n# Search for some-user/my-unsloth-finetune to start chatting");
151
+ (0, vitest_1.expect)(snippet[1].setup).toBe("# No setup required");
152
+ (0, vitest_1.expect)(snippet[1].content).toBe("# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for some-user/my-unsloth-finetune to start chatting");
153
+ (0, vitest_1.expect)(snippet[2].setup).toBe("pip install unsloth");
154
+ (0, vitest_1.expect)(snippet[2].content).toBe('from unsloth import FastModel\nmodel, tokenizer = FastModel.from_pretrained(\n model_name="some-user/my-unsloth-finetune",\n max_seq_length=2048,\n)');
155
+ });
156
+ (0, vitest_1.it)("unsloth namespace gguf model", async () => {
157
+ const { displayOnModelPage, snippet: snippetFunc } = local_apps_js_1.LOCAL_APPS.unsloth;
158
+ const model = {
159
+ id: "unsloth/Llama-3.2-3B-Instruct-GGUF",
160
+ tags: ["conversational"],
161
+ gguf: { total: 1, context_length: 4096 },
162
+ inference: "",
163
+ };
164
+ (0, vitest_1.expect)(displayOnModelPage(model)).toBe(true);
165
+ const snippet = snippetFunc(model);
166
+ (0, vitest_1.expect)(snippet[0].setup).toBe("pip install unsloth\nunsloth studio setup");
167
+ (0, vitest_1.expect)(snippet[0].content).toBe("# Run unsloth studio\nunsloth studio -H 0.0.0.0 -p 8000\n# Then open http://localhost:8000/chat in your browser\n# Search for unsloth/Llama-3.2-3B-Instruct-GGUF to start chatting");
168
+ (0, vitest_1.expect)(snippet[1].setup).toBe("# No setup required");
169
+ (0, vitest_1.expect)(snippet[1].content).toBe("# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for unsloth/Llama-3.2-3B-Instruct-GGUF to start chatting");
170
+ (0, vitest_1.expect)(snippet).toHaveLength(2); // GGUF models only get 2 snippets
171
+ });
172
+ (0, vitest_1.it)("non unsloth namespace gguf model", async () => {
173
+ const { displayOnModelPage } = local_apps_js_1.LOCAL_APPS.unsloth;
174
+ const model = {
175
+ id: "dummy/Llama-3.2-3B-Instruct-GGUF",
176
+ tags: ["conversational"],
177
+ gguf: { total: 1, context_length: 4096 },
178
+ inference: "",
179
+ };
180
+ (0, vitest_1.expect)(displayOnModelPage(model)).toBe(true);
181
+ });
182
+ (0, vitest_1.it)("unsloth not shown for unrelated model", async () => {
183
+ const { displayOnModelPage } = local_apps_js_1.LOCAL_APPS.unsloth;
184
+ const model = {
185
+ id: "meta-llama/Llama-3.2-3B-Instruct",
186
+ tags: ["conversational"],
187
+ inference: "",
188
+ };
189
+ (0, vitest_1.expect)(displayOnModelPage(model)).toBe(false);
190
+ });
140
191
  });
@@ -38,6 +38,7 @@ export declare enum GGMLFileQuantizationType {
38
38
  TQ1_0 = 36,
39
39
  TQ2_0 = 37,
40
40
  MXFP4_MOE = 38,
41
+ NVFP4 = 39,
41
42
  Q2_K_XL = 1000,
42
43
  Q3_K_XL = 1001,
43
44
  Q4_K_XL = 1002,
@@ -82,6 +83,7 @@ export declare enum GGMLQuantizationType {
82
83
  BF16 = 30,
83
84
  TQ1_0 = 34,
84
85
  TQ2_0 = 35,
85
- MXFP4 = 39
86
+ MXFP4 = 39,
87
+ NVFP4 = 40
86
88
  }
87
89
  //# sourceMappingURL=gguf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gguf.d.ts","sourceRoot":"","sources":["../../src/gguf.ts"],"names":[],"mappings":"AAGA,oBAAY,wBAAwB;IACnC,GAAG,IAAI;IACP,GAAG,IAAI;IACP,IAAI,IAAI;IACR,IAAI,IAAI;IACR,aAAa,IAAI;IACjB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,KAAK;IACT,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,OAAO,KAAK;IACZ,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,IAAI,KAAK;IACT,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,KAAK,KAAK;IACV,KAAK,KAAK;IACV,SAAS,KAAK;IAId,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;CACd;AAGD,eAAO,MAAM,aAAa,QAEzB,CAAC;AACF,eAAO,MAAM,oBAAoB,QAAiC,CAAC;AAEnE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,C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,IAAI,KAAK;IACT,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;IACV,KAAK,KAAK;CACV"}
package/dist/esm/gguf.js CHANGED
@@ -42,6 +42,7 @@ export var GGMLFileQuantizationType;
42
42
  GGMLFileQuantizationType[GGMLFileQuantizationType["TQ1_0"] = 36] = "TQ1_0";
43
43
  GGMLFileQuantizationType[GGMLFileQuantizationType["TQ2_0"] = 37] = "TQ2_0";
44
44
  GGMLFileQuantizationType[GGMLFileQuantizationType["MXFP4_MOE"] = 38] = "MXFP4_MOE";
45
+ GGMLFileQuantizationType[GGMLFileQuantizationType["NVFP4"] = 39] = "NVFP4";
45
46
  // custom quants used by unsloth
46
47
  // they are not officially a scheme enum value in GGUF, but only here for naming
47
48
  GGMLFileQuantizationType[GGMLFileQuantizationType["Q2_K_XL"] = 1000] = "Q2_K_XL";
@@ -91,6 +92,7 @@ export const GGUF_QUANT_ORDER = [
91
92
  GGMLFileQuantizationType.Q4_2,
92
93
  GGMLFileQuantizationType.Q4_3,
93
94
  GGMLFileQuantizationType.MXFP4_MOE,
95
+ GGMLFileQuantizationType.NVFP4,
94
96
  // 3-bit quantizations
95
97
  GGMLFileQuantizationType.Q3_K_XL,
96
98
  GGMLFileQuantizationType.Q3_K_L,
@@ -182,4 +184,5 @@ export var GGMLQuantizationType;
182
184
  GGMLQuantizationType[GGMLQuantizationType["TQ1_0"] = 34] = "TQ1_0";
183
185
  GGMLQuantizationType[GGMLQuantizationType["TQ2_0"] = 35] = "TQ2_0";
184
186
  GGMLQuantizationType[GGMLQuantizationType["MXFP4"] = 39] = "MXFP4";
187
+ GGMLQuantizationType[GGMLQuantizationType["NVFP4"] = 40] = "NVFP4";
185
188
  })(GGMLQuantizationType || (GGMLQuantizationType = {}));
@@ -56,6 +56,7 @@ declare function isTgiModel(model: ModelData): boolean;
56
56
  declare function isLlamaCppGgufModel(model: ModelData): boolean;
57
57
  declare function isVllmModel(model: ModelData): boolean;
58
58
  declare function isDockerModelRunnerModel(model: ModelData): boolean;
59
+ declare function isUnslothModel(model: ModelData): boolean;
59
60
  /**
60
61
  * Add your new local app here.
61
62
  *
@@ -198,6 +199,13 @@ export declare const LOCAL_APPS: {
198
199
  displayOnModelPage: typeof isLlamaCppGgufModel;
199
200
  snippet: (model: ModelData, filepath?: string) => string;
200
201
  };
202
+ unsloth: {
203
+ prettyLabel: string;
204
+ docsUrl: string;
205
+ mainTask: "text-generation";
206
+ displayOnModelPage: typeof isUnslothModel;
207
+ snippet: (model: ModelData) => LocalAppSnippet[];
208
+ };
201
209
  "docker-model-runner": {
202
210
  prettyLabel: string;
203
211
  docsUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"local-apps.d.ts","sourceRoot":"","sources":["../../src/local-apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKnD,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,kBAAkB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;CAClD,GAAG,CACD;IACA;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;CACtD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G;AACH,eAAO,MAAM,UAAU;;;;;;yBAjZS,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;yBAiDzC,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;yBAmF3D,SAAS,KAAG,eAAe,EAAE;;;;;;oCAuS3B,SAAS;yBAjPT,SAAS,KAAG,eAAe,EAAE;;;;;;;yBAoF9B,SAAS,KAAG,eAAe,EAAE;;;;;;;yBA7B/B,SAAS,KAAG,eAAe,EAAE;;;;;;;;;;;;;;yBApIzB,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA9CjD,SAAS,aAAa,MAAM,KAAG,MAAM;;;;;;;yBAIpC,SAAS,KAAG,eAAe,EAAE;;;;;;;yBAmRnB,SAAS,aAAa,MAAM,KAAG,MAAM;;;;;;;yBAM9C,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;;;;;;yBA3CtD,SAAS,aAAa,MAAM,KAAG,eAAe,EAAE;;CA0RtC,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,UAAU,CAAC"}
@@ -40,6 +40,9 @@ function isAmdRyzenModel(model) {
40
40
  function isMlxModel(model) {
41
41
  return model.tags.includes("mlx");
42
42
  }
43
+ function isUnslothModel(model) {
44
+ return model.tags.includes("unsloth") || isLlamaCppGgufModel(model);
45
+ }
43
46
  function getQuantTag(filepath) {
44
47
  const defaultTag = ":{{QUANT_TAG}}";
45
48
  if (!filepath) {
@@ -112,6 +115,43 @@ const snippetNodeLlamaCppCli = (model, filepath) => {
112
115
  const snippetOllama = (model, filepath) => {
113
116
  return `ollama run hf.co/${model.id}${getQuantTag(filepath)}`;
114
117
  };
118
+ const snippetUnsloth = (model) => {
119
+ const isGguf = isLlamaCppGgufModel(model);
120
+ const studio_instructions = {
121
+ title: "Open model in Unsloth Studio",
122
+ setup: ["pip install unsloth", "unsloth studio setup"].join("\n"),
123
+ content: [
124
+ "# Run unsloth studio",
125
+ "unsloth studio -H 0.0.0.0 -p 8000",
126
+ "# Then open http://localhost:8000/chat in your browser",
127
+ "# Search for " + model.id + " to start chatting",
128
+ ].join("\n"),
129
+ };
130
+ const hf_spaces_instructions = {
131
+ title: "Using HuggingFace Spaces for Unsloth",
132
+ setup: "# No setup required",
133
+ content: "# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for " +
134
+ model.id +
135
+ " to start chatting",
136
+ };
137
+ const fastmodel_instructions = {
138
+ title: "Load model with FastModel",
139
+ setup: "pip install unsloth",
140
+ content: [
141
+ "from unsloth import FastModel",
142
+ "model, tokenizer = FastModel.from_pretrained(",
143
+ ' model_name="' + model.id + '",',
144
+ " max_seq_length=2048,",
145
+ ")",
146
+ ].join("\n"),
147
+ };
148
+ if (isGguf) {
149
+ return [studio_instructions, hf_spaces_instructions];
150
+ }
151
+ else {
152
+ return [studio_instructions, hf_spaces_instructions, fastmodel_instructions];
153
+ }
154
+ };
115
155
  const snippetLocalAI = (model, filepath) => {
116
156
  const command = (binary) => ["# Load and run the model:", `${binary} huggingface://${model.id}/${filepath ?? "{{GGUF_FILE}}"}`].join("\n");
117
157
  return [
@@ -536,6 +576,13 @@ export const LOCAL_APPS = {
536
576
  displayOnModelPage: isLlamaCppGgufModel,
537
577
  snippet: snippetOllama,
538
578
  },
579
+ unsloth: {
580
+ prettyLabel: "Unsloth",
581
+ docsUrl: "https://unsloth.ai/docs",
582
+ mainTask: "text-generation",
583
+ displayOnModelPage: isUnslothModel,
584
+ snippet: snippetUnsloth,
585
+ },
539
586
  "docker-model-runner": {
540
587
  prettyLabel: "Docker Model Runner",
541
588
  docsUrl: "https://docs.docker.com/ai/model-runner/",
@@ -135,4 +135,55 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
135
135
  const snippet = snippetFunc(model);
136
136
  expect(snippet).toEqual(`docker model run hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
137
137
  });
138
+ it("unsloth tagged model", async () => {
139
+ const { displayOnModelPage, snippet: snippetFunc } = LOCAL_APPS.unsloth;
140
+ const model = {
141
+ id: "some-user/my-unsloth-finetune",
142
+ tags: ["unsloth", "conversational"],
143
+ inference: "",
144
+ };
145
+ expect(displayOnModelPage(model)).toBe(true);
146
+ const snippet = snippetFunc(model);
147
+ expect(snippet[0].setup).toBe("pip install unsloth\nunsloth studio setup");
148
+ expect(snippet[0].content).toBe("# Run unsloth studio\nunsloth studio -H 0.0.0.0 -p 8000\n# Then open http://localhost:8000/chat in your browser\n# Search for some-user/my-unsloth-finetune to start chatting");
149
+ expect(snippet[1].setup).toBe("# No setup required");
150
+ expect(snippet[1].content).toBe("# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for some-user/my-unsloth-finetune to start chatting");
151
+ expect(snippet[2].setup).toBe("pip install unsloth");
152
+ expect(snippet[2].content).toBe('from unsloth import FastModel\nmodel, tokenizer = FastModel.from_pretrained(\n model_name="some-user/my-unsloth-finetune",\n max_seq_length=2048,\n)');
153
+ });
154
+ it("unsloth namespace gguf model", async () => {
155
+ const { displayOnModelPage, snippet: snippetFunc } = LOCAL_APPS.unsloth;
156
+ const model = {
157
+ id: "unsloth/Llama-3.2-3B-Instruct-GGUF",
158
+ tags: ["conversational"],
159
+ gguf: { total: 1, context_length: 4096 },
160
+ inference: "",
161
+ };
162
+ expect(displayOnModelPage(model)).toBe(true);
163
+ const snippet = snippetFunc(model);
164
+ expect(snippet[0].setup).toBe("pip install unsloth\nunsloth studio setup");
165
+ expect(snippet[0].content).toBe("# Run unsloth studio\nunsloth studio -H 0.0.0.0 -p 8000\n# Then open http://localhost:8000/chat in your browser\n# Search for unsloth/Llama-3.2-3B-Instruct-GGUF to start chatting");
166
+ expect(snippet[1].setup).toBe("# No setup required");
167
+ expect(snippet[1].content).toBe("# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for unsloth/Llama-3.2-3B-Instruct-GGUF to start chatting");
168
+ expect(snippet).toHaveLength(2); // GGUF models only get 2 snippets
169
+ });
170
+ it("non unsloth namespace gguf model", async () => {
171
+ const { displayOnModelPage } = LOCAL_APPS.unsloth;
172
+ const model = {
173
+ id: "dummy/Llama-3.2-3B-Instruct-GGUF",
174
+ tags: ["conversational"],
175
+ gguf: { total: 1, context_length: 4096 },
176
+ inference: "",
177
+ };
178
+ expect(displayOnModelPage(model)).toBe(true);
179
+ });
180
+ it("unsloth not shown for unrelated model", async () => {
181
+ const { displayOnModelPage } = LOCAL_APPS.unsloth;
182
+ const model = {
183
+ id: "meta-llama/Llama-3.2-3B-Instruct",
184
+ tags: ["conversational"],
185
+ inference: "",
186
+ };
187
+ expect(displayOnModelPage(model)).toBe(false);
188
+ });
138
189
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/tasks",
3
- "version": "0.20.3",
3
+ "version": "0.20.4",
4
4
  "description": "List of ML tasks for huggingface.co/tasks",
5
5
  "keywords": [
6
6
  "hub",
package/src/gguf.ts CHANGED
@@ -41,6 +41,7 @@ export enum GGMLFileQuantizationType {
41
41
  TQ1_0 = 36,
42
42
  TQ2_0 = 37,
43
43
  MXFP4_MOE = 38,
44
+ NVFP4 = 39,
44
45
 
45
46
  // custom quants used by unsloth
46
47
  // they are not officially a scheme enum value in GGUF, but only here for naming
@@ -99,6 +100,7 @@ export const GGUF_QUANT_ORDER: GGMLFileQuantizationType[] = [
99
100
  GGMLFileQuantizationType.Q4_2,
100
101
  GGMLFileQuantizationType.Q4_3,
101
102
  GGMLFileQuantizationType.MXFP4_MOE,
103
+ GGMLFileQuantizationType.NVFP4,
102
104
 
103
105
  // 3-bit quantizations
104
106
  GGMLFileQuantizationType.Q3_K_XL,
@@ -202,4 +204,5 @@ export enum GGMLQuantizationType {
202
204
  TQ1_0 = 34,
203
205
  TQ2_0 = 35,
204
206
  MXFP4 = 39,
207
+ NVFP4 = 40,
205
208
  }
@@ -150,4 +150,73 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
150
150
 
151
151
  expect(snippet).toEqual(`docker model run hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
152
152
  });
153
+
154
+ it("unsloth tagged model", async () => {
155
+ const { displayOnModelPage, snippet: snippetFunc } = LOCAL_APPS.unsloth;
156
+ const model: ModelData = {
157
+ id: "some-user/my-unsloth-finetune",
158
+ tags: ["unsloth", "conversational"],
159
+ inference: "",
160
+ };
161
+
162
+ expect(displayOnModelPage(model)).toBe(true);
163
+ const snippet = snippetFunc(model);
164
+ expect(snippet[0].setup).toBe("pip install unsloth\nunsloth studio setup");
165
+ expect(snippet[0].content).toBe(
166
+ "# Run unsloth studio\nunsloth studio -H 0.0.0.0 -p 8000\n# Then open http://localhost:8000/chat in your browser\n# Search for some-user/my-unsloth-finetune to start chatting",
167
+ );
168
+ expect(snippet[1].setup).toBe("# No setup required");
169
+ expect(snippet[1].content).toBe(
170
+ "# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for some-user/my-unsloth-finetune to start chatting",
171
+ );
172
+ expect(snippet[2].setup).toBe("pip install unsloth");
173
+ expect(snippet[2].content).toBe(
174
+ 'from unsloth import FastModel\nmodel, tokenizer = FastModel.from_pretrained(\n model_name="some-user/my-unsloth-finetune",\n max_seq_length=2048,\n)',
175
+ );
176
+ });
177
+
178
+ it("unsloth namespace gguf model", async () => {
179
+ const { displayOnModelPage, snippet: snippetFunc } = LOCAL_APPS.unsloth;
180
+ const model: ModelData = {
181
+ id: "unsloth/Llama-3.2-3B-Instruct-GGUF",
182
+ tags: ["conversational"],
183
+ gguf: { total: 1, context_length: 4096 },
184
+ inference: "",
185
+ };
186
+
187
+ expect(displayOnModelPage(model)).toBe(true);
188
+ const snippet = snippetFunc(model);
189
+ expect(snippet[0].setup).toBe("pip install unsloth\nunsloth studio setup");
190
+ expect(snippet[0].content).toBe(
191
+ "# Run unsloth studio\nunsloth studio -H 0.0.0.0 -p 8000\n# Then open http://localhost:8000/chat in your browser\n# Search for unsloth/Llama-3.2-3B-Instruct-GGUF to start chatting",
192
+ );
193
+ expect(snippet[1].setup).toBe("# No setup required");
194
+ expect(snippet[1].content).toBe(
195
+ "# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for unsloth/Llama-3.2-3B-Instruct-GGUF to start chatting",
196
+ );
197
+ expect(snippet).toHaveLength(2); // GGUF models only get 2 snippets
198
+ });
199
+
200
+ it("non unsloth namespace gguf model", async () => {
201
+ const { displayOnModelPage } = LOCAL_APPS.unsloth;
202
+ const model: ModelData = {
203
+ id: "dummy/Llama-3.2-3B-Instruct-GGUF",
204
+ tags: ["conversational"],
205
+ gguf: { total: 1, context_length: 4096 },
206
+ inference: "",
207
+ };
208
+
209
+ expect(displayOnModelPage(model)).toBe(true);
210
+ });
211
+
212
+ it("unsloth not shown for unrelated model", async () => {
213
+ const { displayOnModelPage } = LOCAL_APPS.unsloth;
214
+ const model: ModelData = {
215
+ id: "meta-llama/Llama-3.2-3B-Instruct",
216
+ tags: ["conversational"],
217
+ inference: "",
218
+ };
219
+
220
+ expect(displayOnModelPage(model)).toBe(false);
221
+ });
153
222
  });
package/src/local-apps.ts CHANGED
@@ -115,6 +115,10 @@ function isMlxModel(model: ModelData) {
115
115
  return model.tags.includes("mlx");
116
116
  }
117
117
 
118
+ function isUnslothModel(model: ModelData) {
119
+ return model.tags.includes("unsloth") || isLlamaCppGgufModel(model);
120
+ }
121
+
118
122
  function getQuantTag(filepath?: string): string {
119
123
  const defaultTag = ":{{QUANT_TAG}}";
120
124
 
@@ -193,6 +197,48 @@ const snippetOllama = (model: ModelData, filepath?: string): string => {
193
197
  return `ollama run hf.co/${model.id}${getQuantTag(filepath)}`;
194
198
  };
195
199
 
200
+ const snippetUnsloth = (model: ModelData): LocalAppSnippet[] => {
201
+ const isGguf = isLlamaCppGgufModel(model);
202
+
203
+ const studio_instructions: LocalAppSnippet = {
204
+ title: "Open model in Unsloth Studio",
205
+ setup: ["pip install unsloth", "unsloth studio setup"].join("\n"),
206
+ content: [
207
+ "# Run unsloth studio",
208
+ "unsloth studio -H 0.0.0.0 -p 8000",
209
+ "# Then open http://localhost:8000/chat in your browser",
210
+ "# Search for " + model.id + " to start chatting",
211
+ ].join("\n"),
212
+ };
213
+
214
+ const hf_spaces_instructions: LocalAppSnippet = {
215
+ title: "Using HuggingFace Spaces for Unsloth",
216
+ setup: "# No setup required",
217
+ content:
218
+ "# Open https://huggingface.co/spaces/unsloth/studio in your browser\n# Search for " +
219
+ model.id +
220
+ " to start chatting",
221
+ };
222
+
223
+ const fastmodel_instructions: LocalAppSnippet = {
224
+ title: "Load model with FastModel",
225
+ setup: "pip install unsloth",
226
+ content: [
227
+ "from unsloth import FastModel",
228
+ "model, tokenizer = FastModel.from_pretrained(",
229
+ ' model_name="' + model.id + '",',
230
+ " max_seq_length=2048,",
231
+ ")",
232
+ ].join("\n"),
233
+ };
234
+
235
+ if (isGguf) {
236
+ return [studio_instructions, hf_spaces_instructions];
237
+ } else {
238
+ return [studio_instructions, hf_spaces_instructions, fastmodel_instructions];
239
+ }
240
+ };
241
+
196
242
  const snippetLocalAI = (model: ModelData, filepath?: string): LocalAppSnippet[] => {
197
243
  const command = (binary: string) =>
198
244
  ["# Load and run the model:", `${binary} huggingface://${model.id}/${filepath ?? "{{GGUF_FILE}}"}`].join("\n");
@@ -643,6 +689,13 @@ export const LOCAL_APPS = {
643
689
  displayOnModelPage: isLlamaCppGgufModel,
644
690
  snippet: snippetOllama,
645
691
  },
692
+ unsloth: {
693
+ prettyLabel: "Unsloth",
694
+ docsUrl: "https://unsloth.ai/docs",
695
+ mainTask: "text-generation",
696
+ displayOnModelPage: isUnslothModel,
697
+ snippet: snippetUnsloth,
698
+ },
646
699
  "docker-model-runner": {
647
700
  prettyLabel: "Docker Model Runner",
648
701
  docsUrl: "https://docs.docker.com/ai/model-runner/",