How to deploy Florence-2

Neil Thompson 20 Reputation points
2024-12-03T16:47:40.9966667+00:00

Microsoft recently binned the Computer Vision Background Removal Service, with the (rather brief) advice

This feature is now deprecated. On January 10, 2025, the Azure AI Image Analysis 4.0 Segment API and background removal service will be retired. All requests to this service will fail after this date. To maintain a smooth operation of your models, install the open-source Florence 2 model and use its Region to segmentation feature, which allows for a similar background removal operation.

But Azure Machine Learning studio does not list this model (as far as I can see) - which is really odd as it's a Microsoft model

I was under the impression from MS support that I could deploy the model to ML Studio or a VM.

How can I do this?

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,024 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Avinash Devarakonda 340 Reputation points Microsoft Vendor
    2024-12-06T03:24:23.88+00:00

    Hi Neil Thompson,

    To deploy the Florence-2 model, which is available on Hugging Face but not listed in Azure Machine Learning Studio, you can follow these generic steps:

    1. Find the Model: Access the Florence-2 model on Hugging Face. Download the files or use the model directly from the Hugging Face hub.
    2. Set Up Azure ML: Ensure you have an Azure Machine Learning workspace. Create one in the Azure portal if needed.
    3. Deploy the Model: Use Azure ML Studio or SDK to create a deployment. Configure deployment settings via the UI or CLI. For CLI, prepare a YAML file with model details and instance types.
    4. Test the Deployment: Use the provided REST endpoint to test the deployed model.

    Refer to below documentation for detailed steps on deploying Hugging Face models.

    https://learn.microsoft.com/en-us/azure/machine-learning/how-to-deploy-models-from-huggingface?view=azureml-api-2#deploy-huggingface-hub-models-using-studio

    Thank You.

    0 comments No comments

  2. Thomas YAMINI 0 Reputation points
    2024-12-10T03:53:27.13+00:00

    Hi Avinash Devarakonda,

    Could you please provide more explanations on where to store the model and what to put in the YAML file?

    If you have a Python script ready, that would be awesome. The link you provided only works with models available on Azure; Florence2 is not.
    Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.