light-and-ray / sd-webui-hardware-info-in-metadata

Adds GPU Model name, VRAM, CPU Model name, RAM and Taken Time into generated image metadata
4 stars 3 forks source link

"Hardware Info: unknown" on MacBook Pro 2023 #3

Closed dichter closed 4 months ago

dichter commented 5 months ago

Hi,

I get "Hardware Info: unknown" written in the metadata.

I am on a MacBook Pro 2023 with Apple M2 Max chip and 32 GB Ram

light-and-ray commented 5 months ago

Thanks for testing on your system. Can you show your startup console log, there should be an error

dichter commented 5 months ago

Sure, here is the startup console log with all extensions disabled but the sd-webui-hardware-info-in-metadata

The error seems to stem from the line torch.cuda.get_device_properties(torch.cuda.device(0)) that fails because the pytorch on a mac does not have cuda compiled in.

In my webui-user.sh I have the line export TORCH_COMMAND="pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html"

Launching launch.py...
################################################################
Python 3.11.7 (main, Dec 15 2023, 12:09:56) [Clang 14.0.6 ]
Version: v1.9.4-169-ga30b19dd
Commit hash: a30b19dd5536f463222e484aef2daf466b49ee85
Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --opt-sub-quad-attention --no-half-vae --medvram-sdxl --use-cpu interrogate
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
*** Can't make hardware info for metadata
    Traceback (most recent call last):
      File "/Users/ge/stable-diffusion-webui/extensions/sd-webui-hardware-info-in-metadata/scripts/hardware_info_in_metadata.py", line 35, in <module>
        HARDWARE_INFO = makeHardwareInfo()
                        ^^^^^^^^^^^^^^^^^^
      File "/Users/ge/stable-diffusion-webui/extensions/sd-webui-hardware-info-in-metadata/scripts/hardware_info_in_metadata.py", line 16, in makeHardwareInfo
        gpuProp = torch.cuda.get_device_properties(torch.cuda.device(0))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ge/stable-diffusion-webui/venv-torch-nightly/lib/python3.11/site-packages/torch/cuda/__init__.py", line 452, in get_device_properties
        _lazy_init()  # will define _get_device_properties
        ^^^^^^^^^^^^
      File "/Users/ge/stable-diffusion-webui/venv-torch-nightly/lib/python3.11/site-packages/torch/cuda/__init__.py", line 292, in _lazy_init
        raise AssertionError("Torch not compiled with CUDA enabled")
    AssertionError: Torch not compiled with CUDA enabled

---
Loading weights [3e0a3274d0] from /Users/ge/stable-diffusion-webui/models/Stable-diffusion/zavychromaxl_v70.safetensors
Creating model from config: /Users/ge/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml
/Users/ge/stable-diffusion-webui/venv-torch-nightly/lib/python3.11/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
Running on local URL:  http://127.0.0.1:7860

By the way, cpuinfo would work just fine, but hardwareinfo fails before that and does not execute the other queries

% cpuinfo                  
Python Version: 3.11.7.final.0 (64 bit)
Cpuinfo Version: 9.0.0
Vendor ID Raw: 
Hardware Raw: 
Brand Raw: Apple M2 Max
Hz Advertised Friendly: 
Hz Actual Friendly: 
Hz Advertised: 
Hz Actual: 
Arch: ARM_8
Bits: 64
Count: 12
Arch String Raw: arm64
L1 Data Cache Size: 
L1 Instruction Cache Size: 
L2 Cache Size: 
L2 Cache Line Size: 
L2 Cache Associativity: 
L3 Cache Size: 
Stepping: 
Model: 
Family: 
Processor Type: 
Flags: 
light-and-ray commented 5 months ago

Thanks. Can you update and test it now?

dichter commented 5 months ago

Thanks! Now the extension writes the expected: Hardware Info: "Apple M2 Max, 32GB RAM"