ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

怎么在infer的时候传system prompt?

Open mxw20010804 opened this issue 9 months ago • 3 comments

{"problem": "Given that \begin{align*}x_{1}&=211,\\ x_{2}&=375,\\ x_{3}&=420,\\ x_{4}&=523,\ \text{and}\\ x_{n}&=x_{n-1}-x_{n-2}+x_{n-3}-x_{n-4}\ \text{when}\ n\geq5, \end{align*}find the value of $x_{531}+x_{753}+x_{975}$.", "solution": "Shifting the recurrence over by one and adding, we have: \[\begin{aligned} x_n &= x_{n-1} - x_{n-2} + x_{n-3} - x_{n-4} \\ x_{n-1} &= x_{n-2} - x_{n-3} + x_{n-4} - x_{n-5} \\ \implies x_n + x_{n-1} &= x_{n-1} - x_{n-5} \end{aligned}\]so $x_n = -x_{n-5}$ for all $n.$ In particular, $x_n = -x_{n-5} = -(-x_{n-10}) = x_{n-10},$ so the sequence repeats with period $10.$ Thus, \[\begin{aligned} x_{531} + x_{753} + x_{975} &= x_1 + x_3 + x_5 \\ &= x_1 + x_3 + (x_4-x_3+x_2-x_1) \\ &= x_2 + x_4 \\ &= 375 + 523 = \boxed{898}. \end{aligned}\]", "answer": "898", "subject": "Intermediate Algebra", "level": 4, "unique_id": "test/intermediate_algebra/90.json"}

system prompt的格式应该怎么组织呢??训练的格式是无法进行infer的。

mxw20010804 avatar Apr 21 '25 12:04 mxw20010804

swift infer命令行跑就可以了 --val_dataset <dataset-path>

Jintao-Huang avatar Apr 23 '25 06:04 Jintao-Huang

如果使用python(例如:PtEngine, VllmEngine),需要组织成messages格式

Jintao-Huang avatar Apr 23 '25 06:04 Jintao-Huang

如果使用python(例如:PtEngine, VllmEngine),需要组织成messages格式

想问下,如果想在推理的时候重新组织system-prompt,message的格式是什么样的呢

chenminupup avatar Apr 24 '25 02:04 chenminupup

This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.

github-actions[bot] avatar Jul 24 '25 00:07 github-actions[bot]

This issue has been automatically closed due to inactivity. If needed, it can be reopened.

github-actions[bot] avatar Aug 04 '25 00:08 github-actions[bot]