Files
qwen3-1.7b-lamini-qlora-ins…/prompt_format.py
ModelHub XC 5edc243636 初始化项目,由ModelHub XC社区提供模型
Model: ericoh929/qwen3-1.7b-lamini-qlora-instruction-tuned
Source: Original Platform
2026-09-10 04:58:20 +08:00

21 lines
550 B
Python

# prompt_format.py
from __future__ import annotations
RESPONSE_TAG = "### Response:"
def format_instruction_prompt(instruction: str, inp: str | None = None) -> str:
instruction = (instruction or "").strip()
inp = (inp or "").strip() if inp is not None else ""
if inp:
return (
f"### Instruction:\n{instruction}\n\n"
f"### Input:\n{inp}\n\n"
f"{RESPONSE_TAG}\n"
)
else:
return (
f"### Instruction:\n{instruction}\n\n"
f"{RESPONSE_TAG}\n"
)