AI SeedbankHelp preserve open and free AI for humanity's future

← All models

microsoft_Florence-2-base

microsoft · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


license: mit license_link: https://huggingface.co/microsoft/Florence-2-base/resolve/main/LICENSE pipeline_tag: image-text-to-text tags:

  • vision

Florence-2: Advancing a Unified Representation for a Variety of Vision Tasks

Model Summary

This Hub repository contains a HuggingFace's transformers implementation of Florence-2 model from Microsoft.

Florence-2 is an advanced vision foundation model that uses a prompt-based approach to handle a wide range of vision and vision-language tasks. Florence-2 can interpret simple text prompts to perform tasks like captioning, object detection, and segmentation. It leverages our FLD-5B dataset, containing 5.4 billion annotations across 126 million images, to master multi-task learning. The model's sequence-to-sequence architecture enables it to excel in both zero-shot and fine-tuned settings, proving to be a competitive vision foundation model.

Resources and Technical Documentation:

Model Model size Model Description
Florence-2-base [HF] 0.23B Pretrained model with FLD-5B
Florence-2-large [HF] 0.77B Pretrained model with FLD-5B
Florence-2-base-ft [HF] 0.23B Finetuned model on a colletion of downstream tasks
Florence-2-large-ft [HF] 0.77B Finetuned model on a colletion of downstream tasks

How to Get Started with the Model

Use the code below to get started with the model. All models are trained with float16.

import requests

from PIL import Image
from transformers import AutoProcessor, AutoModelForCausalLM 

device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32

model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-base", torch_dtype=torch_dtype, trust_remote_code=True).to(device)
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base", trust_remote_code=True)

prompt = "<OD>"

url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
image = Image.open(requests.get(url, stream=True).raw)

inputs = processor(text=prompt, images=image, return_tensors="pt").to(device, torch_dtype)

generated_ids = model.generate(
    input_ids=inputs["input_ids"],
    pixel_values=inputs["pixel_values"],
    max_new_tokens=1024,
    do_sample=False,
    num_beams=3,
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]

parsed_answer = processor.post_process_generation(generated_text, task="<OD>", image_size=(image.width, image.height))

print(parsed_answer)

Tasks

This model is capable of performing different tasks through changing the prompts.

First, let's define a function to run a prompt.

Click to expand

import requests

from PIL import Image
from transformers import AutoProcessor, AutoModelForCausalLM 

device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32

model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-base", torch_dtype=torch_dtype, trust_remote_code=True).to(device)
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base", trust_remote_code=True)

url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
image = Image.open(requests.get(url, stream=True).raw)

def run_example(task_prompt, text_input=None):
    if text_input is None:
        prompt = task_prompt
    else:
        prompt = task_prompt + text_input
    inputs = processor(text=prompt, images=image, return_tensors="pt").to(device, torch_dtype)
    generated_ids = model.generate(
      input_ids=inputs["input_ids"],
      pixel_values=inputs["pixel_values"],
      max_new_tokens=1024,
      num_beams=3
    )
    generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]

    parsed_answer = processor.post_process_generation(generated_text, task=task_prompt, image_size=(image.width, image.height))

    print(parsed_answer)

Here are the tasks Florence-2 could perform:

Click to expand

Caption

prompt = "<CAPTION>"
run_example(prompt)

Detailed Caption

prompt = "<DETAILED_CAPTION>"
run_example(prompt)

More Detailed Caption

prompt = "<MORE_DETAILED_CAPTION>"
run_example(prompt)

Caption to Phrase Grounding

caption to phrase grounding task requires additional text input, i.e. caption.

Caption to phrase grounding results format: {'<CAPTION_TO_PHRASE_GROUNDING>': {'bboxes': [[x1, y1, x2, y2], ...], 'labels': ['', '', ...]}}

task_prompt = "<CAPTION_TO_PHRASE_GROUNDING>"
results = run_example(task_prompt, text_input="A green car parked in front of a yellow building.")

Object Detection

OD results format: {'<OD>': {'bboxes': [[x1, y1, x2, y2], ...], 'labels': ['label1', 'label2', ...]} }

prompt = "<OD>"
run_example(prompt)

Dense Region Caption

Dense region caption results format: {'<DENSE_REGION_CAPTION>' : {'bboxes': [[x1, y1, x2, y2], ...], 'labels': ['label1', 'label2', ...]} }

prompt = "<DENSE_REGION_CAPTION>"
run_example(prompt)

Region proposal

Dense region caption results format: {'<REGION_PROPOSAL>': {'bboxes': [[x1, y1, x2, y2], ...], 'labels': ['', '', ...]}}

prompt = "<REGION_PROPOSAL>"
run_example(prompt)

