How to fix Automatic1111 DirectML on AMD 12/2023! Fix broken stable diffusion setup for ONNX/Olive

FE-Engineer
26 Dec 202320:16

TLDRThe video script outlines a step-by-step guide for setting up an automatic 1111 stable diffusion system on AMD for Windows, addressing common issues encountered as of December 2023. The guide begins with a clean installation of Python 3.10, GitHub for Windows, and the necessary repositories. It proceeds to troubleshoot problems related to GPU utilization, torch CUDA tests, and socket options, offering solutions such as editing scripts and installing specific packages. The video also demonstrates how to optimize ONNX models for better performance and manage model storage effectively. The creator encourages viewers to like, subscribe, and comment for further assistance and content creation support.

Takeaways

  • 💻 The video addresses issues with setting up automatic 1111 stable diffusion on AMD Windows systems and provides a solution as of December 2023.
  • 🗂️ The presenter advises deleting the old setup for direct ML and saving any desired models and images before proceeding.
  • 🐍 Python 3.10.6 is specifically recommended for the setup, and existing installations may need to be completely removed.
  • 🐍 Instructions include reinstalling Python and installing GitHub for Windows as part of the setup process.
  • 📂 The process involves cloning a repository and navigating to the created directory to run the web UI-user.bat file.
  • 🔧 The video outlines troubleshooting steps for common errors, such as 'torch is not available to use' and 'low vram' during ONNX optimization.
  • 📝 Editing the requirements.txt file and using virtual environments with specific pip commands are part of the solution.
  • 🔄 The video demonstrates how to optimize ONNX models and fix errors related to model optimization.
  • 🚀 After resolving issues, the presenter tests the setup by downloading a model and generating images with improved iteration speed.
  • 🗑️ Guidance is provided on safely deleting unnecessary models to free up space while retaining functionality.
  • 🔄 The video concludes with instructions on restarting the setup and confirms that the fixes should resolve the initial problems.
  • 🙏 The presenter appreciates viewer support and encourages likes and subscriptions for continued content creation.

Q & A

  • What is the main issue with the automatic 1111 stable diffusion setup for AMD on Windows?

    -The main issue is that users have been experiencing various problems with the setup, which the speaker aims to resolve in the video.

  • What did the speaker do to resolve the issue with the setup?

    -The speaker deleted the old setup for direct ml, reinstalled Python 3.10.6, and followed a series of steps to reinstall and configure the necessary components for stable diffusion to work properly.

  • Which Python version is recommended for the setup?

    -Python 3.10.6 is specifically recommended for the setup on Windows.

  • What is the first problem encountered during the installation process?

    -The first problem encountered is that torch is not available to use GPU, and skipping the torch Cuda test does not help and only breaks the setup.

  • How did the speaker fix the issue with torch not being available for GPU use?

    -The speaker edited the 'requirements.txt' file by adding 'torch==directml' and then ran 'pip install -r requirements.txt' within a virtual environment to install the necessary packages.

  • What is the solution to the 'socket options' problem?

    -The solution is to install 'httpx' by running 'pip install httpx==0.241' within the virtual environment.

  • How did the speaker optimize the ONNX model for better performance?

    -The speaker used the 'optimize onnx' feature in the stable diffusion web UI, but had to fix an error in the 'sdore_models.py' file by commenting out lines related to 'low vram' before the optimization could succeed.

  • What is the result of optimizing the ONNX model?

    -After optimization, the model's performance improved from 6.5 iterations per second to 19 iterations per second on the speaker's 7900 XTX GPU.

  • How can unnecessary models be deleted to clear out space?

    -Unnecessary models can be deleted by removing their files from the 'models' folder and the 'onnx-Olive' folder. The speaker demonstrated this by deleting the 'animerge safe tensors' model.

  • What is the speaker's advice for users who are experiencing issues with the setup?

    -The speaker advises users to follow the steps outlined in the video, which should resolve issues from the beginning of the setup to the optimization of models, allowing users to get stable diffusion up and running again.

  • How can users support the speaker's content creation?

    -Users can support the speaker by liking and subscribing to their channel, which helps the speaker continue creating content to assist others.

Outlines

00:00

💻 Resolving AMD Stability Issues in Windows

The speaker addresses issues with the automatic 1111 stable diffusion setup for AMD on Windows. They share their experience of troubleshooting and provide a step-by-step guide on how to get the setup working as of December 2023. The process involves deleting the old setup, ensuring models and images are saved, reinstalling Python 3.10.6, and using direct ml for a fresh setup. The speaker also explains how to install necessary software like GitHub for Windows and how to navigate and edit files to bypass errors such as 'torch not available for GPU' and 'socket options'.

05:01

🛠️ Setting Up Virtual Environment and Dependencies

In this section, the speaker guides through the process of setting up a virtual environment using 'VM scripts' and installing dependencies from the 'requirements.txt' file. They explain how to overcome the 'skip torch Cuda test failed' error by editing the 'web UI user bat' file to use 'directml' and 'onnx'. The speaker also details the installation of additional packages like 'httpx' to resolve ongoing issues and successfully run the stable diffusion setup.

