OpenBMB / MiniCPM-V

MiniCPM-V 2.6: A GPT-4V Level MLLM for Single Image, Multi Image and Video on Your Phone
Apache License 2.0
12.76k stars 894 forks source link

how to modify the system prompt #582

Closed orderer0001 closed 2 months ago

orderer0001 commented 2 months ago

Please tell me how to modify the system prompt during training. I don’t see system_promt in the train file data file.

orderer0001 commented 2 months ago
def conversation_to_ids_qwen2(conversation, tokenizer):
    raw_msg = ""
    chat = [{"role":"system", "content":......}]    # add
    context = []
    for idx, msg in enumerate(conversation):
        role = msg["role"]
        message = msg["content"]
        assert role in ["user", "assistant"]
        if role == "user":
            prefix = "user"
        else:
            prefix = "assistant"
        chat.append({"role":prefix, "content":message})
        raw_msg += prefix + message
    assert set([i['role'] for i in chat]) & set(['assistant'])
Is the above correct?
LDLINGLINGLING commented 2 months ago

This looks fine