Skip to content

Commit 2950e68

Browse files
authored
Create deploy-stability-models.md
1 parent 7e35a8f commit 2950e68

File tree

1 file changed

+167
-0
lines changed

1 file changed

+167
-0
lines changed
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: How to deploy Stability AI family of models with Azure Machine Learning studio
3+
titleSuffix: Azure Machine Learning studio
4+
description: How to deploy Stability AI family of models with Azure Machine Learning studio
5+
manager: scottpolly
6+
ms.service: azure-machine-learning
7+
ms.topic: how-to
8+
ms.date: 02/12/2025
9+
ms.author: timanghn
10+
author: tinaem
11+
ms.reviewer: ssalgado
12+
reviewer: ssalgadodev
13+
ms.custom: references_regions
14+
---
15+
16+
# How to deploy Stability AI family of models with Azure Machine Learning studio
17+
18+
[!INCLUDE [machine-learning-preview-generic-disclaimer](includes/machine-learning-preview-generic-disclaimer.md)]
19+
20+
In this article, you learn how to useAzure Machine Learning studio to deploy Stability AI collection of models as a serverless API with pay-as-you-go billing.
21+
22+
The Stability AI collection of models include Stable Image Core, Stable Image Ultra and Stable Diffusion 3.5 Large.
23+
24+
### Stable Diffusion 3.5 Large
25+
At 8.1 billion parameters, with superior quality and prompt adherence, this base model is the most powerful in the Stable Diffusion family and is ideal for professional use cases at 1 megapixel resolution.
26+
27+
Stable Diffusion 3.5 large supports text and image prompt inputs for image generations.
28+
29+
### Stable Image Core
30+
Leveraging an enhanced version of SDXL, Stable Image Core, delivers exceptional speed and efficiency while maintaining the high-quality output synonymous with Stable Diffusion models.
31+
32+
Stable Image Core supports text prompt inputs only for image generations.
33+
34+
### Stable Image Ultra
35+
Powered by the advanced capabilities of Stable Diffusion 3.5 Large, Stable Image Ultra sets a new standard in photorealism. Stable Image Ultra is ideal for product imagery in marketing and advertising. It also excels in typography, dynamic lighting, and vibrant color rendering.
36+
37+
Stable Image Ultra supports text prompt inputs only for image generations.
38+
39+
[!INCLUDE [models-preview](../ai-studio/includes/models-preview.md)]
40+
41+
42+
## Deploy a Stability AI model as a serverless API
43+
44+
Stability AI models in the model catalog can be deployed as a serverless API with pay-as-you-go billing, providing a way to consume them as an API without hosting them on your subscription, while keeping the enterprise security and compliance organizations need. This deployment option doesn't require quota from your subscription.
45+
46+
47+
### Prerequisites
48+
49+
- An Azure subscription with a valid payment method. Free or trial Azure subscriptions won't work. If you don't have an Azure subscription, create a [paid Azure account](https://azure.microsoft.com/pricing/purchase-options/pay-as-you-go) to begin.
50+
- An Azure Machine Learning workspace and a compute instance. If you don't have these, use the steps in the [Quickstart: Create workspace resources](quickstart-create-resources.md) article to create them. The serverless API model deployment offering for Stability AI is only available with workspaces created in these regions:
51+
52+
* East US
53+
* East US 2
54+
* North Central US
55+
* South Central US
56+
* West US
57+
* West US 3
58+
59+
For a list of regions that are available for each of the models supporting serverless API endpoint deployments, see [Region availability for models in serverless API endpoints](concept-endpoint-serverless-availability.md).
60+
61+
- Azure role-based access controls (Azure RBAC) are used to grant access to operations in Azure Machine Learning. To perform the steps in this article, your user account must be assigned the __owner__ or __contributor__ role for the Azure subscription. Alternatively, your account can be assigned a custom role that has the following permissions:
62+
63+
- On the Azure subscription—to subscribe the workspace to the Azure Marketplace offering, once for each workspace, per offering:
64+
- `Microsoft.MarketplaceOrdering/agreements/offers/plans/read`
65+
- `Microsoft.MarketplaceOrdering/agreements/offers/plans/sign/action`
66+
- `Microsoft.MarketplaceOrdering/offerTypes/publishers/offers/plans/agreements/read`
67+
- `Microsoft.Marketplace/offerTypes/publishers/offers/plans/agreements/read`
68+
- `Microsoft.SaaS/register/action`
69+
70+
- On the resource group—to create and use the SaaS resource:
71+
- `Microsoft.SaaS/resources/read`
72+
- `Microsoft.SaaS/resources/write`
73+
74+
- On the workspace—to deploy endpoints (the Azure Machine Learning data scientist role contains these permissions already):
75+
- `Microsoft.MachineLearningServices/workspaces/marketplaceModelSubscriptions/*`
76+
- `Microsoft.MachineLearningServices/workspaces/serverlessEndpoints/*`
77+
78+
For more information on permissions, see [Manage access to an Azure Machine Learning workspace](how-to-assign-roles.md).
79+
80+
81+
82+
### Create a new deployment
83+
84+
These steps demonstrate the deployment of a Stability AI Model. To create a deployment:
85+
86+
1. Go to [Azure Machine Learning studio](https://ml.azure.com/home).
87+
1. Select the workspace in which you want to deploy your models. To use the pay-as-you-go model deployment offering, your workspace must belong to one of the available regions listed in the prerequisites of this article.
88+
1. Choose `Stable Diffusion 3.5 Large` to deploy from the [model catalog](https://ml.azure.com/model/catalog).
89+
90+
Alternatively, you can initiate deployment by going to your workspace and selecting **Endpoints** > **Serverless endpoints** > **Create**.
91+
92+
1. On the **Details** page for `Stable Diffusion 3.5 Large`, select **Deploy** and then select **Serverless API with Azure AI Content Safety**.
93+
94+
1. On the deployment wizard, select the link to **Azure Marketplace Terms** to learn more about the terms of use. You can also select the **Marketplace offer details** tab to learn about pricing for the selected model.
95+
1. If this is your first time deploying the model in the workspace, you have to subscribe your workspace for the particular offering (for example, `Stable Diffusion 3.5 Large`) from Azure Marketplace. This step requires that your account has the Azure subscription permissions and resource group permissions listed in the prerequisites. Each workspace has its own subscription to the particular Azure Marketplace offering, which allows you to control and monitor spending. Select **Subscribe and Deploy**.
96+
97+
> [!NOTE]
98+
> Subscribing a workspace to a particular Azure Marketplace offering (in this case, Stability AI) requires that your account has **Contributor** or **Owner** access at the subscription level where the project is created. Alternatively, your user account can be assigned a custom role that has the Azure subscription permissions and resource group permissions listed in the [prerequisites](#prerequisites).
99+
100+
1. Once you sign up the workspace for the particular Azure Marketplace offering, subsequent deployments of the _same_ offering in the _same_ workspace don't require subscribing again. Therefore, you don't need to have the subscription-level permissions for subsequent deployments. If this scenario applies to you, select **Continue to deploy**.
101+
102+
1. Give the deployment a name. This name becomes part of the deployment API URL. This URL must be unique in each Azure region.
103+
104+
1. Select **Deploy**. Wait until the deployment is finished and you're redirected to the serverless endpoints page.
105+
1. Select the endpoint to open its Details page.
106+
1. Select the **Test** tab to start interacting with the model.
107+
1. You can also take note of the **Target** URL and the **Secret Key** to call the deployment and generate completions.
108+
1. You can always find the endpoint's details, URL, and access keys by navigating to **Workspace** > **Endpoints** > **Serverless endpoints**.
109+
110+
### Consume Stability AI models as a serverless API
111+
112+
1. In the **workspace**, select **Endpoints** > **Serverless endpoints**.
113+
1. Find and select the `Stable Diffusion 3.5 Large` deployment you created.
114+
1. Copy the **Target** URL and the **Key** token values.
115+
1. Make an API request based on the type of model you deployed. For an example, see the [reference section](#reference-for-stability-ai-models-deployed-as-a-serverless-api)
116+
117+
## Reference for Stability AI models deployed as a serverless API
118+
119+
Stability AI models on Models as a Service implement the Azure AI Model Inference API on the route `/image/generations`.
120+
121+
#### Request example
122+
123+
```
124+
{
125+
"prompt": "A photo of a cat",
126+
"negative_prompt": "A photo of a dog",
127+
"image_prompt": {
128+
"image": "puqkvvlvgcjyzughesnkena",
129+
"strength": 1
130+
},
131+
"size": "1024x1024",
132+
"output_format": "png",
133+
"seed": 26
134+
}
135+
```
136+
137+
#### Response
138+
139+
```
140+
{
141+
"image": "iVBORw0KGgoAAAANSUhEUgAABgA...",
142+
"created": 1739161682
143+
}
144+
```
145+
146+
## Cost and quotas
147+
148+
### Cost and quota considerations for Stability AI models deployed as a serverless API
149+
150+
The Stability AI models are deployed as a serverless API and is offered by Stability AI through Azure Marketplace and integrated with Azure Machine Learning studio for use. You can find Azure Marketplace pricing when deploying or fine-tuning models.
151+
152+
Each time a workspace subscribes to a given model offering from Azure Marketplace, a new resource is created to track the costs associated with its consumption. The same resource is used to track costs associated with inference and fine-tuning; however, multiple meters are available to track each scenario independently.
153+
154+
For more information on how to track costs, see [Monitor costs for models offered through the Azure Marketplace](/azure/ai-studio/how-to/costs-plan-manage#monitor-costs-for-models-offered-through-the-azure-marketplace).
155+
156+
Quota is managed per deployment. Each deployment has a rate limit of 200,000 tokens per minute and 1,000 API requests per minute. However, we currently limit one deployment per model per project. Contact Microsoft Azure Support if the current rate limits aren't sufficient for your scenarios.
157+
158+
## Content filtering
159+
160+
Models deployed as a serverless API are protected by Azure AI content safety. When deployed to managed compute, you can opt out of this capability. With Azure AI content safety enabled, both the prompt and completion pass through an ensemble of classification models aimed at detecting and preventing the output of harmful content. The content filtering (preview) system detects and takes action on specific categories of potentially harmful content in both input prompts and output completions. Learn more about [Azure AI Content Safety](/azure/ai-services/content-safety/overview).
161+
162+
## Related content
163+
164+
- [Model Catalog and Collections](concept-model-catalog.md)
165+
- [Deploy and score a machine learning model by using an online endpoint](how-to-deploy-online-endpoints.md)
166+
- [Plan and manage costs for Azure AI Foundry](/azure/ai-studio/how-to/costs-plan-manage)
167+
- [Region availability for models in serverless API endpoints](concept-endpoint-serverless-availability.md)

0 commit comments

Comments
 (0)