10:02

🔧 Fixing Model Optimization and Server Reloading

The speaker discusses a problem with the 'onnx stable diffusion' object and how to fix it by editing the 'sdore,models.py' file. They explain the process of optimizing ONNX models and the error encountered due to insufficient VRAM. The solution involves commenting out specific lines in the 'sdore,models.py' file and reloading the server to apply changes. The speaker then demonstrates how to optimize a model and improve its performance.

15:08

🎉 Successful Implementation and Testing

After resolving the technical issues, the speaker tests the stable diffusion setup by downloading a model and generating images using a given prompt. They compare the performance of the original and optimized models, highlighting the increased iterations per second after optimization. The speaker also explains how to restart the setup and provides insights on what files are safe to delete to free up space.

20:08

🙏 Acknowledging the Community and Encouraging Engagement

The speaker expresses gratitude for the viewers and asks for likes and subscriptions to support the channel. They mention that they create and edit all the videos independently and encourage viewers to comment on topics they would like to see covered in future videos. The speaker wishes everyone a great day and thanks the audience for their support.

Mindmap

Keywords

💡Automatic 1111

In the context of the video, 'Automatic 1111' refers to a setup for a machine learning model, specifically the stable diffusion model, which is designed to run without manual intervention. The video discusses issues users have encountered with this setup on AMD Windows systems and provides a step-by-step guide on how to resolve these issues.

💡Direct ML

Direct ML is a machine learning framework that allows for the development of efficient and optimized machine learning models. In the video, the speaker uses Direct ML to run the stable diffusion model without encountering the common problems associated with the setup on AMD Windows systems.

💡Stable Diffusion

Stable Diffusion is a type of machine learning model used for generating images from textual descriptions. The video focuses on troubleshooting and optimizing the setup of this model on a Windows system with AMD hardware.

💡AMD

AMD is a multinational semiconductor company that develops computer processors and related technologies. In the video, the speaker is addressing issues specific to AMD hardware when setting up the stable diffusion model on Windows.

💡Python

Python is a high-level programming language known for its readability and ease of use. In the context of the video, Python is the language in which the stable diffusion model and its associated tools are programmed. The speaker instructs viewers to uninstall and reinstall a specific version of Python to resolve setup issues.

💡GitHub for Windows

GitHub for Windows is a client for the Git distributed version control system that is designed to be used on Windows operating systems. It allows users to manage their repositories and collaborate with others on projects. In the video, it is one of the necessary components to be installed for the stable diffusion setup.

💡Virtual Environment

A virtual environment is a isolated space within a computer system that is used to run programs and store data. In the context of the video, the speaker uses a virtual environment to isolate the dependencies and settings needed for the stable diffusion model, preventing conflicts with other system-wide installations.

💡ONNX

ONNX, or Open Neural Network Exchange, is an open standard format designed to represent deep learning models. It allows models to be transferred between different deep learning frameworks. In the video, the speaker discusses downloading and optimizing ONNX models for use with the stable diffusion setup.

💡Torch

Torch, also known as PyTorch, is an open-source machine learning library based on the Torch library. It is widely used for applications such as computer vision and natural language processing. In the video, the speaker encounters an issue with Torch not being available for GPU use and provides a workaround.

💡Optimization

In the context of machine learning, optimization refers to the process of improving the performance and efficiency of a model. This can involve reducing the model's size, increasing its speed, or enhancing its accuracy. The video discusses optimizing ONNX models for better performance on the stable diffusion setup.

💡迭代次数 (Iterations per second)

迭代次数,或称为每秒迭代次数(iterations per second),是衡量机器学习模型运行效率的一个指标,特别是在图像生成任务中。它表示模型每秒可以处理多少次迭代或生成多少张图片。在视频中,提高迭代次数是优化稳定扩散模型性能的一个目标。

Highlights

The speaker addresses issues with the automatic 1111 stable diffusion setup for AMD on Windows.

A solution is presented for getting the setup to work as of the end of December 2023.

The importance of saving models and generated images before deleting the old setup is emphasized.

Instructions for deleting Miniconda and Python are provided for a clean setup.

The specific Python version 3.10.6 is recommended for the setup.

GitHub for Windows is required for the setup process.

The process of cloning the repository and running the web UI is detailed.

A workaround for the 'torch not available for GPU' issue is described.

Activation of a virtual environment is necessary for certain installations.

The solution to the 'socket options' problem by installing httpx is provided.

Downloading and optimizing a model is demonstrated.

An error with the 'onnx stable diffusion object' is fixed by editing the sdore models.py file.

The process of optimizing an ONNX model is shown, improving performance.

Restarting the setup after changes is explained.

Guidance on what is safe to delete to clear space is given.

The speaker shares their experience with the Animerge model and its optimization.

The video aims to help viewers fix common issues with the setup.