Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

microsoft
/
Florence-2-large

Image-Text-to-Text
Transformers
PyTorch
Safetensors
florence2
vision
custom_code
Model card Files Files and versions
xet
Community
119

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)
    # Load model directly
    from transformers import AutoProcessor, AutoModelForImageTextToText
    
    processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
    model = AutoModelForImageTextToText.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • 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=<secret>" \
        --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
Florence-2-large
1.56 GB
Ctrl+K
Ctrl+K
  • 9 contributors
History: 18 commits
D4ve-R's picture
D4ve-R
Fix: Importing from timm.models.layers is deprecated, now importing via timm.layers
b9c02ad verified over 1 year ago
  • .gitattributes
    1.56 kB
    add_model (#1) almost 2 years ago
  • CODE_OF_CONDUCT.md
    444 Bytes
    add_model (#1) almost 2 years ago
  • LICENSE
    1.14 kB
    add_model (#1) almost 2 years ago
  • README.md
    16.3 kB
    initial tuned 4k context length model (#84) over 1 year ago
  • SECURITY.md
    2.66 kB
    add_model (#1) almost 2 years ago
  • SUPPORT.md
    1.24 kB
    add_model (#1) almost 2 years ago
  • config.json
    2.45 kB
    initial tuned 4k context length model (#84) over 1 year ago
  • configuration_florence2.py
    15.1 kB
    add_model (#1) almost 2 years ago
  • generation_config.json
    51 Bytes
    add_model (#1) almost 2 years ago
  • modeling_florence2.py
    127 kB
    Fix: Importing from timm.models.layers is deprecated, now importing via timm.layers over 1 year ago
  • preprocessor_config.json
    806 Bytes
    add_model (#1) almost 2 years ago
  • processing_florence2.py
    48.7 kB
    add_confidence_score (#56) over 1 year ago
  • pytorch_model.bin
    1.56 GB
    xet
    initial tuned 4k context length model (#84) over 1 year ago
  • sample_inference.ipynb
    5.71 MB
    update_model_init_fp16 (#53) almost 2 years ago
  • tokenizer.json
    1.36 MB
    add_model (#1) almost 2 years ago
  • tokenizer_config.json
    34 Bytes
    add_model (#1) almost 2 years ago
  • vocab.json
    1.1 MB
    add_model (#1) almost 2 years ago