OCR

prompt = "<OCR>"
run_example(prompt)

OCR with Region

OCR with region output format: {'<OCR_WITH_REGION>': {'quad_boxes': [[x1, y1, x2, y2, x3, y3, x4, y4], ...], 'labels': ['text1', ...]}}

prompt = "<OCR_WITH_REGION>"
run_example(prompt)

for More detailed examples, please refer to notebook

Benchmarks

Florence-2 Zero-shot performance

The following table presents the zero-shot performance of generalist vision foundation models on image captioning and object detection evaluation tasks. These models have not been exposed to the training data of the evaluation tasks during their training phase.

Method #params COCO Cap. test CIDEr NoCaps val CIDEr TextCaps val CIDEr COCO Det. val2017 mAP
Flamingo 80B 84.3 - - -
Florence-2-base 0.23B 133.0 118.7 70.1 34.7
Florence-2-large 0.77B 135.6 120.8 72.8 37.5

The following table continues the comparison with performance on other vision-language evaluation tasks.

Method Flickr30k test R@1 Refcoco val Accuracy Refcoco test-A Accuracy Refcoco test-B Accuracy Refcoco+ val Accuracy Refcoco+ test-A Accuracy Refcoco+ test-B Accuracy Refcocog val Accuracy Refcocog test Accuracy Refcoco RES val mIoU
Kosmos-2 78.7 52.3 57.4 47.3 45.5 50.7 42.2 60.6 61.7 -
Florence-2-base 83.6 53.9 58.4 49.7 51.5 56.4 47.9 66.3 65.1 34.6
Florence-2-large 84.4 56.3 61.6 51.4 53.6 57.9 49.9 68.0 67.0 35.8

Florence-2 finetuned performance

We finetune Florence-2 models with a collection of downstream tasks, resulting two generalist models Florence-2-base-ft and Florence-2-large-ft that can conduct a wide range of downstream tasks.

The table below compares the performance of specialist and generalist models on various captioning and Visual Question Answering (VQA) tasks. Specialist models are fine-tuned specifically for each task, whereas generalist models are fine-tuned in a task-agnostic manner across all tasks. The symbol "▲" indicates the usage of external OCR as input.

Method # Params COCO Caption Karpathy test CIDEr NoCaps val CIDEr TextCaps val CIDEr VQAv2 test-dev Acc TextVQA test-dev Acc VizWiz VQA test-dev Acc
Specialist Models
CoCa 2.1B 143.6 122.4 - 82.3 - -
BLIP-2 7.8B 144.5 121.6 - 82.2 - -
GIT2 5.1B 145.0 126.9 148.6 81.7 67.3 71.0
Flamingo 80B 138.1 - - 82.0 54.1 65.7
PaLI 17B 149.1 127.0 160.0▲ 84.3 58.8 / 73.1▲ 71.6 / 74.4▲
PaLI-X 55B 149.2 126.3 147.0 / 163.7▲ 86.0 71.4 / 80.8▲ 70.9 / 74.6▲
Generalist Models
Unified-IO 2.9B - 100.0 - 77.9 - 57.4
Florence-2-base-ft 0.23B 140.0 116.7 143.9 79.7 63.6 63.6
Florence-2-large-ft 0.77B 143.3 124.9 151.1 81.7 73.5 72.6
Method # Params COCO Det. val2017 mAP Flickr30k test R@1 RefCOCO val Accuracy RefCOCO test-A Accuracy RefCOCO test-B Accuracy RefCOCO+ val Accuracy RefCOCO+ test-A Accuracy RefCOCO+ test-B Accuracy RefCOCOg val Accuracy RefCOCOg test Accuracy RefCOCO RES val mIoU
Specialist Models
SeqTR - - - 83.7 86.5 81.2 71.5 76.3 64.9 74.9 74.2 -
PolyFormer - - - 90.4 92.9 87.2 85.0 89.8 78.0 85.8 85.9 76.9
UNINEXT 0.74B 60.6 - 92.6 94.3 91.5 85.2 89.6 79.8 88.7 89.4 -
Ferret 13B - - 89.5 92.4 84.4 82.8 88.1 75.2 85.8 86.3 -
Generalist Models
UniTAB - - - 88.6 91.1 83.8 81.0 85.4 71.6 84.6 84.7 -
Florence-2-base-ft 0.23B 41.4 84.0 92.6 94.8 91.5 86.8 91.7 82.2 89.8 82.2 78.0
Florence-2-large-ft 0.77B 43.4 85.2 93.4 95.3 92.0 88.3 92.9 83.6 91.2 91.7 80.5

BibTex and citation info

