@huggingface/tasks 0.5.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +46 -0
- package/dist/index.d.ts +230 -22
- package/dist/index.js +46 -0
- package/package.json +2 -2
- package/src/model-libraries-snippets.ts +12 -0
- package/src/model-libraries.ts +36 -0
- package/src/tasks/chat-completion/inference.ts +158 -0
- package/src/tasks/chat-completion/spec/input.json +63 -0
- package/src/tasks/chat-completion/spec/output.json +58 -0
- package/src/tasks/chat-completion/spec/output_stream.json +48 -0
- package/src/tasks/index.ts +15 -4
- package/src/tasks/text-generation/inference.ts +75 -19
- package/src/tasks/text-generation/spec/input.json +4 -0
- package/src/tasks/text-generation/spec/output.json +101 -56
- package/src/tasks/text-generation/spec/output_stream.json +47 -0
package/dist/index.cjs
CHANGED
|
@@ -4083,6 +4083,11 @@ var flair = (model) => [
|
|
|
4083
4083
|
|
|
4084
4084
|
tagger = SequenceTagger.load("${model.id}")`
|
|
4085
4085
|
];
|
|
4086
|
+
var gliner = (model) => [
|
|
4087
|
+
`from gliner import GLiNER
|
|
4088
|
+
|
|
4089
|
+
model = GLiNER.from_pretrained("${model.id}")`
|
|
4090
|
+
];
|
|
4086
4091
|
var keras = (model) => [
|
|
4087
4092
|
`from huggingface_hub import from_pretrained_keras
|
|
4088
4093
|
|
|
@@ -4429,6 +4434,11 @@ var mlx = (model) => [
|
|
|
4429
4434
|
export HF_HUB_ENABLE_HF_TRANS: string[]FER=1
|
|
4430
4435
|
huggingface-cli download --local-dir ${nameWithoutNamespace(model.id)} ${model.id}`
|
|
4431
4436
|
];
|
|
4437
|
+
var mlxim = (model) => [
|
|
4438
|
+
`from mlxim.model import create_model
|
|
4439
|
+
|
|
4440
|
+
model = create_model(${model.id})`
|
|
4441
|
+
];
|
|
4432
4442
|
var nemo = (model) => {
|
|
4433
4443
|
let command = void 0;
|
|
4434
4444
|
if (model.tags?.includes("automatic-speech-recognition")) {
|
|
@@ -4578,6 +4588,25 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
4578
4588
|
term: { path: "pytorch_model.bin" }
|
|
4579
4589
|
}
|
|
4580
4590
|
},
|
|
4591
|
+
gliner: {
|
|
4592
|
+
prettyLabel: "GLiNER",
|
|
4593
|
+
repoName: "GLiNER",
|
|
4594
|
+
repoUrl: "https://github.com/urchade/GLiNER",
|
|
4595
|
+
snippets: gliner,
|
|
4596
|
+
filter: false,
|
|
4597
|
+
countDownloads: {
|
|
4598
|
+
term: { path: "gliner_config.json" }
|
|
4599
|
+
}
|
|
4600
|
+
},
|
|
4601
|
+
grok: {
|
|
4602
|
+
prettyLabel: "Grok",
|
|
4603
|
+
repoName: "Grok",
|
|
4604
|
+
repoUrl: "https://github.com/xai-org/grok-1",
|
|
4605
|
+
filter: false,
|
|
4606
|
+
countDownloads: {
|
|
4607
|
+
terms: { path: ["ckpt/tensor00000_000", "ckpt-0/tensor00000_000"] }
|
|
4608
|
+
}
|
|
4609
|
+
},
|
|
4581
4610
|
keras: {
|
|
4582
4611
|
prettyLabel: "Keras",
|
|
4583
4612
|
repoName: "Keras",
|
|
@@ -4613,6 +4642,15 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
4613
4642
|
snippets: mlx,
|
|
4614
4643
|
filter: true
|
|
4615
4644
|
},
|
|
4645
|
+
"mlx-image": {
|
|
4646
|
+
prettyLabel: "mlx-image",
|
|
4647
|
+
repoName: "mlx-image",
|
|
4648
|
+
repoUrl: "https://github.com/riccardomusmeci/mlx-image",
|
|
4649
|
+
docsUrl: "https://huggingface.co/docs/hub/mlx-image",
|
|
4650
|
+
snippets: mlxim,
|
|
4651
|
+
filter: false,
|
|
4652
|
+
countDownloads: { term: { path: "model.safetensors" } }
|
|
4653
|
+
},
|
|
4616
4654
|
nemo: {
|
|
4617
4655
|
prettyLabel: "NeMo",
|
|
4618
4656
|
repoName: "NeMo",
|
|
@@ -4793,6 +4831,14 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
4793
4831
|
countDownloads: {
|
|
4794
4832
|
wildcard: { path: "*.sentis" }
|
|
4795
4833
|
}
|
|
4834
|
+
},
|
|
4835
|
+
whisperkit: {
|
|
4836
|
+
prettyLabel: "WhisperKit",
|
|
4837
|
+
repoName: "WhisperKit",
|
|
4838
|
+
repoUrl: "https://github.com/argmaxinc/WhisperKit",
|
|
4839
|
+
countDownloads: {
|
|
4840
|
+
wildcard: { path: "*/model.mil" }
|
|
4841
|
+
}
|
|
4796
4842
|
}
|
|
4797
4843
|
};
|
|
4798
4844
|
var ALL_MODEL_LIBRARY_KEYS = Object.keys(MODEL_LIBRARIES_UI_ELEMENTS);
|
package/dist/index.d.ts
CHANGED
|
@@ -839,6 +839,29 @@ declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
839
839
|
};
|
|
840
840
|
};
|
|
841
841
|
};
|
|
842
|
+
gliner: {
|
|
843
|
+
prettyLabel: string;
|
|
844
|
+
repoName: string;
|
|
845
|
+
repoUrl: string;
|
|
846
|
+
snippets: (model: ModelData) => string[];
|
|
847
|
+
filter: false;
|
|
848
|
+
countDownloads: {
|
|
849
|
+
term: {
|
|
850
|
+
path: string;
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
grok: {
|
|
855
|
+
prettyLabel: string;
|
|
856
|
+
repoName: string;
|
|
857
|
+
repoUrl: string;
|
|
858
|
+
filter: false;
|
|
859
|
+
countDownloads: {
|
|
860
|
+
terms: {
|
|
861
|
+
path: string[];
|
|
862
|
+
};
|
|
863
|
+
};
|
|
864
|
+
};
|
|
842
865
|
keras: {
|
|
843
866
|
prettyLabel: string;
|
|
844
867
|
repoName: string;
|
|
@@ -882,6 +905,19 @@ declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
882
905
|
snippets: (model: ModelData) => string[];
|
|
883
906
|
filter: true;
|
|
884
907
|
};
|
|
908
|
+
"mlx-image": {
|
|
909
|
+
prettyLabel: string;
|
|
910
|
+
repoName: string;
|
|
911
|
+
repoUrl: string;
|
|
912
|
+
docsUrl: string;
|
|
913
|
+
snippets: (model: ModelData) => string[];
|
|
914
|
+
filter: false;
|
|
915
|
+
countDownloads: {
|
|
916
|
+
term: {
|
|
917
|
+
path: string;
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
};
|
|
885
921
|
nemo: {
|
|
886
922
|
prettyLabel: string;
|
|
887
923
|
repoName: string;
|
|
@@ -1093,10 +1129,20 @@ declare const MODEL_LIBRARIES_UI_ELEMENTS: {
|
|
|
1093
1129
|
};
|
|
1094
1130
|
};
|
|
1095
1131
|
};
|
|
1132
|
+
whisperkit: {
|
|
1133
|
+
prettyLabel: string;
|
|
1134
|
+
repoName: string;
|
|
1135
|
+
repoUrl: string;
|
|
1136
|
+
countDownloads: {
|
|
1137
|
+
wildcard: {
|
|
1138
|
+
path: string;
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1096
1142
|
};
|
|
1097
1143
|
type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
|
|
1098
|
-
declare const ALL_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "keras" | "k2" | "mindspore" | "ml-agents" | "mlx" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis")[];
|
|
1099
|
-
declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "keras" | "k2" | "mindspore" | "ml-agents" | "mlx" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis")[];
|
|
1144
|
+
declare const ALL_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gliner" | "grok" | "keras" | "k2" | "mindspore" | "ml-agents" | "mlx" | "mlx-image" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis" | "whisperkit")[];
|
|
1145
|
+
declare const ALL_DISPLAY_MODEL_LIBRARY_KEYS: ("sklearn" | "adapter-transformers" | "allennlp" | "asteroid" | "audiocraft" | "bertopic" | "diffusers" | "doctr" | "espnet" | "fairseq" | "fastai" | "fasttext" | "flair" | "gliner" | "grok" | "keras" | "k2" | "mindspore" | "ml-agents" | "mlx" | "mlx-image" | "nemo" | "open_clip" | "paddlenlp" | "peft" | "pyannote-audio" | "pythae" | "sample-factory" | "sentence-transformers" | "setfit" | "spacy" | "span-marker" | "speechbrain" | "stable-baselines3" | "stanza" | "tensorflowtts" | "timm" | "transformers" | "transformers.js" | "unity-sentis" | "whisperkit")[];
|
|
1100
1146
|
|
|
1101
1147
|
/**
|
|
1102
1148
|
* Mapping from library name (excluding Transformers) to its supported tasks.
|
|
@@ -1316,6 +1362,154 @@ interface AutomaticSpeechRecognitionOutputChunk {
|
|
|
1316
1362
|
[property: string]: unknown;
|
|
1317
1363
|
}
|
|
1318
1364
|
|
|
1365
|
+
/**
|
|
1366
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
1367
|
+
*
|
|
1368
|
+
* Using src/scripts/inference-codegen
|
|
1369
|
+
*/
|
|
1370
|
+
/**
|
|
1371
|
+
* Inputs for ChatCompletion inference
|
|
1372
|
+
*/
|
|
1373
|
+
interface ChatCompletionInput {
|
|
1374
|
+
/**
|
|
1375
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing
|
|
1376
|
+
* frequency in the text so far, decreasing the model's likelihood to repeat the same line
|
|
1377
|
+
* verbatim.
|
|
1378
|
+
*/
|
|
1379
|
+
frequency_penalty?: number;
|
|
1380
|
+
/**
|
|
1381
|
+
* The maximum number of tokens that can be generated in the chat completion.
|
|
1382
|
+
*/
|
|
1383
|
+
max_tokens?: number;
|
|
1384
|
+
messages: ChatCompletionInputMessage[];
|
|
1385
|
+
/**
|
|
1386
|
+
* The random sampling seed.
|
|
1387
|
+
*/
|
|
1388
|
+
seed?: number;
|
|
1389
|
+
/**
|
|
1390
|
+
* Stop generating tokens if a stop token is generated.
|
|
1391
|
+
*/
|
|
1392
|
+
stop?: ChatCompletionInputStopReason;
|
|
1393
|
+
/**
|
|
1394
|
+
* If set, partial message deltas will be sent.
|
|
1395
|
+
*/
|
|
1396
|
+
stream?: boolean;
|
|
1397
|
+
/**
|
|
1398
|
+
* The value used to modulate the logits distribution.
|
|
1399
|
+
*/
|
|
1400
|
+
temperature?: number;
|
|
1401
|
+
/**
|
|
1402
|
+
* If set to < 1, only the smallest set of most probable tokens with probabilities that add
|
|
1403
|
+
* up to `top_p` or higher are kept for generation.
|
|
1404
|
+
*/
|
|
1405
|
+
top_p?: number;
|
|
1406
|
+
[property: string]: unknown;
|
|
1407
|
+
}
|
|
1408
|
+
interface ChatCompletionInputMessage {
|
|
1409
|
+
/**
|
|
1410
|
+
* The content of the message.
|
|
1411
|
+
*/
|
|
1412
|
+
content: string;
|
|
1413
|
+
role: ChatCompletionMessageRole;
|
|
1414
|
+
[property: string]: unknown;
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* The role of the message author.
|
|
1418
|
+
*/
|
|
1419
|
+
type ChatCompletionMessageRole = "assistant" | "system" | "user";
|
|
1420
|
+
/**
|
|
1421
|
+
* Stop generating tokens if a stop token is generated.
|
|
1422
|
+
*/
|
|
1423
|
+
type ChatCompletionInputStopReason = string[] | string;
|
|
1424
|
+
/**
|
|
1425
|
+
* Outputs for Chat Completion inference
|
|
1426
|
+
*/
|
|
1427
|
+
interface ChatCompletionOutput {
|
|
1428
|
+
/**
|
|
1429
|
+
* A list of chat completion choices.
|
|
1430
|
+
*/
|
|
1431
|
+
choices: ChatCompletionOutputChoice[];
|
|
1432
|
+
/**
|
|
1433
|
+
* The Unix timestamp (in seconds) of when the chat completion was created.
|
|
1434
|
+
*/
|
|
1435
|
+
created: number;
|
|
1436
|
+
[property: string]: unknown;
|
|
1437
|
+
}
|
|
1438
|
+
interface ChatCompletionOutputChoice {
|
|
1439
|
+
/**
|
|
1440
|
+
* The reason why the generation was stopped.
|
|
1441
|
+
*/
|
|
1442
|
+
finish_reason: ChatCompletionFinishReason;
|
|
1443
|
+
/**
|
|
1444
|
+
* The index of the choice in the list of choices.
|
|
1445
|
+
*/
|
|
1446
|
+
index: number;
|
|
1447
|
+
message: ChatCompletionOutputChoiceMessage;
|
|
1448
|
+
[property: string]: unknown;
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* The reason why the generation was stopped.
|
|
1452
|
+
*
|
|
1453
|
+
* The generated sequence reached the maximum allowed length
|
|
1454
|
+
*
|
|
1455
|
+
* The model generated an end-of-sentence (EOS) token
|
|
1456
|
+
*
|
|
1457
|
+
* One of the sequence in stop_sequences was generated
|
|
1458
|
+
*/
|
|
1459
|
+
type ChatCompletionFinishReason = "length" | "eos_token" | "stop_sequence";
|
|
1460
|
+
interface ChatCompletionOutputChoiceMessage {
|
|
1461
|
+
/**
|
|
1462
|
+
* The content of the chat completion message.
|
|
1463
|
+
*/
|
|
1464
|
+
content: string;
|
|
1465
|
+
role: ChatCompletionMessageRole;
|
|
1466
|
+
[property: string]: unknown;
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Chat Completion Stream Output
|
|
1470
|
+
*/
|
|
1471
|
+
interface ChatCompletionStreamOutput {
|
|
1472
|
+
/**
|
|
1473
|
+
* A list of chat completion choices.
|
|
1474
|
+
*/
|
|
1475
|
+
choices: ChatCompletionStreamOutputChoice[];
|
|
1476
|
+
/**
|
|
1477
|
+
* The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has
|
|
1478
|
+
* the same timestamp.
|
|
1479
|
+
*/
|
|
1480
|
+
created: number;
|
|
1481
|
+
[property: string]: unknown;
|
|
1482
|
+
}
|
|
1483
|
+
interface ChatCompletionStreamOutputChoice {
|
|
1484
|
+
/**
|
|
1485
|
+
* A chat completion delta generated by streamed model responses.
|
|
1486
|
+
*/
|
|
1487
|
+
delta: ChatCompletionStreamOutputDelta;
|
|
1488
|
+
/**
|
|
1489
|
+
* The reason why the generation was stopped.
|
|
1490
|
+
*/
|
|
1491
|
+
finish_reason?: ChatCompletionFinishReason;
|
|
1492
|
+
/**
|
|
1493
|
+
* The index of the choice in the list of choices.
|
|
1494
|
+
*/
|
|
1495
|
+
index: number;
|
|
1496
|
+
[property: string]: unknown;
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* A chat completion delta generated by streamed model responses.
|
|
1500
|
+
*/
|
|
1501
|
+
interface ChatCompletionStreamOutputDelta {
|
|
1502
|
+
/**
|
|
1503
|
+
* The contents of the chunk message.
|
|
1504
|
+
*/
|
|
1505
|
+
content?: string;
|
|
1506
|
+
/**
|
|
1507
|
+
* The role of the author of this message.
|
|
1508
|
+
*/
|
|
1509
|
+
role?: string;
|
|
1510
|
+
[property: string]: unknown;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1319
1513
|
/**
|
|
1320
1514
|
* Inference code generated from the JSON schema spec in ./spec
|
|
1321
1515
|
*
|
|
@@ -2600,6 +2794,10 @@ interface TextGenerationInput {
|
|
|
2600
2794
|
* Additional inference parameters
|
|
2601
2795
|
*/
|
|
2602
2796
|
parameters?: TextGenerationParameters;
|
|
2797
|
+
/**
|
|
2798
|
+
* Whether to stream output tokens
|
|
2799
|
+
*/
|
|
2800
|
+
stream?: boolean;
|
|
2603
2801
|
[property: string]: unknown;
|
|
2604
2802
|
}
|
|
2605
2803
|
/**
|
|
@@ -2695,16 +2893,16 @@ interface TextGenerationOutputDetails {
|
|
|
2695
2893
|
/**
|
|
2696
2894
|
* Details about additional sequences when best_of is provided
|
|
2697
2895
|
*/
|
|
2698
|
-
best_of_sequences?:
|
|
2896
|
+
best_of_sequences?: TextGenerationOutputSequenceDetails[];
|
|
2699
2897
|
/**
|
|
2700
2898
|
* The reason why the generation was stopped.
|
|
2701
2899
|
*/
|
|
2702
|
-
finish_reason:
|
|
2900
|
+
finish_reason: TextGenerationFinishReason;
|
|
2703
2901
|
/**
|
|
2704
2902
|
* The number of generated tokens
|
|
2705
2903
|
*/
|
|
2706
2904
|
generated_tokens: number;
|
|
2707
|
-
prefill:
|
|
2905
|
+
prefill: TextGenerationPrefillToken[];
|
|
2708
2906
|
/**
|
|
2709
2907
|
* The random seed used for generation
|
|
2710
2908
|
*/
|
|
@@ -2712,23 +2910,24 @@ interface TextGenerationOutputDetails {
|
|
|
2712
2910
|
/**
|
|
2713
2911
|
* The generated tokens and associated details
|
|
2714
2912
|
*/
|
|
2715
|
-
tokens:
|
|
2716
|
-
[property: string]: unknown;
|
|
2717
|
-
}
|
|
2718
|
-
interface TextGenerationSequenceDetails {
|
|
2913
|
+
tokens: TextGenerationOutputToken[];
|
|
2719
2914
|
/**
|
|
2720
|
-
*
|
|
2915
|
+
* Most likely tokens
|
|
2721
2916
|
*/
|
|
2722
|
-
|
|
2917
|
+
top_tokens?: Array<TextGenerationOutputToken[]>;
|
|
2918
|
+
[property: string]: unknown;
|
|
2919
|
+
}
|
|
2920
|
+
interface TextGenerationOutputSequenceDetails {
|
|
2921
|
+
finish_reason: TextGenerationFinishReason;
|
|
2723
2922
|
/**
|
|
2724
2923
|
* The generated text
|
|
2725
2924
|
*/
|
|
2726
|
-
generated_text:
|
|
2925
|
+
generated_text: string;
|
|
2727
2926
|
/**
|
|
2728
2927
|
* The number of generated tokens
|
|
2729
2928
|
*/
|
|
2730
2929
|
generated_tokens: number;
|
|
2731
|
-
prefill:
|
|
2930
|
+
prefill: TextGenerationPrefillToken[];
|
|
2732
2931
|
/**
|
|
2733
2932
|
* The random seed used for generation
|
|
2734
2933
|
*/
|
|
@@ -2736,18 +2935,24 @@ interface TextGenerationSequenceDetails {
|
|
|
2736
2935
|
/**
|
|
2737
2936
|
* The generated tokens and associated details
|
|
2738
2937
|
*/
|
|
2739
|
-
tokens:
|
|
2938
|
+
tokens: TextGenerationOutputToken[];
|
|
2939
|
+
/**
|
|
2940
|
+
* Most likely tokens
|
|
2941
|
+
*/
|
|
2942
|
+
top_tokens?: Array<TextGenerationOutputToken[]>;
|
|
2740
2943
|
[property: string]: unknown;
|
|
2741
2944
|
}
|
|
2742
2945
|
/**
|
|
2743
|
-
* The
|
|
2946
|
+
* The reason why the generation was stopped.
|
|
2744
2947
|
*
|
|
2745
|
-
* The
|
|
2948
|
+
* length: The generated sequence reached the maximum allowed length
|
|
2746
2949
|
*
|
|
2747
|
-
*
|
|
2950
|
+
* eos_token: The model generated an end-of-sentence (EOS) token
|
|
2951
|
+
*
|
|
2952
|
+
* stop_sequence: One of the sequence in stop_sequences was generated
|
|
2748
2953
|
*/
|
|
2749
|
-
type
|
|
2750
|
-
interface
|
|
2954
|
+
type TextGenerationFinishReason = "length" | "eos_token" | "stop_sequence";
|
|
2955
|
+
interface TextGenerationPrefillToken {
|
|
2751
2956
|
id: number;
|
|
2752
2957
|
logprob: number;
|
|
2753
2958
|
/**
|
|
@@ -2756,9 +2961,12 @@ interface PrefillToken {
|
|
|
2756
2961
|
text: string;
|
|
2757
2962
|
[property: string]: unknown;
|
|
2758
2963
|
}
|
|
2759
|
-
|
|
2964
|
+
/**
|
|
2965
|
+
* Generated token.
|
|
2966
|
+
*/
|
|
2967
|
+
interface TextGenerationOutputToken {
|
|
2760
2968
|
id: number;
|
|
2761
|
-
logprob
|
|
2969
|
+
logprob?: number;
|
|
2762
2970
|
/**
|
|
2763
2971
|
* Whether or not that token is a special one
|
|
2764
2972
|
*/
|
|
@@ -3263,4 +3471,4 @@ declare namespace index {
|
|
|
3263
3471
|
};
|
|
3264
3472
|
}
|
|
3265
3473
|
|
|
3266
|
-
export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, AddedToken, AudioClassificationInput, AudioClassificationOutput, AudioClassificationOutputElement, AudioClassificationParameters, AutomaticSpeechRecognitionInput, AutomaticSpeechRecognitionOutput, AutomaticSpeechRecognitionOutputChunk, AutomaticSpeechRecognitionParameters, BoundingBox, ChatMessage, ClassificationOutputTransform$1 as ClassificationOutputTransform, DepthEstimationInput, DepthEstimationOutput, DocumentQuestionAnsweringInput, DocumentQuestionAnsweringInputData, DocumentQuestionAnsweringOutput, DocumentQuestionAnsweringOutputElement, DocumentQuestionAnsweringParameters, EarlyStoppingUnion$2 as EarlyStoppingUnion, ExampleRepo, FeatureExtractionInput, FeatureExtractionOutput, FillMaskInput, FillMaskOutput, FillMaskOutputElement, FillMaskParameters,
|
|
3474
|
+
export { ALL_DISPLAY_MODEL_LIBRARY_KEYS, ALL_MODEL_LIBRARY_KEYS, AddedToken, AudioClassificationInput, AudioClassificationOutput, AudioClassificationOutputElement, AudioClassificationParameters, AutomaticSpeechRecognitionInput, AutomaticSpeechRecognitionOutput, AutomaticSpeechRecognitionOutputChunk, AutomaticSpeechRecognitionParameters, BoundingBox, ChatCompletionFinishReason, ChatCompletionInput, ChatCompletionInputMessage, ChatCompletionOutput, ChatCompletionOutputChoice, ChatCompletionOutputChoiceMessage, ChatCompletionStreamOutput, ChatCompletionStreamOutputChoice, ChatCompletionStreamOutputDelta, ChatMessage, ClassificationOutputTransform$1 as ClassificationOutputTransform, DepthEstimationInput, DepthEstimationOutput, DocumentQuestionAnsweringInput, DocumentQuestionAnsweringInputData, DocumentQuestionAnsweringOutput, DocumentQuestionAnsweringOutputElement, DocumentQuestionAnsweringParameters, EarlyStoppingUnion$2 as EarlyStoppingUnion, ExampleRepo, FeatureExtractionInput, FeatureExtractionOutput, FillMaskInput, FillMaskOutput, FillMaskOutputElement, FillMaskParameters, GenerationParameters$2 as GenerationParameters, ImageClassificationInput, ImageClassificationOutput, ImageClassificationOutputElement, ImageClassificationParameters, ImageSegmentationInput, ImageSegmentationOutput, ImageSegmentationOutputElement, ImageSegmentationParameters, ImageSegmentationSubtask, ImageToImageInput, ImageToImageOutput, ImageToImageParameters, ImageToTextInput, ImageToTextOutput, ImageToTextParameters, InferenceDisplayability, LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS, LibraryUiElement, MAPPING_DEFAULT_WIDGET, MODALITIES, MODALITY_LABELS, MODEL_LIBRARIES_UI_ELEMENTS, Modality, ModelData, ModelLibraryKey, ObjectDetectionInput, ObjectDetectionOutput, ObjectDetectionOutputElement, ObjectDetectionParameters, PIPELINE_DATA, PIPELINE_TYPES, PIPELINE_TYPES_SET, PipelineData, PipelineType, QuestionAnsweringInput, QuestionAnsweringInputData, QuestionAnsweringOutput, QuestionAnsweringOutputElement, QuestionAnsweringParameters, SPECIAL_TOKENS_ATTRIBUTES, SUBTASK_TYPES, SentenceSimilarityInput, SentenceSimilarityInputData, SentenceSimilarityOutput, SpecialTokensMap, SummarizationInput, SummarizationOutput, TASKS_DATA, TASKS_MODEL_LIBRARIES, TableQuestionAnsweringInput, TableQuestionAnsweringInputData, TableQuestionAnsweringOutput, TableQuestionAnsweringOutputElement, TargetSize$1 as TargetSize, TaskData, TaskDataCustom, TaskDemo, TaskDemoEntry, Text2TextGenerationParameters, Text2TextGenerationTruncationStrategy, TextClassificationInput, TextClassificationOutput, TextClassificationOutputElement, TextClassificationParameters, TextGenerationFinishReason, TextGenerationInput, TextGenerationOutput, TextGenerationOutputDetails, TextGenerationOutputSequenceDetails, TextGenerationOutputToken, TextGenerationParameters, TextGenerationPrefillToken, TextToAudioParameters, TextToImageInput, TextToImageOutput, TextToImageParameters, TextToSpeechInput, TextToSpeechOutput, TokenClassificationAggregationStrategy, TokenClassificationInput, TokenClassificationOutput, TokenClassificationOutputElement, TokenClassificationParameters, TokenizerConfig, TransformersInfo, TranslationInput, TranslationOutput, VideoClassificationInput, VideoClassificationOutput, VideoClassificationOutputElement, VideoClassificationParameters, VisualQuestionAnsweringInput, VisualQuestionAnsweringInputData, VisualQuestionAnsweringOutput, VisualQuestionAnsweringOutputElement, VisualQuestionAnsweringParameters, WidgetExample, WidgetExampleAssetAndPromptInput, WidgetExampleAssetAndTextInput, WidgetExampleAssetAndZeroShotInput, WidgetExampleAssetInput, WidgetExampleAttribute, WidgetExampleChatInput, WidgetExampleOutput, WidgetExampleOutputAnswerScore, WidgetExampleOutputLabels, WidgetExampleOutputText, WidgetExampleOutputUrl, WidgetExampleSentenceSimilarityInput, WidgetExampleStructuredDataInput, WidgetExampleTableDataInput, WidgetExampleTextAndContextInput, WidgetExampleTextAndTableInput, WidgetExampleTextInput, WidgetExampleZeroShotTextInput, WidgetType, WordBox, ZeroShotClassificationInput, ZeroShotClassificationInputData, ZeroShotClassificationOutput, ZeroShotClassificationOutputElement, ZeroShotClassificationParameters, ZeroShotImageClassificationInput, ZeroShotImageClassificationInputData, ZeroShotImageClassificationOutput, ZeroShotImageClassificationOutputElement, ZeroShotImageClassificationParameters, ZeroShotObjectDetectionInput, ZeroShotObjectDetectionInputData, ZeroShotObjectDetectionOutput, ZeroShotObjectDetectionOutputElement, index as snippets };
|
package/dist/index.js
CHANGED
|
@@ -4048,6 +4048,11 @@ var flair = (model) => [
|
|
|
4048
4048
|
|
|
4049
4049
|
tagger = SequenceTagger.load("${model.id}")`
|
|
4050
4050
|
];
|
|
4051
|
+
var gliner = (model) => [
|
|
4052
|
+
`from gliner import GLiNER
|
|
4053
|
+
|
|
4054
|
+
model = GLiNER.from_pretrained("${model.id}")`
|
|
4055
|
+
];
|
|
4051
4056
|
var keras = (model) => [
|
|
4052
4057
|
`from huggingface_hub import from_pretrained_keras
|
|
4053
4058
|
|
|
@@ -4394,6 +4399,11 @@ var mlx = (model) => [
|
|
|
4394
4399
|
export HF_HUB_ENABLE_HF_TRANS: string[]FER=1
|
|
4395
4400
|
huggingface-cli download --local-dir ${nameWithoutNamespace(model.id)} ${model.id}`
|
|
4396
4401
|
];
|
|
4402
|
+
var mlxim = (model) => [
|
|
4403
|
+
`from mlxim.model import create_model
|
|
4404
|
+
|
|
4405
|
+
model = create_model(${model.id})`
|
|
4406
|
+
];
|
|
4397
4407
|
var nemo = (model) => {
|
|
4398
4408
|
let command = void 0;
|
|
4399
4409
|
if (model.tags?.includes("automatic-speech-recognition")) {
|
|
@@ -4543,6 +4553,25 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
4543
4553
|
term: { path: "pytorch_model.bin" }
|
|
4544
4554
|
}
|
|
4545
4555
|
},
|
|
4556
|
+
gliner: {
|
|
4557
|
+
prettyLabel: "GLiNER",
|
|
4558
|
+
repoName: "GLiNER",
|
|
4559
|
+
repoUrl: "https://github.com/urchade/GLiNER",
|
|
4560
|
+
snippets: gliner,
|
|
4561
|
+
filter: false,
|
|
4562
|
+
countDownloads: {
|
|
4563
|
+
term: { path: "gliner_config.json" }
|
|
4564
|
+
}
|
|
4565
|
+
},
|
|
4566
|
+
grok: {
|
|
4567
|
+
prettyLabel: "Grok",
|
|
4568
|
+
repoName: "Grok",
|
|
4569
|
+
repoUrl: "https://github.com/xai-org/grok-1",
|
|
4570
|
+
filter: false,
|
|
4571
|
+
countDownloads: {
|
|
4572
|
+
terms: { path: ["ckpt/tensor00000_000", "ckpt-0/tensor00000_000"] }
|
|
4573
|
+
}
|
|
4574
|
+
},
|
|
4546
4575
|
keras: {
|
|
4547
4576
|
prettyLabel: "Keras",
|
|
4548
4577
|
repoName: "Keras",
|
|
@@ -4578,6 +4607,15 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
4578
4607
|
snippets: mlx,
|
|
4579
4608
|
filter: true
|
|
4580
4609
|
},
|
|
4610
|
+
"mlx-image": {
|
|
4611
|
+
prettyLabel: "mlx-image",
|
|
4612
|
+
repoName: "mlx-image",
|
|
4613
|
+
repoUrl: "https://github.com/riccardomusmeci/mlx-image",
|
|
4614
|
+
docsUrl: "https://huggingface.co/docs/hub/mlx-image",
|
|
4615
|
+
snippets: mlxim,
|
|
4616
|
+
filter: false,
|
|
4617
|
+
countDownloads: { term: { path: "model.safetensors" } }
|
|
4618
|
+
},
|
|
4581
4619
|
nemo: {
|
|
4582
4620
|
prettyLabel: "NeMo",
|
|
4583
4621
|
repoName: "NeMo",
|
|
@@ -4758,6 +4796,14 @@ var MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
4758
4796
|
countDownloads: {
|
|
4759
4797
|
wildcard: { path: "*.sentis" }
|
|
4760
4798
|
}
|
|
4799
|
+
},
|
|
4800
|
+
whisperkit: {
|
|
4801
|
+
prettyLabel: "WhisperKit",
|
|
4802
|
+
repoName: "WhisperKit",
|
|
4803
|
+
repoUrl: "https://github.com/argmaxinc/WhisperKit",
|
|
4804
|
+
countDownloads: {
|
|
4805
|
+
wildcard: { path: "*/model.mil" }
|
|
4806
|
+
}
|
|
4761
4807
|
}
|
|
4762
4808
|
};
|
|
4763
4809
|
var ALL_MODEL_LIBRARY_KEYS = Object.keys(MODEL_LIBRARIES_UI_ELEMENTS);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huggingface/tasks",
|
|
3
3
|
"packageManager": "pnpm@8.10.5",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"description": "List of ML tasks for huggingface.co/tasks",
|
|
6
6
|
"repository": "https://github.com/huggingface/huggingface.js.git",
|
|
7
7
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^20.11.5",
|
|
36
|
-
"quicktype-core": "https://github.com/huggingface/quicktype/raw/pack-18.0.
|
|
36
|
+
"quicktype-core": "https://github.com/huggingface/quicktype/raw/pack-18.0.17/packages/quicktype-core/quicktype-core-18.0.17.tgz"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"lint": "eslint --quiet --fix --ext .cjs,.ts .",
|
|
@@ -140,6 +140,12 @@ export const flair = (model: ModelData): string[] => [
|
|
|
140
140
|
tagger = SequenceTagger.load("${model.id}")`,
|
|
141
141
|
];
|
|
142
142
|
|
|
143
|
+
export const gliner = (model: ModelData): string[] => [
|
|
144
|
+
`from gliner import GLiNER
|
|
145
|
+
|
|
146
|
+
model = GLiNER.from_pretrained("${model.id}")`,
|
|
147
|
+
];
|
|
148
|
+
|
|
143
149
|
export const keras = (model: ModelData): string[] => [
|
|
144
150
|
`from huggingface_hub import from_pretrained_keras
|
|
145
151
|
|
|
@@ -532,6 +538,12 @@ export HF_HUB_ENABLE_HF_TRANS: string[]FER=1
|
|
|
532
538
|
huggingface-cli download --local-dir ${nameWithoutNamespace(model.id)} ${model.id}`,
|
|
533
539
|
];
|
|
534
540
|
|
|
541
|
+
export const mlxim = (model: ModelData): string[] => [
|
|
542
|
+
`from mlxim.model import create_model
|
|
543
|
+
|
|
544
|
+
model = create_model(${model.id})`,
|
|
545
|
+
];
|
|
546
|
+
|
|
535
547
|
export const nemo = (model: ModelData): string[] => {
|
|
536
548
|
let command: string[] | undefined = undefined;
|
|
537
549
|
// Resolve the tag to a nemo domain/sub-domain
|
package/src/model-libraries.ts
CHANGED
|
@@ -157,6 +157,25 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
157
157
|
term: { path: "pytorch_model.bin" },
|
|
158
158
|
},
|
|
159
159
|
},
|
|
160
|
+
gliner: {
|
|
161
|
+
prettyLabel: "GLiNER",
|
|
162
|
+
repoName: "GLiNER",
|
|
163
|
+
repoUrl: "https://github.com/urchade/GLiNER",
|
|
164
|
+
snippets: snippets.gliner,
|
|
165
|
+
filter: false,
|
|
166
|
+
countDownloads: {
|
|
167
|
+
term: { path: "gliner_config.json" },
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
grok: {
|
|
171
|
+
prettyLabel: "Grok",
|
|
172
|
+
repoName: "Grok",
|
|
173
|
+
repoUrl: "https://github.com/xai-org/grok-1",
|
|
174
|
+
filter: false,
|
|
175
|
+
countDownloads: {
|
|
176
|
+
terms: { path: ["ckpt/tensor00000_000", "ckpt-0/tensor00000_000"] },
|
|
177
|
+
},
|
|
178
|
+
},
|
|
160
179
|
keras: {
|
|
161
180
|
prettyLabel: "Keras",
|
|
162
181
|
repoName: "Keras",
|
|
@@ -192,6 +211,15 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
192
211
|
snippets: snippets.mlx,
|
|
193
212
|
filter: true,
|
|
194
213
|
},
|
|
214
|
+
"mlx-image": {
|
|
215
|
+
prettyLabel: "mlx-image",
|
|
216
|
+
repoName: "mlx-image",
|
|
217
|
+
repoUrl: "https://github.com/riccardomusmeci/mlx-image",
|
|
218
|
+
docsUrl: "https://huggingface.co/docs/hub/mlx-image",
|
|
219
|
+
snippets: snippets.mlxim,
|
|
220
|
+
filter: false,
|
|
221
|
+
countDownloads: { term: { path: "model.safetensors" } },
|
|
222
|
+
},
|
|
195
223
|
nemo: {
|
|
196
224
|
prettyLabel: "NeMo",
|
|
197
225
|
repoName: "NeMo",
|
|
@@ -373,6 +401,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
373
401
|
wildcard: { path: "*.sentis" },
|
|
374
402
|
},
|
|
375
403
|
},
|
|
404
|
+
whisperkit: {
|
|
405
|
+
prettyLabel: "WhisperKit",
|
|
406
|
+
repoName: "WhisperKit",
|
|
407
|
+
repoUrl: "https://github.com/argmaxinc/WhisperKit",
|
|
408
|
+
countDownloads: {
|
|
409
|
+
wildcard: { path: "*/model.mil" },
|
|
410
|
+
},
|
|
411
|
+
},
|
|
376
412
|
} satisfies Record<string, LibraryUiElement>;
|
|
377
413
|
|
|
378
414
|
export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;
|