跳到正文
Ollama:Blog·· 2024-11-06AI 評分56

Ollama 現已支援運行 Llama 3.2 Vision 11B 和 90B 版本

Llama 3.2 Vision

AI 導讀

Ollama 現已提供 Llama 3.2 Vision 的 11B 和 90B 版本供用戶運行。使用者需下載 Ollama 0.4;11B 版本至少需要 8GB VRAM,90B 版本至少需要 64 GB VRAM。模型可透過終端機加入圖片提示詞,亦可使用 Ollama Python、JavaScript library 或 cURL 呼叫。

正文

Llama 3.2 Vision is now available to run in Ollama, in both 11B and 90B sizes.

Get started

Download Ollama 0.4, then run:

ollama run llama3.2-vision

To run the larger 90B model:

ollama run llama3.2-vision:90b

To add an image to the prompt, drag and drop it into the terminal, or add a path to the image to the prompt on Linux.

Note: Llama 3.2 Vision 11B requires least 8GB of VRAM, and the 90B model requires at least 64 GB of VRAM.

Examples

Handwriting

handwriting example

Optical Character Recognition (OCR)

OCR example

Charts & tables

charts and tables example

Image Q&A

image Q&A example

Usage

First, pull the model:

ollama pull llama3.2-vision

Python Library

To use Llama 3.2 Vision with the Ollama Python library:

import ollama

response = ollama.chat(
    model='llama3.2-vision',
    messages=[{
        'role': 'user',
        'content': 'What is in this image?',
        'images': ['image.jpg']
    }]
)

print(response)

JavaScript Library

To use Llama 3.2 Vision with the Ollama JavaScript library:

import ollama from 'ollama'

const response = await ollama.chat({
  model: 'llama3.2-vision',
  messages: [{
    role: 'user',
    content: 'What is in this image?',
    images: ['image.jpg']
  }]
})

console.log(response)

cURL

curl http://localhost:11434/api/chat -d '{
  "model": "llama3.2-vision",
  "messages": [
    {
      "role": "user",
      "content": "what is in this image?",
      "images": ["<base64-encoded image data>"]
    }
  ]
}'

Ollama Vision logo

來源:Ollama:Blog · ollama.com