AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.81k stars 26.92k forks source link

[Bug]: CodeFormer version c5b4593 not match with Torch version: 2.1.0a0+b5021ba #13766

Open micrazy opened 1 year ago

micrazy commented 1 year ago

Is there an existing issue for this?

What happened?

*** Error setting up CodeFormer Traceback (most recent call last): File "/home/workspace/AIGC/stable-diffusion-webui/modules/codeformer_model.py", line 32, in setup_model from facelib.utils.face_restoration_helper import FaceRestoreHelper File "/home/workspace/AIGC/stable-diffusion-webui/repositories/CodeFormer/facelib/utils/face_restoration_helper.py", line 7, in from facelib.detection import init_detection_model File "/home/workspace/AIGC/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/init.py", line 11, in from .yolov5face.face_detector import YoloDetector File "/home/workspace/AIGC/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py", line 20, in IS_HIGH_VERSION = tuple(map(int, torch.version.split('+')[0].split('.'))) >= (1, 9, 0) ValueError: invalid literal for int() with base 10: '0a0'

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

All go well

Sysinfo

Torch version: 2.1.0a0+b5021ba

What browsers do you use to access the UI ?

No response

Console logs

*** Error setting up CodeFormer
    Traceback (most recent call last):
      File "/home/workspace/AIGC/stable-diffusion-webui/modules/codeformer_model.py", line 32, in setup_model
        from facelib.utils.face_restoration_helper import FaceRestoreHelper
      File "/home/workspace/AIGC/stable-diffusion-webui/repositories/CodeFormer/facelib/utils/face_restoration_helper.py", line 7, in <module>
        from facelib.detection import init_detection_model
      File "/home/workspace/AIGC/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/__init__.py", line 11, in <module>
        from .yolov5face.face_detector import YoloDetector
      File "/home/workspace/AIGC/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py", line 20, in <module>
        IS_HIGH_VERSION = tuple(map(int, torch.__version__.split('+')[0].split('.'))) >= (1, 9, 0)
    ValueError: invalid literal for int() with base 10: '0a0'

Additional information

No response

richliu commented 8 months ago

It will get this issue because your pytorch used the nvidia version pytorch, and it will return non-number pytorch version.

for example, my pytorch.version will return 2.2.0a0+81ea7a4.

Here is temperory solution which can avoid this issue. edit, "stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py"

Modify line 20, IS_HIGH_VERSION to following version

20 version_string = torch.version.split('+')[0] 21 version_string = ''.join(filter(str.isdigit, version_string)) 22 IS_HIGH_VERSION = tuple(map(int, version_string.split('.'))) >= (1, 9, 0)