@huggingface/tasks 0.10.3 → 0.10.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/index.cjs +293 -9
- package/dist/index.js +291 -9
- package/dist/src/hardware.d.ts +305 -0
- package/dist/src/hardware.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/local-apps.d.ts +0 -5
- package/dist/src/local-apps.d.ts.map +1 -1
- package/dist/src/widget-example.d.ts +2 -5
- package/dist/src/widget-example.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/hardware.ts +309 -0
- package/src/index.ts +2 -1
- package/src/local-apps.ts +11 -9
- package/src/widget-example.ts +3 -6
package/src/hardware.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Biden AI Executive Order
|
|
3
|
+
* https://www.whitehouse.gov/briefing-room/presidential-actions/2023/10/30/executive-order-on-the-safe-secure-and-trustworthy-development-and-use-of-artificial-intelligence/
|
|
4
|
+
*/
|
|
5
|
+
export const TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL = 10 ** 14;
|
|
6
|
+
export const TFLOPS_THRESHOLD_WHITE_HOUSE_MODEL_TRAINING_TOTAL_BIOLOGY = 10 ** 11;
|
|
7
|
+
export const TFLOPS_THRESHOLD_WHITE_HOUSE_CLUSTER = 10 ** 8;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* EU AI Act
|
|
11
|
+
* https://ec.europa.eu/commission/presscorner/detail/en/qanda_21_1683
|
|
12
|
+
*/
|
|
13
|
+
export const TFLOPS_THRESHOLD_EU_AI_ACT_MODEL_TRAINING_TOTAL = 10 ** 13;
|
|
14
|
+
|
|
15
|
+
export interface HardwareSpec {
|
|
16
|
+
/**
|
|
17
|
+
* Approximate value, in FP16 whenever possible.
|
|
18
|
+
* This is only approximate/theoretical and shouldn't be taken too seriously.
|
|
19
|
+
* Currently the CPU values are from cpu-monkey.com
|
|
20
|
+
* while the GPU values are from techpowerup.com
|
|
21
|
+
*
|
|
22
|
+
* Note to reviewers: I got fed up with data entry,
|
|
23
|
+
* and HuggingChat running Llama3 with Web search was failing a bit,
|
|
24
|
+
* so some of those values might be slightly inaccurate. Forgive me and please feel free to improve.
|
|
25
|
+
*/
|
|
26
|
+
tflops: number;
|
|
27
|
+
/**
|
|
28
|
+
* If an array is specified, options of memory size (can be VRAM, unified RAM)
|
|
29
|
+
* e.g. an A100 exists in 40 or 80 GB.
|
|
30
|
+
*/
|
|
31
|
+
memory?: number[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const DEFAULT_MEMORY_OPTIONS = [8, 16, 24, 32, 40, 48, 64, 80, 96, 128];
|
|
35
|
+
|
|
36
|
+
export const SKUS = {
|
|
37
|
+
GPU: {
|
|
38
|
+
NVIDIA: {
|
|
39
|
+
H100: {
|
|
40
|
+
tflops: 267.6,
|
|
41
|
+
memory: [80],
|
|
42
|
+
},
|
|
43
|
+
L40: {
|
|
44
|
+
tflops: 90.52,
|
|
45
|
+
memory: [48],
|
|
46
|
+
},
|
|
47
|
+
"RTX 6000 Ada": {
|
|
48
|
+
tflops: 91.1,
|
|
49
|
+
memory: [48],
|
|
50
|
+
},
|
|
51
|
+
A100: {
|
|
52
|
+
tflops: 77.97,
|
|
53
|
+
memory: [80, 40],
|
|
54
|
+
},
|
|
55
|
+
A40: {
|
|
56
|
+
tflops: 37.42,
|
|
57
|
+
memory: [48],
|
|
58
|
+
},
|
|
59
|
+
A10: {
|
|
60
|
+
tflops: 31.24,
|
|
61
|
+
memory: [24],
|
|
62
|
+
},
|
|
63
|
+
T4: {
|
|
64
|
+
tflops: 65.13,
|
|
65
|
+
memory: [16],
|
|
66
|
+
},
|
|
67
|
+
"RTX 4090": {
|
|
68
|
+
tflops: 82.58,
|
|
69
|
+
memory: [24],
|
|
70
|
+
},
|
|
71
|
+
"RTX 4080 SUPER": {
|
|
72
|
+
tflops: 52.2,
|
|
73
|
+
memory: [16],
|
|
74
|
+
},
|
|
75
|
+
"RTX 4080": {
|
|
76
|
+
tflops: 48.7,
|
|
77
|
+
memory: [16],
|
|
78
|
+
},
|
|
79
|
+
"RTX 4070": {
|
|
80
|
+
tflops: 29.15,
|
|
81
|
+
memory: [12],
|
|
82
|
+
},
|
|
83
|
+
"RTX 4070 Ti": {
|
|
84
|
+
tflops: 40.09,
|
|
85
|
+
memory: [12],
|
|
86
|
+
},
|
|
87
|
+
"RTX 4070 Super": {
|
|
88
|
+
tflops: 35.48,
|
|
89
|
+
memory: [12],
|
|
90
|
+
},
|
|
91
|
+
"RTX 4070 Ti Super": {
|
|
92
|
+
tflops: 44.1,
|
|
93
|
+
memory: [16],
|
|
94
|
+
},
|
|
95
|
+
"RTX 3090": {
|
|
96
|
+
tflops: 35.58,
|
|
97
|
+
memory: [24],
|
|
98
|
+
},
|
|
99
|
+
"RTX 3090 Ti": {
|
|
100
|
+
tflops: 40,
|
|
101
|
+
memory: [24],
|
|
102
|
+
},
|
|
103
|
+
"RTX 3080 Ti": {
|
|
104
|
+
tflops: 34.1,
|
|
105
|
+
memory: [12],
|
|
106
|
+
},
|
|
107
|
+
"RTX 3080": {
|
|
108
|
+
tflops: 30.6,
|
|
109
|
+
memory: [12, 10],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
AMD: {
|
|
113
|
+
MI300: {
|
|
114
|
+
tflops: 383.0,
|
|
115
|
+
memory: [192],
|
|
116
|
+
},
|
|
117
|
+
MI250: {
|
|
118
|
+
tflops: 362.1,
|
|
119
|
+
memory: [128],
|
|
120
|
+
},
|
|
121
|
+
MI210: {
|
|
122
|
+
tflops: 181.0,
|
|
123
|
+
memory: [64],
|
|
124
|
+
},
|
|
125
|
+
"RX 7900 XTX": {
|
|
126
|
+
tflops: 122.8,
|
|
127
|
+
memory: [24],
|
|
128
|
+
},
|
|
129
|
+
"RX 7900 XT": {
|
|
130
|
+
tflops: 103.0,
|
|
131
|
+
memory: [20],
|
|
132
|
+
},
|
|
133
|
+
"RX 7900 GRE": {
|
|
134
|
+
tflops: 91.96,
|
|
135
|
+
memory: [16],
|
|
136
|
+
},
|
|
137
|
+
"RX 7800 XT": {
|
|
138
|
+
tflops: 74.65,
|
|
139
|
+
memory: [16],
|
|
140
|
+
},
|
|
141
|
+
"RX 7700 XT": {
|
|
142
|
+
tflops: 70.34,
|
|
143
|
+
memory: [12],
|
|
144
|
+
},
|
|
145
|
+
"RX 7600 XT": {
|
|
146
|
+
tflops: 45.14,
|
|
147
|
+
memory: [16, 8],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
CPU: {
|
|
152
|
+
Intel: {
|
|
153
|
+
"Xeon 4th Generation (Sapphire Rapids)": {
|
|
154
|
+
tflops: 1.3,
|
|
155
|
+
},
|
|
156
|
+
"Xeon 3th Generation (Ice Lake)": {
|
|
157
|
+
tflops: 0.8,
|
|
158
|
+
},
|
|
159
|
+
"Xeon 2th Generation (Cascade Lake)": {
|
|
160
|
+
tflops: 0.55,
|
|
161
|
+
},
|
|
162
|
+
"Intel Core 13th Generation (i9)": {
|
|
163
|
+
tflops: 0.85,
|
|
164
|
+
},
|
|
165
|
+
"Intel Core 13th Generation (i7)": {
|
|
166
|
+
tflops: 0.82,
|
|
167
|
+
},
|
|
168
|
+
"Intel Core 13th Generation (i5)": {
|
|
169
|
+
tflops: 0.68,
|
|
170
|
+
},
|
|
171
|
+
"Intel Core 13th Generation (i3)": {
|
|
172
|
+
tflops: 0.57,
|
|
173
|
+
},
|
|
174
|
+
"Intel Core 12th Generation (i9)": {
|
|
175
|
+
tflops: 0.79,
|
|
176
|
+
},
|
|
177
|
+
"Intel Core 12th Generation (i7)": {
|
|
178
|
+
tflops: 0.77,
|
|
179
|
+
},
|
|
180
|
+
"Intel Core 12th Generation (i5)": {
|
|
181
|
+
tflops: 0.65,
|
|
182
|
+
},
|
|
183
|
+
"Intel Core 12th Generation (i3)": {
|
|
184
|
+
tflops: 0.53,
|
|
185
|
+
},
|
|
186
|
+
"Intel Core 11th Generation (i9)": {
|
|
187
|
+
tflops: 0.7,
|
|
188
|
+
},
|
|
189
|
+
"Intel Core 11th Generation (i7)": {
|
|
190
|
+
tflops: 0.6,
|
|
191
|
+
},
|
|
192
|
+
"Intel Core 11th Generation (i5)": {
|
|
193
|
+
tflops: 0.5,
|
|
194
|
+
},
|
|
195
|
+
"Intel Core 11th Generation (i3)": {
|
|
196
|
+
tflops: 0.35,
|
|
197
|
+
},
|
|
198
|
+
"Intel Core 10th Generation (i9)": {
|
|
199
|
+
tflops: 0.46,
|
|
200
|
+
},
|
|
201
|
+
"Intel Core 10th Generation (i7)": {
|
|
202
|
+
tflops: 0.46,
|
|
203
|
+
},
|
|
204
|
+
"Intel Core 10th Generation (i5)": {
|
|
205
|
+
tflops: 0.46,
|
|
206
|
+
},
|
|
207
|
+
"Intel Core 10th Generation (i3)": {
|
|
208
|
+
tflops: 0.44,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
AMD: {
|
|
212
|
+
"EPYC 4th Generation (Genoa)": {
|
|
213
|
+
tflops: 5,
|
|
214
|
+
},
|
|
215
|
+
"EPYC 3th Generation (Milan)": {
|
|
216
|
+
tflops: 2.4,
|
|
217
|
+
},
|
|
218
|
+
"EPYC 2th Generation (Rome)": {
|
|
219
|
+
tflops: 0.6,
|
|
220
|
+
},
|
|
221
|
+
"EPYC 1st Generation (Naples)": {
|
|
222
|
+
tflops: 0.6,
|
|
223
|
+
},
|
|
224
|
+
"Ryzen Zen4 7000 (Ryzen 9)": {
|
|
225
|
+
tflops: 0.56,
|
|
226
|
+
},
|
|
227
|
+
"Ryzen Zen4 7000 (Ryzen 7)": {
|
|
228
|
+
tflops: 0.56,
|
|
229
|
+
},
|
|
230
|
+
"Ryzen Zen4 7000 (Ryzen 5)": {
|
|
231
|
+
tflops: 0.56,
|
|
232
|
+
},
|
|
233
|
+
"Ryzen Zen3 5000 (Ryzen 9)": {
|
|
234
|
+
tflops: 1.33,
|
|
235
|
+
},
|
|
236
|
+
"Ryzen Zen3 5000 (Ryzen 7)": {
|
|
237
|
+
tflops: 1.33,
|
|
238
|
+
},
|
|
239
|
+
"Ryzen Zen3 5000 (Ryzen 5)": {
|
|
240
|
+
tflops: 0.72,
|
|
241
|
+
},
|
|
242
|
+
"Ryzen Zen 2 3000 (Threadripper)": {
|
|
243
|
+
tflops: 0.72,
|
|
244
|
+
},
|
|
245
|
+
"Ryzen Zen 2 3000 (Ryzen 9)": {
|
|
246
|
+
tflops: 0.72,
|
|
247
|
+
},
|
|
248
|
+
"Ryzen Zen 2 3000 (Ryzen 7)": {
|
|
249
|
+
tflops: 0.72,
|
|
250
|
+
},
|
|
251
|
+
"Ryzen Zen 2 3000 (Ryzen 5)": {
|
|
252
|
+
tflops: 0.72,
|
|
253
|
+
},
|
|
254
|
+
"Ryzen Zen 2 3000 (Ryzen 3)": {
|
|
255
|
+
tflops: 0.72,
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
"Apple Silicon": {
|
|
260
|
+
"-": {
|
|
261
|
+
"Apple M1": {
|
|
262
|
+
tflops: 2.6,
|
|
263
|
+
memory: [8, 16],
|
|
264
|
+
},
|
|
265
|
+
"Apple M1 Pro": {
|
|
266
|
+
tflops: 5.2,
|
|
267
|
+
memory: [16, 24, 32],
|
|
268
|
+
},
|
|
269
|
+
"Apple M1 Max": {
|
|
270
|
+
tflops: 10.4,
|
|
271
|
+
memory: [16, 24, 32, 64],
|
|
272
|
+
},
|
|
273
|
+
"Apple M1 Ultra": {
|
|
274
|
+
tflops: 21,
|
|
275
|
+
memory: [16, 24, 32, 64, 96, 128],
|
|
276
|
+
},
|
|
277
|
+
"Apple M2": {
|
|
278
|
+
tflops: 3.6,
|
|
279
|
+
memory: [8, 16, 24],
|
|
280
|
+
},
|
|
281
|
+
"Apple M2 Pro": {
|
|
282
|
+
tflops: 13.6,
|
|
283
|
+
memory: [16, 24, 32],
|
|
284
|
+
},
|
|
285
|
+
"Apple M2 Max": {
|
|
286
|
+
tflops: 13.49,
|
|
287
|
+
memory: [32, 64, 96],
|
|
288
|
+
},
|
|
289
|
+
"Apple M2 Ultra": {
|
|
290
|
+
tflops: 27.2,
|
|
291
|
+
memory: [64, 96, 128, 192],
|
|
292
|
+
},
|
|
293
|
+
"Apple M3": {
|
|
294
|
+
tflops: 2.84,
|
|
295
|
+
memory: [8, 16, 24],
|
|
296
|
+
},
|
|
297
|
+
"Apple M3 Pro": {
|
|
298
|
+
tflops: 14,
|
|
299
|
+
memory: [18, 36],
|
|
300
|
+
},
|
|
301
|
+
"Apple M3 Max": {
|
|
302
|
+
tflops: 14.2,
|
|
303
|
+
memory: [36, 48, 64, 96, 128],
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
} satisfies Record<string, Record<string, Record<string, HardwareSpec>>>;
|
|
308
|
+
|
|
309
|
+
export type SkuType = keyof typeof SKUS;
|
package/src/index.ts
CHANGED
|
@@ -19,7 +19,6 @@ export type { LibraryUiElement, ModelLibraryKey } from "./model-libraries";
|
|
|
19
19
|
export type { ModelData, TransformersInfo } from "./model-data";
|
|
20
20
|
export type { AddedToken, SpecialTokensMap, TokenizerConfig } from "./tokenizer-data";
|
|
21
21
|
export type {
|
|
22
|
-
ChatMessage,
|
|
23
22
|
WidgetExample,
|
|
24
23
|
WidgetExampleAttribute,
|
|
25
24
|
WidgetExampleAssetAndPromptInput,
|
|
@@ -46,5 +45,7 @@ export { SPECIAL_TOKENS_ATTRIBUTES } from "./tokenizer-data";
|
|
|
46
45
|
import * as snippets from "./snippets";
|
|
47
46
|
export { snippets };
|
|
48
47
|
|
|
48
|
+
export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware";
|
|
49
|
+
export type { HardwareSpec, SkuType } from "./hardware";
|
|
49
50
|
export { LOCAL_APPS } from "./local-apps";
|
|
50
51
|
export type { LocalApp, LocalAppKey } from "./local-apps";
|
package/src/local-apps.ts
CHANGED
|
@@ -50,7 +50,7 @@ const snippetLlamacpp = (model: ModelData): string => {
|
|
|
50
50
|
return `./main \\
|
|
51
51
|
--hf-repo "${model.id}" \\
|
|
52
52
|
-m file.gguf \\
|
|
53
|
-
-p "I believe the meaning of life is
|
|
53
|
+
-p "I believe the meaning of life is" \\
|
|
54
54
|
-n 128`;
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -88,10 +88,9 @@ export const LOCAL_APPS = {
|
|
|
88
88
|
deeplink: (model) => new URL(`jan://models/huggingface/${model.id}`),
|
|
89
89
|
},
|
|
90
90
|
backyard: {
|
|
91
|
-
prettyLabel: "Backyard",
|
|
91
|
+
prettyLabel: "Backyard AI",
|
|
92
92
|
docsUrl: "https://backyard.ai",
|
|
93
93
|
mainTask: "text-generation",
|
|
94
|
-
macOSOnly: true,
|
|
95
94
|
displayOnModelPage: isGgufModel,
|
|
96
95
|
deeplink: (model) => new URL(`https://backyard.ai/hf/model/${model.id}`),
|
|
97
96
|
},
|
|
@@ -100,12 +99,15 @@ export const LOCAL_APPS = {
|
|
|
100
99
|
docsUrl: "https://drawthings.ai",
|
|
101
100
|
mainTask: "text-to-image",
|
|
102
101
|
macOSOnly: true,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
displayOnModelPage: (model) =>
|
|
103
|
+
model.library_name === "diffusers" && (model.pipeline_tag === "text-to-image" || model.tags.includes("lora")),
|
|
104
|
+
deeplink: (model) => {
|
|
105
|
+
if (model.tags.includes("lora")) {
|
|
106
|
+
return new URL(`https://drawthings.ai/import/diffusers/pipeline.load_lora_weights?repo_id=${model.id}`);
|
|
107
|
+
} else {
|
|
108
|
+
return new URL(`https://drawthings.ai/import/diffusers/pipeline.from_pretrained?repo_id=${model.id}`);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
109
111
|
},
|
|
110
112
|
diffusionbee: {
|
|
111
113
|
prettyLabel: "DiffusionBee",
|
package/src/widget-example.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* See default-widget-inputs.ts for the default widget inputs, this files only contains the types
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import type { ChatCompletionInputMessage } from "./tasks";
|
|
6
|
+
|
|
5
7
|
type TableData = Record<string, (string | number)[]>;
|
|
6
8
|
|
|
7
9
|
//#region outputs
|
|
@@ -51,13 +53,8 @@ export interface WidgetExampleBase<TOutput> {
|
|
|
51
53
|
output?: TOutput;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
export interface ChatMessage {
|
|
55
|
-
role: "user" | "assistant" | "system";
|
|
56
|
-
content: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
56
|
export interface WidgetExampleChatInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|
|
60
|
-
messages:
|
|
57
|
+
messages: ChatCompletionInputMessage[];
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
export interface WidgetExampleTextInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|