Please rotate your device

To continue exploring this website, please rotate your device to a vertical orientation

Llama 3.2 11B Vision Instruct

Meta/Llama 3.2 11B Vision Instruct

A vision-capable chat LLM from Meta

large language

Llama 3.2 Vision Instruct uses the same messages format as other Llama models, but with a new image field. Note that while multi-turn conversations are supported, the model can only process one image per generation, which is supplied at the end of the array.

Input

python
import requests

# Replace the empty string with your model id below
model_id = ""
baseten_api_key = os.environ["BASETEN_API_KEY"]

messages = [
    {"role": "user", "content": [
        {"type": "image"},
        {"type": "text", "text": "Can you write a haiku about this image?"}
    ]},
]
image = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/0052a70beed5bf71b92610a43a52df6d286cd5f3/diffusers/rabbit.jpg"
data = {
    "messages": messages,
    "image": image,
    "stream": True,
    "max_new_tokens": 512,
    "temperature": 0.9
}

# Call model endpoint
res = requests.post(
    f"https://model-{model_id}.api.baseten.co/production/predict",
    headers={"Authorization": f"Api-Key {baseten_api_key}"},
    json=data,
    stream=True
)

# Print the generated tokens as they get streamed
for content in res.iter_content():
    print(content.decode("utf-8"), end="", flush=True)

Output

json
{
  "id": "chat-b1e89c98a7294d9dbb9d5e7867d2cb7c",
  "object": "chat.completion",
  "created": 1727839150,
  "model": "meta-llama/Llama-3.2-11B-Vision-Instruct",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "This image is a close-up photograph of a black Labrador puppy with floppy ears and a shiny, healthy coat, gazing up at the camera with large brown eyes.",
        "tool_calls": []
      },
      "logprobs": null,
      "finish_reason": "stop",
      "stop_reason": null
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "total_tokens": 52,
    "completion_tokens": 34
  },
  "prompt_logprobs": null
}