Closed sugizo closed 2 months ago
Please attempt with pip install dgenerate --extra-index-url https://download.pytorch.org/whl/cu121/
and see if that works.
Adding the extra index is required for installation as in https://github.com/Teriks/dgenerate?tab=readme-ov-file#install-dgenerate-1
I should note somewhere that this is required, I believe it should fix it :)
execute
pip install dgenerate --extra-index-url https://download.pytorch.org/whl/cu121
still got the same result
ERROR: Cannot install dgenerate==2.0.0, dgenerate==2.1.0, dgenerate==2.1.1, dgenerate==3.0.0, dgenerate==3.0.1, dgenerate==3.0.2, dgenerate==3.1.0, dgenerate==3.1.1, dgenerate==3.2.0, dgenerate==3.3.0 and dgenerate==3.3.1 because these package versions have conflicting dependencies.
The conflict is caused by:
dgenerate 3.3.1 depends on pywin32==306
dgenerate 3.3.0 depends on pywin32==306
dgenerate 3.2.0 depends on torch==2.1.1+cu118
dgenerate 3.1.1 depends on pywin32==306
dgenerate 3.1.0 depends on torch==2.1.1+cu118
dgenerate 3.0.2 depends on torch==2.1.1+cu118
dgenerate 3.0.1 depends on torch==2.1.1+cu118
dgenerate 3.0.0 depends on torch==2.1.1+cu118
dgenerate 2.1.1 depends on torch==2.0.1+cu118
dgenerate 2.1.0 depends on torch==2.0.1+cu118
dgenerate 2.0.0 depends on torch==2.0.1+cu118
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
It appears this is caused by the dependency portalocker
depending on pywin32
and for some reason pip trying to install it on a non windows system which is invalid.
portalocker
appears to account for this in its pyproject.toml, however it is no longer working for some reason and attempting to depend pywin32
on linux.
axing portalocker as a dependency fixes it, so I am likely to do that and roll my own file lock or use another solution.
this problem does not crop up from a source install so I did not catch it in the built package on PyPi
as a work around, you can install from source for now on non windows systems, you will need git installed
pip3 install git+https://github.com/Teriks/dgenerate@v3.3.1 --extra-index-url https://download.pytorch.org/whl/cu121/
This install issue should be resolved by the latest release https://pypi.org/project/dgenerate/3.4.0/
I have however not tried to run dgenerate in a notebook, and am interested in trying myself when I get the time
let me know if you encounter futher issues attempting to run in a notebook
I believe you should not need to install the CUDA driver directly
!pip install dgenerate==3.4.0 --extra-index-url https://download.pytorch.org/whl/cu121
!dgenerate stabilityai/stable-diffusion-xl-base-1.0 --model-type torch-sdxl \
--variant fp16 --dtype float16 \
--sdxl-refiner stabilityai/stable-diffusion-xl-refiner-1.0 \
--sdxl-high-noise-fractions 0.8 \
--inference-steps 40 \
--output-size 1024 \
--batch-size 2 \
--vae-slicing \
--vae-tiling \
--prompts "Artwork of a train passenger looking out the window of a train traveling \
through a forested mountain, masterpiece, high quality"
Should be sufficient to run in a notebook with the T4 GPU runtime from testing, it may ask you to restart the runtime.
Not sure if the restart can be resolved by installing it into an environment or not
steps
!apt update && apt upgrade
!apt install -y build-essential
!ln -s /usr/local/cuda/lib64/libnvrtc.so.12 /usr/local/cuda/lib64/libnvrtc.so
!export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
!export PATH=/usr/local/cuda/bin:$PATH
CUDA_LAUNCH_BLOCKING = 1
pip install dgenerate==3.4.0 --extra-index-url https://download.pytorch.org/whl/cu121
execute
!dgenerate stabilityai/stable-diffusion-xl-base-1.0 --model-type torch-sdxl \
--variant fp16 --dtype float16 \
--sdxl-refiner stabilityai/stable-diffusion-xl-refiner-1.0 \
--sdxl-high-noise-fractions 0.8 \
--inference-steps 40 \
--output-size 1024 \
--batch-size 2 \
--vae-slicing \
--vae-tiling \
--prompts "Artwork of a train passenger looking out the window of a train traveling \
through a forested mountain, masterpiece, high quality"
result
Beginning 1 generation steps...
===============================
Generation Step: 1 / 1
Seed: 54386422785246
SDXL High Noise Fraction: 0.8
Guidance Scale: 5
Inference Steps: 40
Prompt: "Artwork of a train passenger looking out the window of a train traveling through
a forested mountain, masterpiece, high quality"
====================================================================================================
2024-04-13 11:14:08.692384: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-04-13 11:14:08.692449: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-04-13 11:14:08.694726: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-04-13 11:14:10.268442: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Loading pipeline components...: 100% 7/7 [00:01<00:00, 3.76it/s]
Loading pipeline components...: 100% 5/5 [00:00<00:00, 11.86it/s]
Traceback (most recent call last):
File "/usr/local/bin/dgenerate", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/dgenerate/__init__.py", line 140, in main
sys.exit(invoke_dgenerate(args, render_loop=render_loop))
File "/usr/local/lib/python3.10/dist-packages/dgenerate/invoker.py", line 100, in invoke_dgenerate
for event in invoke_dgenerate_events(**locals()):
File "/usr/local/lib/python3.10/dist-packages/dgenerate/invoker.py", line 299, in invoke_dgenerate_events
yield from render_loop.events()
File "/usr/local/lib/python3.10/dist-packages/dgenerate/renderloop.py", line 744, in events
yield from self._run()
File "/usr/local/lib/python3.10/dist-packages/dgenerate/renderloop.py", line 836, in _run
with pipeline_wrapper(diffusion_arguments,
File "/usr/local/lib/python3.10/dist-packages/dgenerate/pipelinewrapper/wrapper.py", line 2225, in __call__
result = self._call_torch(pipeline_args=pipeline_args,
File "/usr/local/lib/python3.10/dist-packages/dgenerate/pipelinewrapper/wrapper.py", line 1766, in _call_torch
torch.Generator(device=self._device).manual_seed(
RuntimeError: CUDA error: CUDA driver version is insufficient for CUDA runtime version
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Device-side assertions were explicitly omitted for this error check; the error probably arose while initializing the DSA handlers.
Here is a shared notebook I had success with, though it may be possible that sometimes Collab offers up a different environment with an outdated CUDA toolkit (?), in which case I am unsure if it is feasible to bring the image they put your code on up to date with what is needed
In this notebook I used a virtual environment, and it seems to prevent Collab from asking to restart the runtime
The only caveat is that you have to activate the environment at the beginning of every code section, as they all run in a different shell
It seemed to run fine on whatever image instance it gave me without attempting any other modification to the environment such a creating a link for the runtime shared object etc.
https://colab.research.google.com/drive/1kn_ED6WAJp6ySr60W7fp97GYc62sMMAF?usp=sharing
your colab file sharing is work this is the code taken from your shared colab file
!apt install -y python3-venv
!python3 -m venv venv
!source /content/venv/bin/activate; pip install dgenerate==3.4.1 --extra-index-url https://download.pytorch.org/whl/cu121
!source /content/venv/bin/activate; dgenerate stabilityai/stable-diffusion-xl-base-1.0 --model-type torch-sdxl \
--variant fp16 --dtype float16 \
--sdxl-refiner stabilityai/stable-diffusion-xl-refiner-1.0 \
--sdxl-high-noise-fractions 0.8 \
--inference-steps 40 \
--output-size 1024 \
--batch-size 2 \
--vae-slicing \
--vae-tiling \
--prompts "Artwork of a train passenger looking out the window of a train traveling \
through a forested mountain, masterpiece, high quality"
!ls -la output/
thanks and best regards
info
steps
result
best regards