how to properly use the chat template?

#32
by LorenzoCevolaniAXA - opened

I am trying to add a system prompt starting from the initial example highlighted in the readme.

I am tryin go go with somthing like this:

    conversation = [
        {"role": "system", "content": "Extract the info from the id cards only.",
        {"role": "user", "content": [{"type": "image", "url": url}]},
    ]
    inputs = processor.apply_chat_template(
        conversation,
        add_generation_prompt=True,
        tokenize=True,
        return_dict=True,
        return_tensors="pt",
    )

When I run the code I inspect the chat template it, so I set tokenize to False and return_dict to False, I get a correct prompt, but when I execute the tokenization and the dict I get an error because the content is not in image or video, anyone else has the same problem?

LorenzoCevolaniAXA changed discussion status to closed

Sign up or log in to comment