Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AMD GPU Rocm RuntimeError: No HIP GPUs are available #3674

Open
4 of 5 tasks
wolfred24 opened this issue Oct 13, 2024 · 1 comment
Open
4 of 5 tasks

[Bug]: AMD GPU Rocm RuntimeError: No HIP GPUs are available #3674

wolfred24 opened this issue Oct 13, 2024 · 1 comment
Labels
bug Something isn't working triage This needs an (initial) review

Comments

@wolfred24
Copy link

wolfred24 commented Oct 13, 2024

Checklist

  • The issue has not been resolved by following the troubleshooting guide
  • The issue exists on a clean installation of Fooocus
  • The issue exists in the current version of Fooocus
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

I cant install fooocus:

(fooocus_env) debian@debian:~/Fooocus$ sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-modules-extra-6.1.0-25-amd64
E: Couldn't find any package by glob 'linux-modules-extra-6.1.0-25-amd64'
(fooocus_env) debian@debian:~/Fooocus$ python entry_with_update.py
Already up-to-date
Update succeeded.
[System ARGV] ['entry_with_update.py']
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0]
Fooocus version: 2.5.5
[Cleanup] Attempting to delete content of temp dir /tmp/fooocus
[Cleanup] Cleanup successful
Traceback (most recent call last):
  File "/home/debian/Fooocus/entry_with_update.py", line 46, in <module>
    from launch import *
  File "/home/debian/Fooocus/launch.py", line 152, in <module>
    from webui import *
  File "/home/debian/Fooocus/webui.py", line 10, in <module>
    import modules.async_worker as worker
  File "/home/debian/Fooocus/modules/async_worker.py", line 3, in <module>
    from extras.inpaint_mask import generate_mask_from_image, SAMOptions
  File "/home/debian/Fooocus/extras/inpaint_mask.py", line 6, in <module>
    from extras.GroundingDINO.util.inference import default_groundingdino
  File "/home/debian/Fooocus/extras/GroundingDINO/util/inference.py", line 3, in <module>
    import ldm_patched.modules.model_management as model_management
  File "/home/debian/Fooocus/ldm_patched/modules/model_management.py", line 121, in <module>
    total_vram = get_total_memory(get_torch_device()) / (1024 * 1024)
                                  ^^^^^^^^^^^^^^^^^^
  File "/home/debian/Fooocus/ldm_patched/modules/model_management.py", line 90, in get_torch_device
    return torch.device(torch.cuda.current_device())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torch/cuda/__init__.py", line 787, in current_device
    _lazy_init()
  File "/home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torch/cuda/__init__.py", line 302, in _lazy_init
    torch._C._cuda_init()
RuntimeError: No HIP GPUs are available

Steps to reproduce the problem

Run this command:

(fooocus_env) debian@debian:~/Fooocus$ sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"

What should have happened?

Fooocus should be installed

What browsers do you use to access Fooocus?

Google Chrome

Where are you running Fooocus?

Locally

What operating system are you using?

Debian 12

Console logs

