sft_prompts#
Prompt and chain-of-thought templates for the three tasks, plus the template-filling helper used to instantiate them.
Prompt templates and helpers for MedVision SFT and benchmark evaluation.
This module collects the task prompts, format requirements, and Chain-of-Thought (CoT) reasoning templates shared by supervised finetuning (SFT) data formatting and MedVision benchmark evaluation. Because these strings are consumed by both pipelines, editing a prompt here changes both training targets and evaluation behaviour, so modify with care.
Two prompt families are provided: plain format prompts used in non-CoT
benchmarking, and CoT instruction/template pairs (for tumor-lesion size,
distance, angle, and detection tasks) whose placeholder tokens are filled in by
fill_in_template().
- medvision_bm.sft.sft_prompts.fill_in_template(template, values_dict)[source]#
Substitute placeholder tokens in a CoT template with concrete values.
Iterates over
values_dictand replaces every occurrence of each key intemplatewithstr(value). Used to fill the<...>placeholders in the CoT templates (e.g.COT_TEMPLATE_TL_NORM,COT_TEMPLATE_ANGLE) with per-sample coordinates and measurements.- Parameters:
template (str) – The template string containing placeholder tokens.
values_dict (dict) – Mapping of placeholder token to replacement value; each value is stringified before substitution.
- Returns:
The template with all placeholders replaced.
- Return type:
str