Florence-2 - Vision Foundation Model - Examples
Install dependencies Type the following command to install possible needed dependencies (especially if the inference is performed on the CPU)
%pip install einops flash_attn In Kaggle, transformers and torch are already installed. Otherwise you also need to install them on your local PC.
Import Libraries from transformers import AutoProcessor, AutoModelForCausalLM from PIL import Image import requests import copy import torch %matplotlib inline Import the model We can choose Florence-2-large or Florence-2-large-ft (fine-tuned).