Instructions to use microsoft/Florence-2-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Florence-2-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="microsoft/Florence-2-large", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/Florence-2-large with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/Florence-2-large" # 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-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/Florence-2-large
- SGLang
How to use microsoft/Florence-2-large 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-large" \ --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-large", "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=" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "microsoft/Florence-2-large" \ --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-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/Florence-2-large with Docker Model Runner:
docker model run hf.co/microsoft/Florence-2-large
How to get last hidden states?
βπ 5
#54 opened about 2 years ago
by
ZappY-AI
embeddings
πβ 6
3
#51 opened about 2 years ago
by
ajpuylea
Batch: inefficient memory
1
#50 opened about 2 years ago
by
SinanAkkoyun
Simple web server
π₯ 2
#49 opened about 2 years ago
by
Navot
What is the impact of reducing the size of the input image of the Davit image part
3
#48 opened about 2 years ago
by
shifeiwen
Update modeling_florence2.py
#47 opened about 2 years ago
by
xray1111
How to retrain the model with large max length?
βπ₯ 3
7
#46 opened about 2 years ago
by
lucasjin
prompt engineering in Florence model
πβ 10
#45 opened over 2 years ago
by
vishalkatheriya
Assert config.vision_config.model_type == 'davit', 'only DaViT is supported for now'
4
#44 opened over 2 years ago
by
Glider95
LayerNorm missing in Statedict of DatViT L
1
#43 opened over 2 years ago
by
Matagi
Running Inference on Video
2
#41 opened over 2 years ago
by
Haneesh-007
How to increase max token output ?
β 1
2
#40 opened over 2 years ago
by
Glider95
TypeError: Object of type Florence2LanguageConfig is not JSON serializable
4
#39 opened over 2 years ago
by
JiabaoWangTS
Scores with OCR
βπ₯ 5
#38 opened over 2 years ago
by
matteocacciola
Regarding Confidence Score
ππ 33
3
#36 opened over 2 years ago
by
Haneesh-007
ValueError: Could not load model microsoft/Florence-2-large with any of the following classes.
β 2
1
#35 opened over 2 years ago
by
Dhruv
hey, im new to huggingface,
3
#34 opened over 2 years ago
by
coolkid891273
Multimodal Tokenizer Question
#33 opened over 2 years ago
by
Nano1337
Fine-tuning for multiple tasks strategy
ππ 6
3
#32 opened over 2 years ago
by
gennarino80
Swift now supports inference, training, and deployment of the Florence models.
β€οΈ 1
#31 opened over 2 years ago
by
hu5enpai
Question about continue pretrain on Florence large base model with more data
2
#30 opened over 2 years ago
by
lucasjin
Update README.md
#29 opened over 2 years ago
by
huggingface369
TypeError: Object of type Florence2LanguageConfig is not JSON serializable
7
#28 opened over 2 years ago
by
ShravanP
unexpected keyword argument 'loss' - Fine tuning for CAPTIONS
1
#27 opened over 2 years ago
by
ksooklall
Which image format is preferred? Error during inference
4
#26 opened over 2 years ago
by
skye0402
Not passing attention_mask in model.generate
3
#25 opened over 2 years ago
by
hcy511
Release Dataset
ππ€ 79
7
#24 opened over 2 years ago
by
SinanAkkoyun
CPU inference
2
#22 opened over 2 years ago
by
KeilahElla
Please add to llama.cpp and ollama
ππ€ 18
5
#21 opened over 2 years ago
by
KeilahElla
Few shot prompting for object detection
π€π 7
1
#20 opened over 2 years ago
by
aswanthkrshna
How to Finetune?
ππ 18
5
#19 opened over 2 years ago
by
vody-am
Segment multiple same objects in the Image
βπ 9
3
#18 opened over 2 years ago
by
moaabid
load model from local files, disabling flash_attn, OSError: We couldn't connect to 'https://huggingface.co'
#15 opened over 2 years ago
by
wa99
Safetensors weights?
#14 opened over 2 years ago
by
nizar-naitlho
Wrong bounding boxes
ππ₯ 3
5
#13 opened over 2 years ago
by
aleablu
dynamic module utils error -- requires flash_attn
1
#11 opened over 2 years ago
by
sidward
Segmentation Issue with identifying multiples, or contiguous objects
4
#10 opened over 2 years ago
by
EnragedAntelope
What does the output coordinate format?
6
#9 opened over 2 years ago
by
lucasjin
Running on macOS with Metal
1
#7 opened over 2 years ago
by
christianweyer
How does this version compare with Paligemma
π 4
2
#6 opened over 2 years ago
by
ojeokelias