Skip to content

Commit

Permalink
Fix sdwebui install script (modelscope#404)
Browse files Browse the repository at this point in the history
* fix typo diffuers -> diffusers

* handle mmcv fail install

* remove duplicate onnxruntime install

* change fsspec to 2023.9.2, there seems to be a bug in fsspec 2023.10.0
  • Loading branch information
w-e-w authored Nov 4, 2023
1 parent c817a79 commit ef3d9ca
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
launch.run_pip("install python-slugify==8.0.1", "requirements for python-slugify")

if not launch.is_installed("diffusers"):
print("--installing diffuers...")
launch.run_pip("install diffuers", "requirements for diffuers")
print("--installing diffusers...")
launch.run_pip("install diffusers", "requirements for diffusers")

if not launch.is_installed("onnxruntime") and not launch.is_installed("onnxruntime-gpu"):
import torch.cuda as cuda
Expand All @@ -25,14 +25,17 @@
print("--installing controlnet_aux...")
launch.run_pip("install controlnet_aux==0.0.6", "requirements for controlnet_aux")

if not launch.is_installed("onnxruntime"):
print("--installing onnxruntime...")
launch.run_pip("install onnxruntime==1.15.1", "requirements for onnxruntime")

if not launch.is_installed("mmcv"):
print("--installing mmcv...")
# Todo 这里有坑
launch.run_pip("install mmcv-full==1.7.0", "requirements for mmcv")
try:
launch.run_pip("install mmcv-full==1.7.0", "requirements for mmcv")
except Exception as e:
print(e)
if os.name == 'nt': # Windows
print('ERROR facechain: failed to install mmcv, make sure to have "CUDA Toolkit" and "Build Tools for Visual Studio" installed')
else:
print('ERROR facechain: failed to install mmcv')

if not launch.is_installed("mmdet"):
print("--installing mmdet...")
Expand All @@ -45,3 +48,19 @@
if not launch.is_installed("edge_tts"):
print("--installing edge_tts...")
launch.run_pip("install edge_tts", "requirements for mediapipe")

# there seems to be a bug in fsspec 2023.10.0 that triggers an Error during training
# NotImplementedError: Loading a dataset cached in a LocalFileSystem is not supported.
# currently webui by default will install 2023.10.0
# Todo remove fsspec version change after issue is resolved, please monitor situation, it's possible in the future that webui might specify a specific version of fsspec
import pkg_resources
required_fsspec_version = '2023.9.2'
try:
fsspec_version = pkg_resources.get_distribution('fsspec').version
if fsspec_version != required_fsspec_version:
print("--installing fsspec...")
launch.run_pip(f"install -U fsspec=={required_fsspec_version}", f"facechain changing fsspec version from {fsspec_version} to {required_fsspec_version}")
except Exception:
# pkg_resources.get_distribution will throw if fsspec installed, since webui install by default fsspec this section shouldn't be necessary
print("--installing fsspec...")
launch.run_pip(f"install -U fsspec=={required_fsspec_version}", f"requirements for facechain")

0 comments on commit ef3d9ca

Please sign in to comment.