Skip to content

Commit b6f2129

Browse files
authored
Fix conversational autosnippets (#1647)
due to lack of backticks the processor the snippets aren't rendering properly so I fixed it: <img width="768" height="427" alt="Screenshot 2025-07-23 at 14 21 13" src="https://github.com/user-attachments/assets/39ad5428-a103-4172-ae55-dd80a2cdf0c9" />
1 parent 7042fa2 commit b6f2129

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ export const transformers = (model: ModelData): string[] => {
15071507
autoSnippet.push("messages = [", ' {"role": "user", "content": "Who are you?"},', "]");
15081508
}
15091509
autoSnippet.push(
1510-
"inputs = ${processorVarName}.apply_chat_template(",
1510+
`inputs = ${processorVarName}.apply_chat_template(`,
15111511
" messages,",
15121512
" add_generation_prompt=True,",
15131513
" tokenize=True,",
@@ -1516,7 +1516,7 @@ export const transformers = (model: ModelData): string[] => {
15161516
").to(model.device)",
15171517
"",
15181518
"outputs = model.generate(**inputs, max_new_tokens=40)",
1519-
'print(${processorVarName}.decode(outputs[0][inputs["input_ids"].shape[-1]:]))'
1519+
`print(${processorVarName}.decode(outputs[0][inputs["input_ids"].shape[-1]:]))`
15201520
);
15211521
}
15221522
} else {

0 commit comments

Comments
 (0)