Instructions to use microsoft/Florence-2-base-ft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Florence-2-base-ft 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-ft", trust_remote_code=True)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True) model = AutoModelForImageTextToText.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use microsoft/Florence-2-base-ft 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-ft" # 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-ft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/Florence-2-base-ft
- SGLang
How to use microsoft/Florence-2-base-ft 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-ft" \ --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-ft", "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-ft" \ --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-ft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/Florence-2-base-ft with Docker Model Runner:
docker model run hf.co/microsoft/Florence-2-base-ft
Update README.md
#31 opened 8 months ago
by
MHRDYN7
Added the `GenerationMixin`
#30 opened 11 months ago
by
iamdanialkamali
Update modeling_florence2.py
#24 opened about 1 year ago
by
ad-astra-video
Which one should I use, Florence-2-base-ft and Florence-2-base?
๐ 1
4
#23 opened over 1 year ago
by
CrimisionLFIre
Fix invalid escape sequences
#22 opened over 1 year ago
by
jkawamoto
How to get decoder final hidden state?
1
#21 opened almost 2 years ago
by
ZappY-AI
Add get_output_embeddings
#18 opened almost 2 years ago
by
xray1111
Take out caption restriction for personal use
#17 opened almost 2 years ago
by
Nano1337
unable to load the model, flash-attn problem
๐ฅ 6
1
#15 opened almost 2 years ago
by
Mustafa21
Unable to load fine tuned model from local directory
๐๐ 3
4
#14 opened almost 2 years ago
by
martinjolif
Finetuning Token Length Limit
๐ 1
1
#12 opened almost 2 years ago
by
kevinjeswani
Swift now supports inference, training, and deployment of the Florence models.
#11 opened almost 2 years ago
by
hu5enpai
Efficient inference
#10 opened almost 2 years ago
by
cuongnguyenxuan
Running in CPU
2
#9 opened almost 2 years ago
by
hedrergudene
Running Florence on M1 Mac
#8 opened almost 2 years ago
by
DavidJenkins
Amazing model and very promissing
#5 opened almost 2 years ago
by
paulorodriguesjr
Trust remote code requirement - why?
3
#4 opened almost 2 years ago
by
k8si