- Documentation
Volcano Engine Function as a Service
Best Practices
AI Application
Mounting Stable Diffusion Custom Models through NAS
AI Application
Mounting Stable Diffusion Custom Models through NAS
Mounting Stable Diffusion Custom Models through NAS
This article introduces to you how to upload custom models used by Stable Diffusion to the NAS directory mounted by functions for storage, and load these models in real time when starting the WebUI.
Scenario introduction
Users may need to use custom models or WebUI plugins when using Stable Diffusion. Since these models are usually large, storing them in the NAS mount directory is a common choice to facilitate quick access.
Prerequisites
- For Virtual Private Cloud (VPC)
- Permission for using Volcano Engine Virtual Private Cloud has been obtained.
- Permission for using Volcano Engine NAS has been obtained.
- A NAS file system has been created in the region where the function is to be deployed. For details, see Creating file systems.
- Permission for using veFaaS has been obtained.
- AI painting Stable Diffusion application has been deployed.
Procedure
Step One: Configure NAS mount directory
- In the top navigation bar, select the target region.
- On the function list page, select the Stable Diffusion function deployed in the Prerequisites, then click to enter the Basic information page of the current function.
- In the VPC network area, click Edit icon to enable and configure the VPC network.
- Configure the VPC, subnet, and security groups to be bound to the function. The VPC configured in the function must be consistent with the VPC of the NAS mount point.
- In the storage configuration area, click Edit icon to enable and configure the NAS mount directory.
- NAS file system: Select the NAS file system in the same region.
- Mount point: Select the NAS mount point that matches the VPC of the function.
- Remote directory: Configure the directory of the remote NAS to be accessed. For example, /.
- Local directory: Configure the local directory of the function operation environment. The local directory and the remote directory are in a mapping relationship. This example is: /mnt/nas.
Step Two: Configure environment variables
Point the model that WebUI loads by default to the NAS mounted file path through configuring CLI_ARGS environment variable.
- On the Basic information page, click Edit icon next to the information configuration area.
- On the editing and configuration information panel, click + to add a new environment variable.
- value: This example uses --ckpt to specify the Stable Diffusion model file to load when WebUI starts. Assuming the custom model is stored on NAS at /models/Stable-diffusion/sd_xl_base_1.0_0.9vae.safetensors, the corresponding local directory in the function operation environment is /mnt/nas/models/Stable-diffusion/sd_xl_base_1.0_0.9vae.safetensors. Therefore, the value is --ckpt /mnt/nas/models/Stable-diffusion/sd_xl_base_1.0_0.9vae.safetensors.
Step Three: Release the function
Release the latest function configuration online.
- On the function details page, click Release in the upper right corner.
- The function revision is set to Latest. Fill in the revision description as needed.
- Click Confirm to start releasing the function.
- After the function is successfully released, access the Stable Diffusion WebUI through the public endpoint provided by the API Gateway Trigger.
Last updated: 2026.08.19 14:06:07