Codificação de imagens no prompt
Olá.
Antes de tudo quero expressar gratidão pelo trabalho de desenvolvimento do Gemma-3. Um trabalho priomoroso.
Estou com um projeto e preciso entender como adicionar imagens no prompt usando a estrutura de prompt:
<start_of_turn>user
Describe the contents of this image.
"<start_of_image>
base64? binary? other?
<end_of_turn>
<start_of_turn>model"
Qual deve ser a codificacao usada ao incluir a imagem no prompt para que o modelo possa analisá-la?
Hi @areumtecnologia ,
Thank you so much for your gratitude, please find the following is/are the input(s) for the google/gemma-3-27b-it
model:
Input:
Text string, such as a question, a prompt, or a document to be summarized
Images, normalized to 896 x 896 resolution and encoded to 256 tokens each
Total input context of 128K tokens for the 4B, 12B, and 27B sizes, and 32K tokens for the 1B size
For the instruction tuned models, you need to use chat templates to process the inputs first. Then, you can pass it to the pipeline. Please find the following prompt structure for the google/gemma-3-27b-it
model:
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are a helpful assistant."}]
},
{
"role": "user",
"content": [
{"type": "image", "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"},
{"type": "text", "text": "Describe this image in detail."}
]
}
]
To know more about google/gemma-3-27b-it
please visit the following page and to know more about Gemma family please visit the following document.
Thanks.
Ola,
@BalakrishnaCh
.
Obrigado por responder minha pergunta.
Ja li algumas vezes a documentação do gemma-3, porem a única pista que consegui é o formato do prompt que chega até o modelo.
O que estou querendo saber é mais além disso, pois nesse exemplo a imagem ainda será convertida para um formato que o modelo entenda e é esse formato que preciso saber. Creio que sejam embendings, mas nao tenho certeza.