(fooocus_env) debian@debian:~/Fooocus$ pip uninstall torch torchvision torchaudio torchtext functorch xformers 
Found existing installation: torch 2.4.1
Uninstalling torch-2.4.1:
  Would remove:
    /home/debian/Fooocus/fooocus_env/bin/convert-caffe2-to-onnx
    /home/debian/Fooocus/fooocus_env/bin/convert-onnx-to-caffe2
    /home/debian/Fooocus/fooocus_env/bin/torchrun
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/functorch/*
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torch-2.4.1.dist-info/*
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torch/*
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchgen/*
Proceed (Y/n)? Y
  Successfully uninstalled torch-2.4.1
Found existing installation: torchvision 0.19.1
Uninstalling torchvision-0.19.1:
  Would remove:
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision-0.19.1.dist-info/*
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision.libs/libcudart.7ec1eba6.so.12
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision.libs/libjpeg.ceea7512.so.62
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision.libs/libnvjpeg.f00ca762.so.12
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision.libs/libpng16.7f72a3c5.so.16
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision.libs/libz.2fd3c0b3.so.1
    /home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torchvision/*
Proceed (Y/n)? Y
  Successfully uninstalled torchvision-0.19.1
WARNING: Skipping torchaudio as it is not installed.
WARNING: Skipping torchtext as it is not installed.
WARNING: Skipping functorch as it is not installed.
WARNING: Skipping xformers as it is not installed.
(fooocus_env) debian@debian:~/Fooocus$ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6
Looking in indexes: https://download.pytorch.org/whl/rocm5.6
Collecting torch
  Downloading https://download.pytorch.org/whl/rocm5.6/torch-2.2.2%2Brocm5.6-cp311-cp311-linux_x86_64.whl (1570.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 GB 1.7 MB/s eta 0:00:00
Collecting torchvision
  Downloading https://download.pytorch.org/whl/rocm5.6/torchvision-0.17.2%2Brocm5.6-cp311-cp311-linux_x86_64.whl (65.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.1/65.1 MB 14.4 MB/s eta 0:00:00
Collecting torchaudio
  Downloading https://download.pytorch.org/whl/rocm5.6/torchaudio-2.2.2%2Brocm5.6-cp311-cp311-linux_x86_64.whl (1.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 14.7 MB/s eta 0:00:00
Requirement already satisfied: filelock in ./fooocus_env/lib/python3.11/site-packages (from torch) (3.16.1)
Requirement already satisfied: typing-extensions>=4.8.0 in ./fooocus_env/lib/python3.11/site-packages (from torch) (4.12.2)
Requirement already satisfied: sympy in ./fooocus_env/lib/python3.11/site-packages (from torch) (1.13.3)
Requirement already satisfied: networkx in ./fooocus_env/lib/python3.11/site-packages (from torch) (3.4.1)
Requirement already satisfied: jinja2 in ./fooocus_env/lib/python3.11/site-packages (from torch) (3.1.4)
Requirement already satisfied: fsspec in ./fooocus_env/lib/python3.11/site-packages (from torch) (2024.9.0)
Collecting pytorch-triton-rocm==2.2.0
  Downloading https://download.pytorch.org/whl/pytorch_triton_rocm-2.2.0-cp311-cp311-linux_x86_64.whl (232.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 232.6/232.6 MB 8.7 MB/s eta 0:00:00
Requirement already satisfied: numpy in ./fooocus_env/lib/python3.11/site-packages (from torchvision) (1.26.4)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in ./fooocus_env/lib/python3.11/site-packages (from torchvision) (10.4.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./fooocus_env/lib/python3.11/site-packages (from jinja2->torch) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in ./fooocus_env/lib/python3.11/site-packages (from sympy->torch) (1.3.0)
Installing collected packages: pytorch-triton-rocm, torch, torchvision, torchaudio
Successfully installed pytorch-triton-rocm-2.2.0 torch-2.2.2+rocm5.6 torchaudio-2.2.2+rocm5.6 torchvision-0.17.2+rocm5.6

(fooocus_env) debian@debian:~/Fooocus$ sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-modules-extra-6.1.0-25-amd64
E: Couldn't find any package by glob 'linux-modules-extra-6.1.0-25-amd64'
(fooocus_env) debian@debian:~/Fooocus$ python entry_with_update.py
Already up-to-date
Update succeeded.
[System ARGV] ['entry_with_update.py']
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0]
Fooocus version: 2.5.5
[Cleanup] Attempting to delete content of temp dir /tmp/fooocus
[Cleanup] Cleanup successful
Traceback (most recent call last):
  File "/home/debian/Fooocus/entry_with_update.py", line 46, in <module>
    from launch import *
  File "/home/debian/Fooocus/launch.py", line 152, in <module>
    from webui import *
  File "/home/debian/Fooocus/webui.py", line 10, in <module>
    import modules.async_worker as worker
  File "/home/debian/Fooocus/modules/async_worker.py", line 3, in <module>
    from extras.inpaint_mask import generate_mask_from_image, SAMOptions
  File "/home/debian/Fooocus/extras/inpaint_mask.py", line 6, in <module>
    from extras.GroundingDINO.util.inference import default_groundingdino
  File "/home/debian/Fooocus/extras/GroundingDINO/util/inference.py", line 3, in <module>
    import ldm_patched.modules.model_management as model_management
  File "/home/debian/Fooocus/ldm_patched/modules/model_management.py", line 121, in <module>
    total_vram = get_total_memory(get_torch_device()) / (1024 * 1024)
                                  ^^^^^^^^^^^^^^^^^^
  File "/home/debian/Fooocus/ldm_patched/modules/model_management.py", line 90, in get_torch_device
    return torch.device(torch.cuda.current_device())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torch/cuda/__init__.py", line 787, in current_device
    _lazy_init()
  File "/home/debian/Fooocus/fooocus_env/lib/python3.11/site-packages/torch/cuda/__init__.py", line 302, in _lazy_init
    torch._C._cuda_init()
RuntimeError: No HIP GPUs are available

Additional information

(fooocus_env) debian@debian:~/Fooocus$ sudo rocminfo
[sudo] password for debian: 
ROCk module is loaded
KFD does not support xnack mode query.
ROCr must assume xnack is disabled.
=====================    
HSA System Attributes    
=====================    
Runtime Version:         1.1
System Timestamp Freq.:  1000.000000MHz
Sig. Max Wait Duration:  18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count)
Machine Model:           LARGE                              
System Endianness:       LITTLE                             

==========               
HSA Agents               
==========               
*******                  
Agent 1                  
*******                  
  Name:                    AMD Ryzen 5 5600G with Radeon Graphics
  Uuid:                    CPU-XX                             
  Marketing Name:          AMD Ryzen 5 5600G with Radeon Graphics
  Vendor Name:             CPU                                
  Feature:                 None specified                     
  Profile:                 FULL_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        0(0x0)                             
  Queue Min Size:          0(0x0)                             
  Queue Max Size:          0(0x0)                             
  Queue Type:              MULTI                              
  Node:                    0                                  
  Device Type:             CPU                                
  Cache Info:              
    L1:                      32768(0x8000) KB                   
  Chip ID:                 0(0x0)                             
  Cacheline Size:          64(0x40)                           
  Max Clock Freq. (MHz):   3900                               
  BDFID:                   0                                  
  Internal Node ID:        0                                  
  Compute Unit:            12                                 
  SIMDs per CU:            0                                  
  Shader Engines:          0                                  
  Shader Arrs. per Eng.:   0                                  
  WatchPts on Addr. Ranges:1                                  
  Features:                None
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: FINE GRAINED        
      Size:                    16234872(0xf7b978) KB              
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 2                   
      Segment:                 GLOBAL; FLAGS: KERNARG, FINE GRAINED
      Size:                    16234872(0xf7b978) KB              
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 3                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    16234872(0xf7b978) KB              
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
  ISA Info:                
*******                  
Agent 2                  
*******                  
  Name:                    gfx1030                            
  Uuid:                    GPU-cdc672ea3d8d5e13               
  Marketing Name:          AMD Radeon RX 6950 XT              
  Vendor Name:             AMD                                
  Feature:                 KERNEL_DISPATCH                    
  Profile:                 BASE_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        128(0x80)                          
  Queue Min Size:          64(0x40)                           
  Queue Max Size:          131072(0x20000)                    
  Queue Type:              MULTI                              
  Node:                    1                                  
  Device Type:             GPU                                
  Cache Info:              
    L1:                      16(0x10) KB                        
    L2:                      4096(0x1000) KB                    
    L3:                      131072(0x20000) KB                 
  Chip ID:                 29605(0x73a5)                      
  Cacheline Size:          64(0x40)                           
  Max Clock Freq. (MHz):   2720                               
  BDFID:                   768                                
  Internal Node ID:        1                                  
  Compute Unit:            80                                 
  SIMDs per CU:            2                                  
  Shader Engines:          8                                  
  Shader Arrs. per Eng.:   2                                  
  WatchPts on Addr. Ranges:4                                  
  Features:                KERNEL_DISPATCH 
  Fast F16 Operation:      TRUE                               
  Wavefront Size:          32(0x20)                           
  Workgroup Max Size:      1024(0x400)                        
  Workgroup Max Size per Dimension:
    x                        1024(0x400)                        
    y                        1024(0x400)                        
    z                        1024(0x400)                        
  Max Waves Per CU:        32(0x20)                           
  Max Work-item Per CU:    1024(0x400)                        
  Grid Max Size:           4294967295(0xffffffff)             
  Grid Max Size per Dimension:
    x                        4294967295(0xffffffff)             
    y                        4294967295(0xffffffff)             
    z                        4294967295(0xffffffff)             
  Max fbarriers/Workgrp:   32                                 
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    16760832(0xffc000) KB              
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       FALSE                              
    Pool 2                   
      Segment:                 GROUP                              
      Size:                    64(0x40) KB                        
      Allocatable:             FALSE                              
      Alloc Granule:           0KB                                
      Alloc Alignment:         0KB                                
      Accessible by all:       FALSE                              
  ISA Info:                
    ISA 1                    
      Name:                    amdgcn-amd-amdhsa--gfx1030         
      Machine Models:          HSA_MACHINE_MODEL_LARGE            
      Profiles:                HSA_PROFILE_BASE                   
      Default Rounding Mode:   NEAR                               
      Default Rounding Mode:   NEAR                               
      Fast f16:                TRUE                               
      Workgroup Max Size:      1024(0x400)                        
      Workgroup Max Size per Dimension:
        x                        1024(0x400)                        
        y                        1024(0x400)                        
        z                        1024(0x400)                        
      Grid Max Size:           4294967295(0xffffffff)             
      Grid Max Size per Dimension:
        x                        4294967295(0xffffffff)             
        y                        4294967295(0xffffffff)             
        z                        4294967295(0xffffffff)             
      FBarrier Max Size:       32                                 
*** Done *** 
@wolfred24 wolfred24 added bug Something isn't working triage This needs an (initial) review labels Oct 13, 2024
@hqnicolas
Copy link

if it works leave a star:
https://github.com/hqnicolas/lllyasvielFooocusROCm/tree/main

@Bratzmeister
Copy link

two things I noticed.

  1. in the installation manual it's written in bold you need to use python 3.10 but you have 3.11
  2. the torch install instructions are quite outdated and want you to install torch for rocm 5.6 which hasn't been updated in a long time and is considered obsolete.

I run Fooocus successfully on my AMD system for almost a year now. Here's my advice:

  • Install python 3.10 if it's not installed on your debian (idk if you can have multiple python versions with apt) and make a new python 3.10 venv with python3.10 -m venvname
  • See that you have a modern ROCm implementation installed and a supported kernel alongside with it. I noticed your rocminfo output looks quite different compared to mine (i run 6.1). 6.2.x is current release and afaik anything below 6.1 is unsupported officially, 6.0 introduced breaking changes and destroyed compability to 5.x. See official instructions and your Debian instructions.
  • Install torch from this link https://download.pytorch.org/whl/rocm6.1 with pip install torch torchvision torchaudio -i https://download.pytorch.org/whl/rocm6.1
  • Check if torch can find your gpu and test basic functionality like described here https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/3rd-party/pytorch-install.html#testing-the-pytorch-installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This needs an (initial) review
Projects
None yet
Development

No branches or pull requests

3 participants