So, you have a trusty AMD RX 580 graphics card and you want to dive into the world of local AI image generation with Stable Diffusion. You've seen the incredible results online, but the internet seems to think you need a high-end NVIDIA card.
Part 1: The Foundation - Getting the Prerequisites Right
Python 3.10.6: Version is critical. Do not use a newer version. Download the specific "Windows installer (64-bit)" for Python 3.10.6. During installation, you must check the box that says "Add Python 3.10 to PATH". This is non-negotiable. Git for Windows: This tool allows us to download the necessary software from its repository. Download and install it, accepting all the default options.
Part 2: The Installation - The "Happy Path"
Create a Folder: Create a simple, clean directory for your installation, for example, C:\Stable-Diffusion. Clone the Repository: Open the Command Prompt (cmd) and navigate to your folder (cd C:\Stable-Diffusion). Then, run the following command to download the special AMD-compatible version of the Web UI: Download a Model: You need a "checkpoint" model to generate images. Start with the standard Stable Diffusion 1.5 model. Download the v1-5-pruned-emaonly.safetensors file and place it in: C:\Stable-Diffusion\stable-diffusion-webui-directml\models\Stable-diffusion
Part 3: The First Launch & The Inevitable Errors
Error #1: RuntimeError: Torch is not able to use GPU
Right-click webui-user.bat and select Edit. Find the line set COMMANDLINE_ARGS=. Add the --skip-torch-cuda-test flag. The line should now look like this: set COMMANDLINE_ARGS=--skip-torch-cuda-test Save the file and run webui-user.bat again.
Error #2: AttributeError: module 'torch._C' has no attribute '_CudaDeviceProperties'
Delete the Broken Environment: In your stable-diffusion-webui-directml folder, delete the entire . This removes all the incorrectly installed packages. Open Command Prompt: Open a new cmd window and navigate to your installation folder: cd C:\Stable-Diffusion\stable-diffusion-webui-directml Create the Virtual Environment: Run python -m venv venv Activate the Environment: Run venv\Scripts\activate. Your command prompt line will now start with (venv). Install the Correct PyTorch: This is the magic command. Run: pip install torch-directml torchvision This manually installs the version of PyTorch built for AMD cards using DirectML.
Error #3: RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same
Edit webui-user.bat one more time. We need to force the software to use full precision (FP32). Add the --no-half flag to your arguments. The line should now be: set COMMANDLINE_ARGS=--skip-torch-cuda-test --no-half
Part 4: The Final Optimization - From Working to Working Well
The Problem: CPU Usage High, GPU Usage Low
Edit webui-user.bat for the last time. Add the --use-directml flag. This command directly orders the program to engage the DirectML backend for your AMD GPU.
No comments:
Post a Comment