Open aeroxy opened 1 year ago
@aeroxy Python 3.8 isn't supported,
Only Python 3.10 is well-tested for normal use.
Do you still have the issue using 3.10?
You will only need to create and use a venv with 3.10, so don't worry if your installed python isn't properly linked systemwide.
Very interesting for a quick hack, what kind of inference speeds are you getting?
@aeroxy Python 3.8 isn't supported, Only Python 3.10 is well-tested for normal use. Do you still have the issue using 3.10? You will only need to create and use a venv with 3.10, so don't worry if your installed python isn't properly linked systemwide.
Very interesting for a quick hack, what kind of inference speeds are you getting?
TPU lib and TPU pytorch only supports Python 3.8.
I was able to generate 32 512x512 images in 100 seconds.
I actually did a test using python3.10 and doing all the changes the OP did. I managed to get it working
Tested on Debian 11 (Bullseye)
################################################################
################################################################
Running on azerudream user
################################################################
################################################################
Repo already cloned, using it as install directory
################################################################
################################################################
python venv already activate or run without venv: /home/azerudream/stable-diffusion-webui
################################################################
################################################################
Launching launch.py...
################################################################
Python 3.10.13 (main, Aug 25 2023, 13:20:03) [GCC 9.4.0]
Version: v1.5.2
Commit hash: c9c8485bc1e8720aba70f029d25cba1c4abf2b5c
Launching Web UI with arguments: --no-half --skip-torch-cuda-test --share --opt-sdp-attention --upcast-sampling
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled
Loading weights [6ce0161689] from /home/azerudream/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL: http://127.0.0.1:7860
Creating model from config: /home/azerudream/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: sdp... done.
Model loaded in 4.0s (load weights from disk: 1.4s, create model: 1.3s, apply weights to model: 0.3s, move model to device: 0.7s, calculate empty prompt: 0.2s).
Running on public URL: https://67da8d1114e1890248.gradio.live
This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
Startup time: 10.5s (launcher: 0.3s, import torch: 2.9s, import gradio: 0.8s, setup paths: 0.8s, other imports: 0.5s, load scripts: 0.5s, create ui: 0.8s, gradio launch: 3.8s).
30%|████████████████████████▎ | 6/20 [08:39<23:22, 100.19s/it]
Total progress: 30%|███████████████████▊ | 6/20 [07:57<22:16, 95.47s/it
Maybe a little slow cause of some data loading, hoping i could get some help to speed it up if I can.
I used https://storage.googleapis.com/pytorch-xla-releases/wheels/cuda/11.8/torch-2.0-cp310-cp310-linux_x86_64.whl for torch https://storage.googleapis.com/pytorch-xla-releases/wheels/cuda/11.8/torch_xla-2.0-cp310-cp310-linux_x86_64.whl for torch XLA
@AnxiJose is it faster than GPU?
As seen in the logs, i could only achieve some 100 seconds per each iteration. I'm pretty sure most modern GPUs can archieve at least some iterations per second. So no, it's real slow in several orders of magnitude.
Is there an existing issue for this?
What would your feature do ?
Google offers the Google Cloud TPU VM, an excellent platform for executing machine learning projects. Currently, the stable-diffusion-webui supports only GPU and not TPU. It may be beneficial to consider adding TPU support through XLA for enhanced performance and compatibility.
Proposed workflow
./webui.sh
.Additional information
I have attempted to create a version that utilizes XLA instead of GPU, which can be found here: https://github.com/aeroxy/stable-diffusion-webui/tree/tpu
To use this version, you must first manually enable the virtual environment by executing
source ./venv/bin/activate
. Next, install the torch_xla[tpuvm] package by running the commandpip install torch_xla[tpuvm]
. Once these steps are complete, you can run the./webui.sh
command again to start the server.However, please note that an error may be encountered during the image generation process: