@huggingface/tasks 0.21.35 → 0.21.37
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/local-apps.js +2 -2
- package/dist/commonjs/local-apps.spec.js +2 -2
- package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -1
- package/dist/commonjs/model-libraries-snippets.js +220 -69
- package/dist/commonjs/model-libraries-snippets.spec.js +31 -0
- package/dist/commonjs/model-libraries.js +1 -1
- package/dist/esm/local-apps.js +2 -2
- package/dist/esm/local-apps.spec.js +2 -2
- package/dist/esm/model-libraries-snippets.d.ts.map +1 -1
- package/dist/esm/model-libraries-snippets.js +220 -69
- package/dist/esm/model-libraries-snippets.spec.js +32 -1
- package/dist/esm/model-libraries.js +1 -1
- package/package.json +1 -1
- package/src/local-apps.spec.ts +2 -2
- package/src/local-apps.ts +2 -2
- package/src/model-libraries-snippets.spec.ts +46 -1
- package/src/model-libraries-snippets.ts +290 -72
- package/src/model-libraries.ts +1 -1
|
@@ -393,7 +393,7 @@ const snippetPi = (model, filepath) => {
|
|
|
393
393
|
serverStep,
|
|
394
394
|
{
|
|
395
395
|
title: "Configure the model in Pi",
|
|
396
|
-
setup: "# Install Pi:\nnpm install -g @
|
|
396
|
+
setup: "# Install Pi:\nnpm install -g @earendil-works/pi-coding-agent",
|
|
397
397
|
content: `# Add to ~/.pi/agent/models.json:\n${modelsJson}`,
|
|
398
398
|
},
|
|
399
399
|
{
|
|
@@ -694,7 +694,7 @@ exports.LOCAL_APPS = {
|
|
|
694
694
|
},
|
|
695
695
|
pi: {
|
|
696
696
|
prettyLabel: "Pi",
|
|
697
|
-
docsUrl: "https://github.com/
|
|
697
|
+
docsUrl: "https://github.com/earendil-works/pi",
|
|
698
698
|
mainTask: "text-generation",
|
|
699
699
|
displayOnModelPage: isToolCallingLocalAgentModel,
|
|
700
700
|
snippet: snippetPi,
|
|
@@ -122,7 +122,7 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
|
|
|
122
122
|
};
|
|
123
123
|
const snippet = snippetFunc(model);
|
|
124
124
|
(0, vitest_1.expect)(snippet[0].content).toContain(`llama serve -hf bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
|
|
125
|
-
(0, vitest_1.expect)(snippet[1].setup).toContain("npm install -g @
|
|
125
|
+
(0, vitest_1.expect)(snippet[1].setup).toContain("npm install -g @earendil-works/pi-coding-agent");
|
|
126
126
|
(0, vitest_1.expect)(snippet[1].content).toContain(`"id": "bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}"`);
|
|
127
127
|
(0, vitest_1.expect)(snippet[2].content).toContain("pi");
|
|
128
128
|
});
|
|
@@ -142,7 +142,7 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
|
|
|
142
142
|
const snippet = snippetFunc(model);
|
|
143
143
|
(0, vitest_1.expect)(snippet[0].setup).toContain("uv tool install mlx-lm");
|
|
144
144
|
(0, vitest_1.expect)(snippet[0].content).toContain('mlx_lm.server --model "mlx-community/Llama-3.2-3B-Instruct-mlx"');
|
|
145
|
-
(0, vitest_1.expect)(snippet[1].setup).toContain("npm install -g @
|
|
145
|
+
(0, vitest_1.expect)(snippet[1].setup).toContain("npm install -g @earendil-works/pi-coding-agent");
|
|
146
146
|
(0, vitest_1.expect)(snippet[1].content).toContain('"baseUrl": "http://localhost:8080/v1"');
|
|
147
147
|
(0, vitest_1.expect)(snippet[1].content).toContain('"id": "mlx-community/Llama-3.2-3B-Instruct-mlx"');
|
|
148
148
|
(0, vitest_1.expect)(snippet[2].content).toContain("pi");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-libraries-snippets.d.ts","sourceRoot":"","sources":["../../src/model-libraries-snippets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-libraries-snippets.d.ts","sourceRoot":"","sources":["../../src/model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AAI,OAAO,SAAS,KAAG,MAAM,EAI/C,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,KAAG,MAAM,EAqBlD,CAAC;AA4BF,eAAO,MAAM,MAAM,GAAI,OAAO,SAAS,KAAG,MAAM,EAO/C,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,SAAS,KAAG,MAAM,EAUnD,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,MAAM,EAYnC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,KAAG,MAAM,EAKvD,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,SAAS,KAAG,MAAM,EAI9C,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,SAAS,KAAG,MAAM,EAiB9C,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,SAAS,KAAG,MAAM,EAgD9C,CAAC"}
|
|
@@ -12,11 +12,12 @@ function nameWithoutNamespace(modelId) {
|
|
|
12
12
|
return splitted.length === 1 ? splitted[0] : splitted[1];
|
|
13
13
|
}
|
|
14
14
|
const escapeStringForJson = (str) => JSON.stringify(str).slice(1, -1); // slice is needed to remove surrounding quotes added by JSON.stringify
|
|
15
|
+
const isValidIdentifier = (str) => /^[A-Za-z_]\w*$/.test(str);
|
|
15
16
|
//#region snippets
|
|
16
17
|
const adapters = (model) => [
|
|
17
18
|
`from adapters import AutoAdapterModel
|
|
18
19
|
|
|
19
|
-
model = AutoAdapterModel.from_pretrained("${model.config?.adapter_transformers?.model_name}")
|
|
20
|
+
model = AutoAdapterModel.from_pretrained("${escapeStringForJson(model.config?.adapter_transformers?.model_name ?? "fill-in-model-name")}")
|
|
20
21
|
model.load_adapter("${model.id}", set_active=True)`,
|
|
21
22
|
];
|
|
22
23
|
exports.adapters = adapters;
|
|
@@ -73,7 +74,7 @@ result, message = detector.detect_watermark(watermarked_audio, sr)`;
|
|
|
73
74
|
};
|
|
74
75
|
exports.audioseal = audioseal;
|
|
75
76
|
function get_base_diffusers_model(model) {
|
|
76
|
-
return model.cardData?.base_model?.toString() ?? "fill-in-base-model";
|
|
77
|
+
return escapeStringForJson(model.cardData?.base_model?.toString() ?? "fill-in-base-model");
|
|
77
78
|
}
|
|
78
79
|
function get_prompt_from_diffusers_model(model) {
|
|
79
80
|
const prompt = model.widgetData?.[0]?.text ?? model.cardData?.instance_prompt;
|
|
@@ -918,7 +919,8 @@ backbone = keras_hub.models.Backbone.from_preset("hf://${modelId}")
|
|
|
918
919
|
`;
|
|
919
920
|
const keras_hub = (model) => {
|
|
920
921
|
const modelId = model.id;
|
|
921
|
-
|
|
922
|
+
// interpolated as a Python class name, so a non-identifier is treated as absent
|
|
923
|
+
const tasks = (model.config?.keras_hub?.tasks ?? []).filter(isValidIdentifier);
|
|
922
924
|
const snippets = [];
|
|
923
925
|
// First, generate tasks with examples
|
|
924
926
|
for (const [task, snippet] of Object.entries(_keras_hub_tasks_with_example)) {
|
|
@@ -989,77 +991,219 @@ import soundfile as sf
|
|
|
989
991
|
sf.write('output.wav', audio, 24000)`,
|
|
990
992
|
];
|
|
991
993
|
exports.kittentts = kittentts;
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
994
|
+
/**
|
|
995
|
+
* Detect LTX-2.5 (split weights + Gemma 4 TE file) vs LTX-2.3
|
|
996
|
+
* (monolith checkpoint + separate Gemma 3 root). Prefer explicit tags / ids /
|
|
997
|
+
* base_model refs; fall back to 2.3 for unmarked legacy cards.
|
|
998
|
+
*/
|
|
999
|
+
function _isLtx25Model(model) {
|
|
1000
|
+
const refs = [model.id, ...(model.tags ?? [])];
|
|
1001
|
+
const base = model.cardData?.base_model;
|
|
1002
|
+
if (Array.isArray(base)) {
|
|
1003
|
+
refs.push(...base);
|
|
1004
|
+
}
|
|
1005
|
+
else if (base) {
|
|
1006
|
+
refs.push(base);
|
|
1007
|
+
}
|
|
1008
|
+
return refs.some((ref) => /ltx[-_]?2\.5/i.test(ref));
|
|
1009
|
+
}
|
|
1010
|
+
const _LTX_I2V_HINT = `# For image-to-video, add: --image path/to/image.jpg 0 0.8`;
|
|
1011
|
+
const _LTX_GEMMA3_ROOT = "models/gemma-3-12b";
|
|
1012
|
+
const _LTX_DEFAULT_PROMPT = "A beautiful sunset over the ocean";
|
|
1013
|
+
function _ltxInstall(is25) {
|
|
1014
|
+
// natten is only needed for the LTX-2.5 diffusion VAE (skipped automatically on Windows/macOS).
|
|
1015
|
+
return `# Install the LTX-2 pipelines
|
|
995
1016
|
git clone https://github.com/Lightricks/LTX-2.git
|
|
996
1017
|
cd LTX-2
|
|
997
|
-
uv sync --frozen`;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1018
|
+
uv sync ${is25 ? "--extra natten" : "--frozen"}`;
|
|
1019
|
+
}
|
|
1020
|
+
function _ltxRun(module, args, comment, options) {
|
|
1021
|
+
const body = `uv run python -m ltx_pipelines.${module} \\\n ${args.join(" \\\n ")}`;
|
|
1022
|
+
const parts = [`# ${comment}`, body];
|
|
1023
|
+
if (options?.footer) {
|
|
1024
|
+
parts.push(options.footer);
|
|
1025
|
+
}
|
|
1026
|
+
if (options?.hint) {
|
|
1027
|
+
parts.push(_LTX_I2V_HINT);
|
|
1028
|
+
}
|
|
1029
|
+
return parts.join("\n");
|
|
1030
|
+
}
|
|
1031
|
+
const _LTX_DETAILING_LORA_REPO = "Lightricks/LTX-2.5-22b-IC-LoRA-Pixel-Spatial-Upscaler";
|
|
1032
|
+
const _LTX_DETAILING_LORA_FILE = "ltx-2.5-22b-ic-lora-pixel-spatial-upscaler-x2-1.0.safetensors";
|
|
1033
|
+
function _ltx25SplitArgs(paths) {
|
|
1034
|
+
const args = [
|
|
1035
|
+
`--transformer-path ${paths.transformer}`,
|
|
1036
|
+
`--text-encoder-path ${paths.textEncoder}`,
|
|
1037
|
+
`--video-vae-path ${paths.videoVae}`,
|
|
1038
|
+
`--audio-vae-path ${paths.audioVae}`,
|
|
1039
|
+
`--spatial-upsampler-path ${paths.spatialUpsampler}`,
|
|
1040
|
+
];
|
|
1041
|
+
if (paths.temporalUpsampler) {
|
|
1042
|
+
args.push(`--temporal-upsampler-path ${paths.temporalUpsampler}`);
|
|
1043
|
+
}
|
|
1044
|
+
return args;
|
|
1045
|
+
}
|
|
1046
|
+
function _ltx25RepoPaths(localDir) {
|
|
1047
|
+
const shared = {
|
|
1048
|
+
transformer: `${localDir}/diffusion_models/<distilled-transformer>.safetensors`,
|
|
1049
|
+
textEncoder: `${localDir}/text_encoders/gemma4-12b-with-proj-ltx-2.5-bf16.safetensors`,
|
|
1050
|
+
videoVae: `${localDir}/vae/<video-vae>.safetensors`,
|
|
1051
|
+
audioVae: `${localDir}/vae/<audio-vae>.safetensors`,
|
|
1052
|
+
spatialUpsampler: `${localDir}/latent_upscale_models/<spatial-upsampler>.safetensors`,
|
|
1053
|
+
};
|
|
1054
|
+
return {
|
|
1055
|
+
distilled: shared,
|
|
1056
|
+
// DFR runs on the distilled transformer; detailing IC-LoRA is required separately.
|
|
1057
|
+
dfr: {
|
|
1058
|
+
...shared,
|
|
1059
|
+
temporalUpsampler: `${localDir}/latent_upscale_models/<temporal-upsampler>.safetensors`,
|
|
1060
|
+
},
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
function _ltx25BasePlaceholderPaths() {
|
|
1064
|
+
return {
|
|
1065
|
+
transformer: "path/to/distilled-transformer.safetensors",
|
|
1066
|
+
textEncoder: "path/to/gemma4-12b-with-proj-ltx-2.5-bf16.safetensors",
|
|
1067
|
+
videoVae: "path/to/video-vae.safetensors",
|
|
1068
|
+
audioVae: "path/to/audio-vae.safetensors",
|
|
1069
|
+
spatialUpsampler: "path/to/spatial-upsampler.safetensors",
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
function _ltx25Download(modelId, localDir, kind) {
|
|
1073
|
+
if (kind === "adapter") {
|
|
1074
|
+
return `# Download the adapter weights from this repo
|
|
1075
|
+
# (base components come from Lightricks/LTX-2.5 — see Files and versions)
|
|
1076
|
+
hf download ${modelId} --local-dir ${localDir}`;
|
|
1077
|
+
}
|
|
1078
|
+
const detailingDir = `models/${_LTX_DETAILING_LORA_REPO.split("/")[1]}`;
|
|
1079
|
+
return `# Download weights from this repo
|
|
1080
|
+
# Substitute filenames from this repo's "Files and versions" if they differ
|
|
1081
|
+
hf download ${modelId} \\
|
|
1082
|
+
diffusion_models/<distilled-transformer>.safetensors \\
|
|
1083
|
+
text_encoders/gemma4-12b-with-proj-ltx-2.5-bf16.safetensors \\
|
|
1084
|
+
vae/<video-vae>.safetensors \\
|
|
1085
|
+
vae/<audio-vae>.safetensors \\
|
|
1086
|
+
latent_upscale_models/<spatial-upsampler>.safetensors \\
|
|
1087
|
+
latent_upscale_models/<temporal-upsampler>.safetensors \\
|
|
1088
|
+
--local-dir ${localDir}
|
|
1089
|
+
# DFR requires the detailing IC-LoRA (separate repo; strength is fixed at 0.5)
|
|
1090
|
+
hf download ${_LTX_DETAILING_LORA_REPO} --local-dir ${detailingDir}`;
|
|
1091
|
+
}
|
|
1092
|
+
function _ltx23Download(modelId, localDir) {
|
|
1093
|
+
return `# Download the weights from this repo, plus the Gemma text encoder
|
|
1094
|
+
hf download ${modelId} --local-dir ${localDir}
|
|
1095
|
+
hf download google/gemma-3-12b-it-qat-q4_0-unquantized --local-dir ${_LTX_GEMMA3_ROOT}`;
|
|
1096
|
+
}
|
|
1097
|
+
function _ltx25Snippets(model, localDir, tags) {
|
|
1098
|
+
const install = _ltxInstall(true);
|
|
1099
|
+
const loraArg = `--lora ${localDir}/<weights>.safetensors 1.0`;
|
|
1100
|
+
const basePaths = _ltx25BasePlaceholderPaths();
|
|
1101
|
+
if (tags.includes("ic-lora")) {
|
|
1102
|
+
return [
|
|
1103
|
+
install,
|
|
1104
|
+
_ltx25Download(model.id, localDir, "adapter"),
|
|
1105
|
+
_ltxRun("ic_lora", [
|
|
1106
|
+
..._ltx25SplitArgs(basePaths),
|
|
1107
|
+
loraArg,
|
|
1108
|
+
"--video-conditioning reference.mp4 1.0",
|
|
1109
|
+
`--prompt "your prompt here"`,
|
|
1110
|
+
"--output-path output.mp4",
|
|
1111
|
+
], "Video-to-video with the IC-LoRA (runs on the distilled LTX-2.5 base)"),
|
|
1112
|
+
];
|
|
1113
|
+
}
|
|
1114
|
+
if (tags.includes("lora")) {
|
|
1115
|
+
return [
|
|
1116
|
+
install,
|
|
1117
|
+
_ltx25Download(model.id, localDir, "adapter"),
|
|
1118
|
+
_ltxRun("distilled", [..._ltx25SplitArgs(basePaths), loraArg, `--prompt "your prompt here"`, "--output-path output.mp4"], "Text/image-to-video with the LoRA on the distilled LTX-2.5 pipeline", { hint: true }),
|
|
1119
|
+
];
|
|
1120
|
+
}
|
|
1121
|
+
const { distilled, dfr } = _ltx25RepoPaths(localDir);
|
|
1122
|
+
const detailingDir = `models/${_LTX_DETAILING_LORA_REPO.split("/")[1]}`;
|
|
1123
|
+
return [
|
|
1124
|
+
install,
|
|
1125
|
+
_ltx25Download(model.id, localDir, "base"),
|
|
1126
|
+
_ltxRun("distilled", [
|
|
1127
|
+
..._ltx25SplitArgs(distilled),
|
|
1128
|
+
"--num-frames 121",
|
|
1129
|
+
`--prompt "${_LTX_DEFAULT_PROMPT}"`,
|
|
1130
|
+
"--output-path output.mp4",
|
|
1131
|
+
], "Distilled LTX-2.5 pipeline (fast)", { hint: true }),
|
|
1132
|
+
_ltxRun("dfr_pipeline", [
|
|
1133
|
+
..._ltx25SplitArgs(dfr),
|
|
1134
|
+
`--detailing-lora ${detailingDir}/${_LTX_DETAILING_LORA_FILE}`,
|
|
1135
|
+
"--spatial-upscalings 1",
|
|
1136
|
+
"--temporal-upscalings 1",
|
|
1137
|
+
"--height 1088",
|
|
1138
|
+
"--width 1920",
|
|
1139
|
+
"--num-frames 121",
|
|
1140
|
+
`--prompt "${_LTX_DEFAULT_PROMPT}"`,
|
|
1141
|
+
"--output-path output.mp4",
|
|
1142
|
+
], "DFR pipeline (higher detail fidelity; optional temporal 2x/4x)", {
|
|
1143
|
+
footer: "# For 4K: --spatial-upscalings 2 --width 3840 --height 2176",
|
|
1144
|
+
hint: true,
|
|
1145
|
+
}),
|
|
1146
|
+
];
|
|
1147
|
+
}
|
|
1148
|
+
function _ltx23Snippets(model, localDir, tags) {
|
|
1149
|
+
const install = _ltxInstall(false);
|
|
1150
|
+
const download = _ltx23Download(model.id, localDir);
|
|
1151
|
+
const loraArg = `--lora ${localDir}/<weights>.safetensors 1.0`;
|
|
1152
|
+
const gemma = `--gemma-root ${_LTX_GEMMA3_ROOT}`;
|
|
1008
1153
|
if (tags.includes("ic-lora")) {
|
|
1009
1154
|
return [
|
|
1010
1155
|
install,
|
|
1011
1156
|
download,
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1157
|
+
_ltxRun("ic_lora", [
|
|
1158
|
+
"--distilled-checkpoint-path path/to/distilled_checkpoint.safetensors",
|
|
1159
|
+
"--spatial-upsampler-path path/to/spatial_upsampler.safetensors",
|
|
1160
|
+
gemma,
|
|
1161
|
+
loraArg,
|
|
1162
|
+
"--video-conditioning reference.mp4 1.0",
|
|
1163
|
+
`--prompt "your prompt here"`,
|
|
1164
|
+
"--output-path output.mp4",
|
|
1165
|
+
], "Video-to-video with the IC-LoRA (runs on the distilled base model)"),
|
|
1021
1166
|
];
|
|
1022
1167
|
}
|
|
1023
|
-
// Standard LoRA applied on top of the base pipeline.
|
|
1024
1168
|
if (tags.includes("lora")) {
|
|
1025
1169
|
return [
|
|
1026
1170
|
install,
|
|
1027
1171
|
download,
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
${imageToVideoHint}`,
|
|
1172
|
+
_ltxRun("ti2vid_two_stages_hq", [
|
|
1173
|
+
"--checkpoint-path path/to/checkpoint.safetensors",
|
|
1174
|
+
"--distilled-lora path/to/distilled_lora.safetensors 0.8",
|
|
1175
|
+
"--spatial-upsampler-path path/to/spatial_upsampler.safetensors",
|
|
1176
|
+
gemma,
|
|
1177
|
+
loraArg,
|
|
1178
|
+
`--prompt "your prompt here"`,
|
|
1179
|
+
"--output-path output.mp4",
|
|
1180
|
+
], "Text/image-to-video with the LoRA on the HQ two-stage base pipeline", { hint: true }),
|
|
1038
1181
|
];
|
|
1039
1182
|
}
|
|
1040
|
-
// Base model: the fast (distilled) and HQ (two-stage) pipelines. Substitute the
|
|
1041
|
-
// .safetensors filenames with the ones listed under this repo's "Files and versions".
|
|
1042
1183
|
return [
|
|
1043
1184
|
install,
|
|
1044
1185
|
download,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
--output-path output.mp4
|
|
1061
|
-
${imageToVideoHint}`,
|
|
1186
|
+
_ltxRun("distilled", [
|
|
1187
|
+
`--distilled-checkpoint-path ${localDir}/<distilled-checkpoint>.safetensors`,
|
|
1188
|
+
`--spatial-upsampler-path ${localDir}/<spatial-upsampler>.safetensors`,
|
|
1189
|
+
gemma,
|
|
1190
|
+
`--prompt "${_LTX_DEFAULT_PROMPT}"`,
|
|
1191
|
+
"--output-path output.mp4",
|
|
1192
|
+
], "Fast pipeline (distilled model, no distilled LoRA needed)", { hint: true }),
|
|
1193
|
+
_ltxRun("ti2vid_two_stages_hq", [
|
|
1194
|
+
`--checkpoint-path ${localDir}/<checkpoint>.safetensors`,
|
|
1195
|
+
`--distilled-lora ${localDir}/<distilled-lora>.safetensors 0.8`,
|
|
1196
|
+
`--spatial-upsampler-path ${localDir}/<spatial-upsampler>.safetensors`,
|
|
1197
|
+
gemma,
|
|
1198
|
+
`--prompt "${_LTX_DEFAULT_PROMPT}"`,
|
|
1199
|
+
"--output-path output.mp4",
|
|
1200
|
+
], "HQ pipeline (two-stage, higher quality)", { hint: true }),
|
|
1062
1201
|
];
|
|
1202
|
+
}
|
|
1203
|
+
const ltx = (model) => {
|
|
1204
|
+
const localDir = `models/${nameWithoutNamespace(model.id)}`;
|
|
1205
|
+
const tags = model.tags ?? [];
|
|
1206
|
+
return _isLtx25Model(model) ? _ltx25Snippets(model, localDir, tags) : _ltx23Snippets(model, localDir, tags);
|
|
1063
1207
|
};
|
|
1064
1208
|
exports.ltx = ltx;
|
|
1065
1209
|
const lightning_ir = (model) => {
|
|
@@ -1225,7 +1369,7 @@ model = MeshAnything(args)`,
|
|
|
1225
1369
|
exports.mesh_anything = mesh_anything;
|
|
1226
1370
|
const multimolecule = (model) => {
|
|
1227
1371
|
const widgetExample = model.widgetData?.[0];
|
|
1228
|
-
const exampleText = widgetExample?.text;
|
|
1372
|
+
const exampleText = escapeStringForJson(widgetExample?.text ?? "");
|
|
1229
1373
|
const maskToken = model.mask_token ?? "<mask>";
|
|
1230
1374
|
const sequence = exampleText?.replace(maskToken, "A");
|
|
1231
1375
|
const snippets = [`pip install multimolecule`];
|
|
@@ -1283,8 +1427,9 @@ openasr transcribe audio.wav --model ${modelId}`,
|
|
|
1283
1427
|
};
|
|
1284
1428
|
exports.openasr = openasr;
|
|
1285
1429
|
const paddlenlp = (model) => {
|
|
1286
|
-
|
|
1287
|
-
|
|
1430
|
+
const architecture = model.config?.architectures?.[0];
|
|
1431
|
+
// interpolated as a Python class name, so a non-identifier is treated as absent
|
|
1432
|
+
if (architecture && isValidIdentifier(architecture)) {
|
|
1288
1433
|
return [
|
|
1289
1434
|
[
|
|
1290
1435
|
`from paddlenlp.transformers import AutoTokenizer, ${architecture}`,
|
|
@@ -1536,7 +1681,7 @@ const skopsPickle = (model, modelFile) => {
|
|
|
1536
1681
|
from skops.hub_utils import download
|
|
1537
1682
|
download("${model.id}", "path_to_folder")
|
|
1538
1683
|
model = joblib.load(
|
|
1539
|
-
"${modelFile}"
|
|
1684
|
+
"${escapeStringForJson(modelFile)}"
|
|
1540
1685
|
)
|
|
1541
1686
|
# only load pickle files from sources you trust
|
|
1542
1687
|
# read more about it here https://skops.readthedocs.io/en/stable/persistence.html`,
|
|
@@ -1549,7 +1694,7 @@ from skops.io import load
|
|
|
1549
1694
|
download("${model.id}", "path_to_folder")
|
|
1550
1695
|
# make sure model file is in skops format
|
|
1551
1696
|
# if model is a pickle file, make sure it's from a source you trust
|
|
1552
|
-
model = load("path_to_folder/${modelFile}")`,
|
|
1697
|
+
model = load("path_to_folder/${escapeStringForJson(modelFile)}")`,
|
|
1553
1698
|
];
|
|
1554
1699
|
};
|
|
1555
1700
|
const skopsJobLib = (model) => {
|
|
@@ -1816,11 +1961,17 @@ exports.terratorch = terratorch;
|
|
|
1816
1961
|
const hasChatTemplate = (model) => model.config?.tokenizer_config?.chat_template !== undefined ||
|
|
1817
1962
|
model.config?.processor_config?.chat_template !== undefined ||
|
|
1818
1963
|
model.config?.chat_template_jinja !== undefined;
|
|
1964
|
+
// interpolated as a Python class name (and into RegExps in pruna_transformers), so a non-identifier is treated as absent
|
|
1965
|
+
const autoModelClass = (model) => {
|
|
1966
|
+
const autoModel = model.transformersInfo?.auto_model;
|
|
1967
|
+
return autoModel && isValidIdentifier(autoModel) ? autoModel : undefined;
|
|
1968
|
+
};
|
|
1819
1969
|
const transformers = (model) => {
|
|
1820
1970
|
const info = model.transformersInfo;
|
|
1821
1971
|
if (!info) {
|
|
1822
1972
|
return [`# ⚠️ Type of model unknown`];
|
|
1823
1973
|
}
|
|
1974
|
+
const auto_model = autoModelClass(model) ?? "AutoModel";
|
|
1824
1975
|
const remote_code_snippet = model.tags.includes(TAG_CUSTOM_CODE) ? ", trust_remote_code=True" : "";
|
|
1825
1976
|
const autoSnippet = [];
|
|
1826
1977
|
if (info.processor) {
|
|
@@ -1829,7 +1980,7 @@ const transformers = (model) => {
|
|
|
1829
1980
|
: info.processor === "AutoFeatureExtractor"
|
|
1830
1981
|
? "extractor"
|
|
1831
1982
|
: "processor";
|
|
1832
|
-
autoSnippet.push("# Load model directly", `from transformers import ${info.processor}, ${
|
|
1983
|
+
autoSnippet.push("# Load model directly", `from transformers import ${info.processor}, ${auto_model}`, "", `${processorVarName} = ${info.processor}.from_pretrained("${model.id}"` + remote_code_snippet + ")", `model = ${auto_model}.from_pretrained("${model.id}"` + remote_code_snippet + ', device_map="auto")');
|
|
1833
1984
|
if (model.tags.includes("conversational") && hasChatTemplate(model)) {
|
|
1834
1985
|
if (model.tags.includes("image-text-to-text")) {
|
|
1835
1986
|
autoSnippet.push("messages = [", [
|
|
@@ -1849,7 +2000,7 @@ const transformers = (model) => {
|
|
|
1849
2000
|
}
|
|
1850
2001
|
}
|
|
1851
2002
|
else {
|
|
1852
|
-
autoSnippet.push("# Load model directly", `from transformers import ${
|
|
2003
|
+
autoSnippet.push("# Load model directly", `from transformers import ${auto_model}`, `model = ${auto_model}.from_pretrained("${model.id}"` + remote_code_snippet + ', device_map="auto")');
|
|
1853
2004
|
}
|
|
1854
2005
|
if (model.pipeline_tag && library_to_tasks_js_1.LIBRARY_TASK_MAPPING.transformers?.includes(model.pipeline_tag)) {
|
|
1855
2006
|
const pipelineSnippet = ["# Use a pipeline as a high-level helper"];
|
|
@@ -1927,7 +2078,7 @@ const peft = (model) => {
|
|
|
1927
2078
|
`from peft import PeftModel
|
|
1928
2079
|
from transformers import AutoModelFor${pefttask}
|
|
1929
2080
|
|
|
1930
|
-
base_model = AutoModelFor${pefttask}.from_pretrained("${peftBaseModel}")
|
|
2081
|
+
base_model = AutoModelFor${pefttask}.from_pretrained("${escapeStringForJson(peftBaseModel)}")
|
|
1931
2082
|
model = PeftModel.from_pretrained(base_model, "${model.id}")`,
|
|
1932
2083
|
];
|
|
1933
2084
|
};
|
|
@@ -2342,18 +2493,18 @@ const pruna_diffusers = (model) => {
|
|
|
2342
2493
|
.trim());
|
|
2343
2494
|
};
|
|
2344
2495
|
const pruna_transformers = (model) => {
|
|
2345
|
-
const
|
|
2496
|
+
const auto_model = autoModelClass(model);
|
|
2346
2497
|
const transformersSnippets = (0, exports.transformers)(model);
|
|
2347
2498
|
// Replace pipeline with PrunaModel
|
|
2348
2499
|
let processedSnippets = transformersSnippets.map((snippet) => snippet
|
|
2349
2500
|
.replace(/from transformers import pipeline/g, "from pruna import PrunaModel")
|
|
2350
2501
|
.replace(/pipeline\([^)]*\)/g, `PrunaModel.from_pretrained("${model.id}")`));
|
|
2351
2502
|
// Additional cleanup if auto_model info is available
|
|
2352
|
-
if (
|
|
2503
|
+
if (auto_model) {
|
|
2353
2504
|
processedSnippets = processedSnippets.map((snippet) => snippet
|
|
2354
|
-
.replace(new RegExp(`from transformers import ${
|
|
2355
|
-
.replace(new RegExp(`${
|
|
2356
|
-
.replace(new RegExp(`^.*from.*import.*(, *${
|
|
2505
|
+
.replace(new RegExp(`from transformers import ${auto_model}\n?`, "g"), "")
|
|
2506
|
+
.replace(new RegExp(`${auto_model}.from_pretrained`, "g"), "PrunaModel.from_pretrained")
|
|
2507
|
+
.replace(new RegExp(`^.*from.*import.*(, *${auto_model})+.*$`, "gm"), (line) => line.replace(new RegExp(`, *${auto_model}`, "g"), "")));
|
|
2357
2508
|
}
|
|
2358
2509
|
return processedSnippets;
|
|
2359
2510
|
};
|
|
@@ -52,4 +52,35 @@ output = llm(
|
|
|
52
52
|
)
|
|
53
53
|
print(output)`);
|
|
54
54
|
});
|
|
55
|
+
// a repo owner can put anything in config.json / the model card, so every interpolated value
|
|
56
|
+
// must either be escaped (string literals) or rejected (bare identifiers)
|
|
57
|
+
(0, vitest_1.describe)("repo-controlled values are not injectable", () => {
|
|
58
|
+
const PAYLOAD = `")\nimport os; os.system("id`;
|
|
59
|
+
vitest_1.it.each([
|
|
60
|
+
["adapters", model_libraries_snippets_js_1.adapters, { config: { adapter_transformers: { model_name: PAYLOAD } } }],
|
|
61
|
+
["diffusers", model_libraries_snippets_js_1.diffusers, { tags: ["lora"], cardData: { base_model: PAYLOAD, instance_prompt: PAYLOAD } }],
|
|
62
|
+
["keras_hub", model_libraries_snippets_js_1.keras_hub, { config: { keras_hub: { tasks: [PAYLOAD, "TextClassifier"] } } }],
|
|
63
|
+
["paddlenlp", model_libraries_snippets_js_1.paddlenlp, { config: { architectures: [PAYLOAD] } }],
|
|
64
|
+
["peft", model_libraries_snippets_js_1.peft, { config: { peft: { base_model_name_or_path: PAYLOAD, task_type: "CAUSAL_LM" } } }],
|
|
65
|
+
["multimolecule", model_libraries_snippets_js_1.multimolecule, { widgetData: [{ text: PAYLOAD }] }],
|
|
66
|
+
["transformers", model_libraries_snippets_js_1.transformers, { transformersInfo: { auto_model: PAYLOAD, processor: "AutoTokenizer" } }],
|
|
67
|
+
[
|
|
68
|
+
"sklearn",
|
|
69
|
+
model_libraries_snippets_js_1.sklearn,
|
|
70
|
+
{ tags: ["skops"], config: { sklearn: { model: { file: PAYLOAD }, model_format: "pickle" } } },
|
|
71
|
+
],
|
|
72
|
+
])("%s", (_name, snippetFn, model) => {
|
|
73
|
+
const snippet = snippetFn({ id: "user/model", tags: [], inference: "", ...model }).join("\n");
|
|
74
|
+
(0, vitest_1.expect)(snippet).not.toContain(PAYLOAD);
|
|
75
|
+
});
|
|
76
|
+
(0, vitest_1.it)("keras_hub keeps the valid task next to a rejected one", () => {
|
|
77
|
+
const model = {
|
|
78
|
+
id: "user/model",
|
|
79
|
+
tags: [],
|
|
80
|
+
inference: "",
|
|
81
|
+
config: { keras_hub: { tasks: [PAYLOAD, "TextClassifier"] } },
|
|
82
|
+
};
|
|
83
|
+
(0, vitest_1.expect)((0, model_libraries_snippets_js_1.keras_hub)(model).join("\n")).toContain("keras_hub.models.TextClassifier.from_preset");
|
|
84
|
+
});
|
|
85
|
+
});
|
|
55
86
|
});
|
|
@@ -796,7 +796,7 @@ exports.MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
796
796
|
countDownloads: `path_extension:"pt"`,
|
|
797
797
|
},
|
|
798
798
|
ltx: {
|
|
799
|
-
prettyLabel: "LTX
|
|
799
|
+
prettyLabel: "LTX-2",
|
|
800
800
|
repoName: "LTX-2",
|
|
801
801
|
repoUrl: "https://github.com/Lightricks/LTX-2",
|
|
802
802
|
docsUrl: "https://github.com/Lightricks/LTX-2",
|
package/dist/esm/local-apps.js
CHANGED
|
@@ -390,7 +390,7 @@ const snippetPi = (model, filepath) => {
|
|
|
390
390
|
serverStep,
|
|
391
391
|
{
|
|
392
392
|
title: "Configure the model in Pi",
|
|
393
|
-
setup: "# Install Pi:\nnpm install -g @
|
|
393
|
+
setup: "# Install Pi:\nnpm install -g @earendil-works/pi-coding-agent",
|
|
394
394
|
content: `# Add to ~/.pi/agent/models.json:\n${modelsJson}`,
|
|
395
395
|
},
|
|
396
396
|
{
|
|
@@ -691,7 +691,7 @@ export const LOCAL_APPS = {
|
|
|
691
691
|
},
|
|
692
692
|
pi: {
|
|
693
693
|
prettyLabel: "Pi",
|
|
694
|
-
docsUrl: "https://github.com/
|
|
694
|
+
docsUrl: "https://github.com/earendil-works/pi",
|
|
695
695
|
mainTask: "text-generation",
|
|
696
696
|
displayOnModelPage: isToolCallingLocalAgentModel,
|
|
697
697
|
snippet: snippetPi,
|
|
@@ -120,7 +120,7 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
|
|
|
120
120
|
};
|
|
121
121
|
const snippet = snippetFunc(model);
|
|
122
122
|
expect(snippet[0].content).toContain(`llama serve -hf bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
|
|
123
|
-
expect(snippet[1].setup).toContain("npm install -g @
|
|
123
|
+
expect(snippet[1].setup).toContain("npm install -g @earendil-works/pi-coding-agent");
|
|
124
124
|
expect(snippet[1].content).toContain(`"id": "bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}"`);
|
|
125
125
|
expect(snippet[2].content).toContain("pi");
|
|
126
126
|
});
|
|
@@ -140,7 +140,7 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\
|
|
|
140
140
|
const snippet = snippetFunc(model);
|
|
141
141
|
expect(snippet[0].setup).toContain("uv tool install mlx-lm");
|
|
142
142
|
expect(snippet[0].content).toContain('mlx_lm.server --model "mlx-community/Llama-3.2-3B-Instruct-mlx"');
|
|
143
|
-
expect(snippet[1].setup).toContain("npm install -g @
|
|
143
|
+
expect(snippet[1].setup).toContain("npm install -g @earendil-works/pi-coding-agent");
|
|
144
144
|
expect(snippet[1].content).toContain('"baseUrl": "http://localhost:8080/v1"');
|
|
145
145
|
expect(snippet[1].content).toContain('"id": "mlx-community/Llama-3.2-3B-Instruct-mlx"');
|
|
146
146
|
expect(snippet[2].content).toContain("pi");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-libraries-snippets.d.ts","sourceRoot":"","sources":["../../src/model-libraries-snippets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-libraries-snippets.d.ts","sourceRoot":"","sources":["../../src/model-libraries-snippets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAoBjD,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,KAAG,MAAM,EAOjD,CAAC;AAkBF,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,KAAG,MAAM,EAKjD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,KAAG,MAAM,EAIhD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,KAAG,MAAM,EAIjD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,KAAG,MAAM,EAkBlD,CAA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