@huggingface/tasks 0.19.29 → 0.19.30
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.
|
@@ -1446,7 +1446,7 @@ const transformers = (model) => {
|
|
|
1446
1446
|
else {
|
|
1447
1447
|
autoSnippet.push("messages = [", ' {"role": "user", "content": "Who are you?"},', "]");
|
|
1448
1448
|
}
|
|
1449
|
-
autoSnippet.push(
|
|
1449
|
+
autoSnippet.push(`inputs = ${processorVarName}.apply_chat_template(`, " messages,", " add_generation_prompt=True,", " tokenize=True,", " return_dict=True,", ' return_tensors="pt",', ").to(model.device)", "", "outputs = model.generate(**inputs, max_new_tokens=40)", `print(${processorVarName}.decode(outputs[0][inputs["input_ids"].shape[-1]:]))`);
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
1452
|
else {
|
|
@@ -1377,7 +1377,7 @@ export const transformers = (model) => {
|
|
|
1377
1377
|
else {
|
|
1378
1378
|
autoSnippet.push("messages = [", ' {"role": "user", "content": "Who are you?"},', "]");
|
|
1379
1379
|
}
|
|
1380
|
-
autoSnippet.push(
|
|
1380
|
+
autoSnippet.push(`inputs = ${processorVarName}.apply_chat_template(`, " messages,", " add_generation_prompt=True,", " tokenize=True,", " return_dict=True,", ' return_tensors="pt",', ").to(model.device)", "", "outputs = model.generate(**inputs, max_new_tokens=40)", `print(${processorVarName}.decode(outputs[0][inputs["input_ids"].shape[-1]:]))`);
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
else {
|
package/package.json
CHANGED
|
@@ -1507,7 +1507,7 @@ export const transformers = (model: ModelData): string[] => {
|
|
|
1507
1507
|
autoSnippet.push("messages = [", ' {"role": "user", "content": "Who are you?"},', "]");
|
|
1508
1508
|
}
|
|
1509
1509
|
autoSnippet.push(
|
|
1510
|
-
|
|
1510
|
+
`inputs = ${processorVarName}.apply_chat_template(`,
|
|
1511
1511
|
" messages,",
|
|
1512
1512
|
" add_generation_prompt=True,",
|
|
1513
1513
|
" tokenize=True,",
|
|
@@ -1516,7 +1516,7 @@ export const transformers = (model: ModelData): string[] => {
|
|
|
1516
1516
|
").to(model.device)",
|
|
1517
1517
|
"",
|
|
1518
1518
|
"outputs = model.generate(**inputs, max_new_tokens=40)",
|
|
1519
|
-
|
|
1519
|
+
`print(${processorVarName}.decode(outputs[0][inputs["input_ids"].shape[-1]:]))`
|
|
1520
1520
|
);
|
|
1521
1521
|
}
|
|
1522
1522
|
} else {
|