@article{xiao2023florence,
  title={Florence-2: Advancing a unified representation for a variety of vision tasks},
  author={Xiao, Bin and Wu, Haiping and Xu, Weijian and Dai, Xiyang and Hu, Houdong and Lu, Yumao and Zeng, Michael and Liu, Ce and Yuan, Lu},
  journal={arXiv preprint arXiv:2311.06242},
  year={2023}
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:44634a7e9f3b39cd0e40f1b82c623b45807c4213&dn=microsoft_Florence-2-base

Open magnet in torrent client · infohash 44634a7e9f3b39cd0e40f1b82c623b45807c4213

Files & hashes

PathSizesha1sha256
CODE_OF_CONDUCT.md444 B (444 B)f9ba8cf65f3e3104dd061c178066ec8247811f339daeae709a0bd71bcfd1c96dc5822ecec5210327eff929da64b0ae7f8faf1444
LICENSE1.1 KB (1,141 B)9e841e7a26e4eb057b24511e7b92d42b257a80e5c2cfccb812fe482101a8f04597dfc5a9991a6b2748266c47ac91b6a5aae15383
README.md14.5 KB (14,805 B)e87f055c30f3dab5479fc3de9231a044ea33426de49de5527bd39688745ce20388bf3f31fdb891abc0e6950a3f64630114769d17
SECURITY.md2.6 KB (2,656 B)b3c89efc852e22f71eabf5dfbc6ac62493425eb67b6976eec43edfa68b79a459dd089c56b7a395916dbf1a01bd11e6d86e12128f
SUPPORT.md1.2 KB (1,244 B)291d4d43733f4c15a81ff598ec1c99fd6c18f64c149773411caf2c59cb1a6bfb2c6f070d1d054f1f018e7a80be319a8c384eeaf5
config.json2.4 KB (2,430 B)74a4482afd52515c89ae8d7d388a537a16f5d350c666d0fe0172d46e115e8fba6cd93cd83714575b33a73005cab8d24ce2a3aa8f
configuration_florence2.py14.8 KB (15,119 B)b8869617ef8dfd0f04d421cf59b83ca662c363adde2e45a975b3582de05d2f4d963a3e9f9a3d20dccf78d28e0052932a0be93bdf
model.safetensors441.8 MB (463,221,266 B)06f6924f460bb042eb8c03332e7fbb2c36a5eae003075d2d2d2bbd3e180b9ba0afae4aa8563226e2d32911656966e05b2f2ee060
modeling_florence2.py124.5 KB (127,455 B)90208540137fcf518aa92186e58ac964213c64205162bf465e61b6e29cc113a467630ec3cb56ed8e4d46eb6207157f10fb9b8a24
preprocessor_config.json806 B (806 B)85cd7be3568df661ad536b6ab20d59b08ba079ae2f5921bbc53c7cc04251e1027b45b1cec726276be6db23d1bb40641bfbe2cf29
processing_florence2.py47.5 KB (48,676 B)3cd9815895c8c2b355f1e07ff983186f1e05c9e9f146023a507c009f425a49ee39aa037f4f25c64e14336e3e4f3f1d7377a68e98
pytorch_model.bin442.9 MB (464,421,827 B)33d6520053ebf6fda4da49cbb676970c544f5307b480ac374593b0dcb18ffa63b23213734e04cd43eab0d620d23e39708d4a4a7e
tokenizer.json1.3 MB (1,355,863 B)ad0bcbeb288f0d1373d88e0762e66357f55b8311847bbeab6174d66a88898f729d52fa8d355fafe1bea101cf960dd404581df70e
tokenizer_config.json34 B (34 B)44784bc58d4cb18d3549ad71e062efcf032d9ef579ffcf43af8ebda99d165f61d243180da2e2639952e41e71e11611c18770489c
vocab.json1.0 MB (1,099,884 B)94a2f4fd50e976bda926c700291522ea1a79323f394fdc63c71aabe0a9b97117f5d62fb5fcc4d59b2b3ea929a3929e6a53217b3c

Cite this release

Canonical URL
https://aiseedbank.org/models/microsoft_Florence-2-base/
Slug
microsoft_Florence-2-base
Infohash
44634a7e9f3b39cd0e40f1b82c623b45807c4213
License
mit
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: microsoft_Florence-2-base.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorymicrosoft/Florence-2-base
Revision (pinned)5ca5edf5bd017b9919c05d08aebef5e4c7ac3bac
Fetched at2026-09-04T02:08:36Z
License at fetchmit
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T02:08:48Z

mit887.2 MB (930,313,650 bytes)transformerspytorchsafetensorsflorence2image-text-to-textvisioncustom_codeendpoints_compatiblepaper: 2311.06242