Thirty-one open-weight models, by modality

Vision · 1 of 6

Florence-2 base

Hugging Face — microsoft/Florence-2-base

0.46 GB of weights on Hugging Face

A tiny vision model with named tasks. You give it a task tag — caption, detect, read, segment — and it does that one job.

Overview

Microsoft’s 0.23B-parameter vision foundation model. It is not a chatbot that sees images. It runs one task at a time, chosen with a prompt tag: <OD> for detection, <OCR> for reading, <CAPTION> for describing, <SEGMENT> for regions. MIT licensed, so the weights are yours.

Params
0.23B
License
MIT
Input
image + task prompt
Output
text, boxes, masks
Hardware
runs on CPU; a GPU makes it quick
Download
0.46 GB

What it is good at

  • Captioning a photo
  • Detecting objects as boxes or points
  • Reading text from an image
  • Segmenting regions
  • Labeling a dataset before you train

Not good at: open-ended conversation about an image, long documents, or fine world knowledge. It is a captioner and a labeler, not an analyst.

Memory

PrecisionRuleSize
fp162 bytes per param~463 MB
int81 byte per param~232 MB
int40.5 bytes per param~116 MB

Memory rule from the source: GB = params × bytes per param.

Quickstart

pip install transformers torch

from transformers import AutoModelForCausalLM, AutoProcessor

model = AutoModelForCausalLM.from_pretrained(
    "microsoft/Florence-2-base", trust_remote_code=True, dtype="auto"
)
processor = AutoProcessor.from_pretrained(
    "microsoft/Florence-2-base", trust_remote_code=True
)

image = Image.open("photo.jpg")
inputs = processor(image, text="<CAPTION>", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=64)
print(processor.decode(out[0], skip_special_tokens=True))