Instructions to use microsoft/Florence-2-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Florence-2-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="microsoft/Florence-2-base", trust_remote_code=True)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base", trust_remote_code=True) model = AutoModelForImageTextToText.from_pretrained("microsoft/Florence-2-base", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use microsoft/Florence-2-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/Florence-2-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/Florence-2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/Florence-2-base
- SGLang
How to use microsoft/Florence-2-base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "microsoft/Florence-2-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/Florence-2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "microsoft/Florence-2-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/Florence-2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/Florence-2-base with Docker Model Runner:
docker model run hf.co/microsoft/Florence-2-base
Inquiry regarding performance alignment for Florence-2 on COCO dataset
#34 opened about 1 month ago
by
hongsik91
yymFlorence-2
#33 opened 4 months ago
by
yuyangmin
Upload 4 files
#32 opened 8 months ago
by
tk725
florence2 is broken above transformers 4.49
1
#30 opened 12 months ago
by
ctranslate2-4you
E:\ComfyUI-aki-v1.3\models\LLM
#29 opened about 1 year ago
by
wingman212
object detection output image dimensions
#28 opened about 1 year ago
by
Yosun
confidence score
2
#24 opened over 1 year ago
by
fcakyon
Loading error because of a recent PR
#23 opened over 1 year ago
by
StarCycle
fix example code
#21 opened over 1 year ago
by
Chan-Y
About Fine Tuning the Florence 2 model on naver-clova-ix/cord-v2 dataset.
3
#19 opened almost 2 years ago
by
Kaustubh-kapare94
Image size
#18 opened almost 2 years ago
by
welabbar
Add task_prefix_attention_mask argument to _merge_input_ids_with_image_features for better padding handling
#17 opened almost 2 years ago
by
pawlowskipawel
C# library for Florence-2
π₯π 2
3
#15 opened almost 2 years ago
by
theolivenbaum
How to save this model with torch.jit.save?
#14 opened almost 2 years ago
by
xiaopengaia
How to get last hidden states from the model?
π 2
#13 opened almost 2 years ago
by
ZappY-AI
Add get_output_embeddings method
ππ 1
#10 opened almost 2 years ago
by
xray1111
Will the FLD-5B Dataset be open-source?
ππ₯ 9
#9 opened almost 2 years ago
by
StarCycle
Swift now supports inference, training, and deployment of the Florence models.
#8 opened almost 2 years ago
by
hu5enpai
Florence in mac m1
1
#7 opened almost 2 years ago
by
Nuntea
Running this on cpu requires flash_attn ! but we cant install flash_attn on cpu
18
#4 opened almost 2 years ago
by
Meshwa