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

  • Log In
  • Sign Up

microsoft
/
Florence-2-base-ft

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

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
Florence-2-base-ft
930 MB
Ctrl+K
Ctrl+K
  • 4 contributors
History: 11 commits
leoxiaobin's picture
leoxiaobin
Fix weight init, deprecation warnings, safetensors (#29)
f6c1a25 verified 9 months ago
  • .gitattributes
    1.56 kB
    init_model (#1) almost 2 years ago
  • CODE_OF_CONDUCT.md
    444 Bytes
    init_model (#1) almost 2 years ago
  • LICENSE
    1.14 kB
    init_model (#1) almost 2 years ago
  • README.md
    14.8 kB
    update_model_init_fp16 (#20) almost 2 years ago
  • SECURITY.md
    2.66 kB
    init_model (#1) almost 2 years ago
  • SUPPORT.md
    1.24 kB
    init_model (#1) almost 2 years ago
  • config.json
    2.43 kB
    update_model_init_fp16 (#20) almost 2 years ago
  • configuration_florence2.py
    15.1 kB
    init_model (#1) almost 2 years ago
  • model.safetensors
    463 MB
    xet
    Fix weight init, deprecation warnings, safetensors (#29) 9 months ago
  • modeling_florence2.py
    127 kB
    Fix weight init, deprecation warnings, safetensors (#29) 9 months ago
  • preprocessor_config.json
    806 Bytes
    init_model (#1) almost 2 years ago
  • processing_florence2.py
    46.4 kB
    update_ocr_postprocess (#19) almost 2 years ago
  • pytorch_model.bin

    Detected Pickle imports (3)

    • "torch.HalfStorage",
    • "collections.OrderedDict",
    • "torch._utils._rebuild_tensor_v2"

    What is a pickle import?

    464 MB
    xet
    init_model (#1) almost 2 years ago
  • tokenizer.json
    1.36 MB
    init_model (#1) almost 2 years ago
  • tokenizer_config.json
    34 Bytes
    init_model (#1) almost 2 years ago
  • vocab.json
    1.1 MB
    init_model (#1) almost 2 years ago