How to Easily Use Safetensors with Automatic1111 WebUI

In this fascinating article, we dive into the world of Safetensors and how they can revolutionize automatic differentiation. Safetensors, a concept derived from tensors, provide a powerful tool for efficiently and reliably computing gradients in machine learning algorithms. By understanding the core

1000+ Pre-built AI Apps for Any Use Case

How to Easily Use Safetensors with Automatic1111 WebUI

Start for free

Stable Diffusion is a powerful AI model that can generate high-quality images based on user inputs. Automatic1111 is a user-friendly web UI that allows you to easily interact with the model.

In this tutorial, we will explore how to use Automatic1111 Stable Diffusion Web UI, from installation and setup to image generation and troubleshooting. Whether you're a beginner or an experienced AI practitioner, this guide will help you master the art of Safetensors and unlock the power of Automatic Differentiation.

Article Keypoints

  • What is Automatic1111 Web UI?
  • How to Use Safetensor for Stable Diffusion
  • How to Covnert ckpt to safetensor for Stable Diffusion

What is Automatic1111 WebUI?

Automatic1111 is a web-based user interface developed for Stable Diffusion. It allows users to interact with the model, input parameters, and generate high-quality images without the need for extensive programming knowledge.

Download Automatica 1111 WebUI for Windows, Mac, Linux here.
Interested in using Stable Diffusion online?

Try out the Stable Diffusion Image Generator from Anakin AI 👇👇👇
How to Use Safetensor for Stable Diffusion
How to Use Safetensor for Stable Diffusion

How to Use Safetensor for Stable Diffusion

Using Safetensor with Stable Diffusion in the Automatic1111 WebUI involves several detailed steps to ensure smooth integration and functionality. This expanded guide covers each step in more depth:

Step 1. Download the safetensor file. Save it to:

Stable-Diffusion-Webui > models > Stable-diffusion

Step 2. Boot up Automatic1111 webui. Click on the refresh button to the right side of the "Stable Diffusion Checkpoint" box. Your safetensor file (most likely to be a stable diffusion model) would be appearing within the drop list on the left.

How to Enable Safetensors in Stable Diffusion

If you havn't enable safetensors for Stable Diffusion yet, you can enable Safetensors with Automatic1111, follow these steps:

  1. Open the file in your preferred text editor.
  2. Locate the enable_safety_constraints variable and set it to True.
  3. Save the file.
  4. Restart the Automatic1111 web UI server following the steps outlined in the "Running the Endpoint URL in a Browser" section.
  5. With Safetensors enabled, the generated images will adhere to safety guidelines, providing an ethical and responsible image generation experience.

Safetensor VS Checkpoints, What is the Difference?

How Does Safetensor Work?

  • Concept of Safetensor: Safetensors are a specialized format for storing and transmitting neural network weights and parameters. They are particularly designed for secure and efficient handling of large amounts of data, essential in machine learning models.
  • Serialization and Compression: The core functionality of Safetensors lies in their ability to serialize and often compress neural network data. This makes the data compact and portable, facilitating easy storage and transfer.
  • Deserialization: When deploying the model, these serialized tensors are converted back (deserialized) into their original tensor format.
  • Integration into Model Architecture: The deserialized weights are then seamlessly integrated into the model’s architecture, ready for use in applications.
  • On the other hand, Traditional Checkpoints: Checkpoints are snapshots of a model at a particular training stage. They store the model's state, including weights, parameters, and optimizer states, typically in a larger, uncompressed format.

Comparing ckpt and safetensors:

  • Checkpoints: Typically larger, storing comprehensive training data. Ideal for continuing training, experimentation, or fine-tuning.
  • Safetensors: More compact and portable, focusing on essential model weights. Better suited for model deployment and transfer, especially in web-based or mobile applications.

How to Convert Checkpoints to Safetensors

How to Convert Checkpoints to Safetensors
How to Convert Checkpoints to Safetensors

Step 1. Preparation:

  • Select Checkpoint File: Begin with a checkpoint file from a trained model.
  • Install Necessary Tools: Ensure you have the tools or libraries needed for conversion, corresponding to the model’s framework.

Step 2. Conversion Process:

  • Extracting Model Weights: Load the checkpoint file and extract the model’s weights and parameters.
  • Serialization: Serialize these weights into a binary format. This might involve using specific functions provided by the framework or custom scripts.
  • Compression (Optional): Apply compression techniques if needed to further reduce file size.

Step 3. Creating Safetensor File:

  • Packaging: Combine the serialized data and any necessary metadata into a single file.
  • File Extension: Assign a recognizable file extension like .safe for identification.

Step 4. Testing the Conversion:

  • Load in Compatible Environment: Load the newly created Safetensor file in an environment like Automatic1111 WebUI.
  • Functionality Test: Run standard tasks to ensure the model behaves as expected, confirming successful conversion.


By following this tutorial, you have learned how to install, set up, and use Automatic1111 Stable Diffusion Web UI. You now have the necessary knowledge to generate high-quality images using Stable Diffusion, customize parameters, and optimize image quality. Remember to leverage Safetensors for responsible image generation and explore the advanced features for further customization. With Automatic1111, you can unlock the power of Automatic Differentiation and create stunning images with ease.

While Automatic1111 is a powerful tool for image generation, Anakin AI offers an alternative solution with their Stable Diffusion Image Generator.

Stable Diffusion Image Generator | AI Powered |
This is an image generation application based on the Stable Diffusion model, capable of producing high-quality and diverse image content. It is suitable for various creative tasks, where you can simply choose or input the appropriate prompt to instantly generate images.

By visiting the Anakin AI Stable Diffusion Image Generator, you can dive into a new image generation journey while leveraging the power of Stable Diffusion. Enjoy the process of creating breathtaking images, and unleash your creativity with Anakin AI.