Stability-AI / generative-models

Generative Models by Stability AI
MIT License
24.08k stars 2.68k forks source link

running on windows, how to #172

Open 5shekel opened 10 months ago

5shekel commented 10 months ago

this worked for me. on windows 11 using virtual env (venv).

note the use of py.exe to set the correct python version.
this is similar to the conda create -n gen python=3.10.11 if you want to use conda you can skip this step

you will have to install python-3.10.11-amd64.exe on your windows machine.

# use `py.exe --list` to verify which python version re available to you
py --list
# sample output
 -V:3.11          Python 3.11 (64-bit)
 -V:3.10          Python 3.10 (64-bit)
 -V:3.9
 -V:3.8           Python 3.8 (64-bit)

edit the requirements\pt2.txt to lock some versions.

  1. remove the triton package mention and replace with
    https://huggingface.co/r4ziel/xformers_pre_built/resolve/main/triton-2.0.0-cp310-cp310-win_amd64.whl
  2. set the index-url for xformers, just add this line before the call from xformers. the txt fil should end with some like
    --extra-index-url https://download.pytorch.org/whl/cu118
    xformers>=0.0.20

    then run (in powershell)

    py -3.10 -m venv venv  
    .\venv\Scripts\activate
    pip install -r .\requirements\pt2.txt  
    $env:PYTHONPATH = "."
    streamlit run scripts/demo/sampling.py --server.port 1234

    note: to get the models, d/l from hugginface and place in a new dir named checkpoints, inside the repo.
    image

i use a symlink from another location on my pc so i dont have to have duplicates.

thanks for information in the open/closed issues for some of these bits. specifically https://github.com/Stability-AI/generative-models/issues/159

cibernicola commented 9 months ago

Finally! Thanks, tested and at least it loads! (more tests soon) Windows 10.

WyattSanders commented 9 months ago

https://github.com/Stability-AI/generative-models/issues/172#issue-2007613291 Finally got it working with this running on Windows 11, Conda python 3.10 and then hit this missing scripts error then could load a model: https://github.com/Stability-AI/generative-models/issues/93

MotorCityCobra commented 9 months ago

note: to get the models, d/l from hugginface and place in a new dir named checkpoints, inside the repo.

I tried this.

I'm getting (tf) C:\Users\ooo\tor\generative-models>streamlit run simple_video_sample.py

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501 Network URL: http://192.168.0.244:8501

C:\ProgramData\Miniconda3\envs\tf\lib\site-packages\torchaudio\backend\utils.py:66: UserWarning: No audio backend is available. warnings.warn("No audio backend is available.") no module 'xformers'. Processing without... No SDP backend available, likely because you are running in pytorch versions < 2.0. In fact, you are using PyTorch 1.11.0+cu113. You might want to consider upgrading. no module 'xformers'. Processing without... 2023-11-26 22:39:43.872 Uncaught app exception Traceback (most recent call last): File "C:\ProgramData\Miniconda3\envs\tf\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 534, in _run_script exec(code, module.dict) File "C:\Users\ooo\tor\generative-models\simple_video_sample.py", line 278, in Fire(sample) File "C:\ProgramData\Miniconda3\envs\tf\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "C:\ProgramData\Miniconda3\envs\tf\lib\site-packages\fire\core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "C:\ProgramData\Miniconda3\envs\tf\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "C:\Users\ooo\tor\generative-models\simple_video_sample.py", line 67, in sample model, filter = load_model( File "C:\Users\ooo\tor\generative-models\simple_video_sample.py", line 268, in load_model with torch.device(device): AttributeError: enter

I get this error before and after the weights are in that directory.

5shekel commented 9 months ago

@MotorCityCobra you don't have xformers. Edit your requirements file. See step 2