Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'dalle_pytorch' #4

Open
wolfgangmeyers opened this issue May 2, 2022 · 9 comments
Open

ModuleNotFoundError: No module named 'dalle_pytorch' #4

wolfgangmeyers opened this issue May 2, 2022 · 9 comments

Comments

@wolfgangmeyers
Copy link

Received this error after following instructions to run sampling:

python sample.py --model_path finetune.pt --batch_size 6 --text "a cyberpunk girl with a scifi neuralink device on her head | cyberpunk anime girl"
Traceback (most recent call last):
  File "sample.py", line 19, in <module>
    from dalle_pytorch import DiscreteVAE, VQGanVAE
ModuleNotFoundError: No module named 'dalle_pytorch'
@wolfgangmeyers
Copy link
Author

After downloading and installing dalle_pytorch, a new error shows up:

python sample.py --model_path finetune.pt --batch_size 6 --text "a cyberpunk girl with a scifi neuralink device on her head | cyberpunk anime girl"
c:\users\wolfg\code\latent-diffusion\src\clip\clip\clip.py:24: UserWarning: PyTorch version 1.7.1 or higher is recommended
  warnings.warn("PyTorch version 1.7.1 or higher is recommended")
Using device: cuda:0
Traceback (most recent call last):
  File "sample.py", line 269, in <module>
    model, diffusion = create_model_and_diffusion(**model_config)
  File "C:\Users\wolfg\code\glid-3-xl\guided_diffusion\script_util.py", line 109, in create_model_and_diffusion
    model = create_model(
  File "C:\Users\wolfg\code\glid-3-xl\guided_diffusion\script_util.py", line 189, in create_model
    return UNetModel(
  File "C:\Users\wolfg\code\glid-3-xl\guided_diffusion\unet.py", line 603, in __init__
    self.clip_proj = nn.Linear(clip_embed_dim, time_embed_dim, dtype=self.dtype)
TypeError: __init__() got an unexpected keyword argument 'dtype'

@wolfgangmeyers
Copy link
Author

I upgraded pytorch to 1.7.1 but the error persists...

@limiteinductive
Copy link
Contributor

did you installed ldm from this repo: https://github.com/CompVis/latent-diffusion ?
if you did could you send the output of you pip freeze?

@limiteinductive
Copy link
Contributor

limiteinductive commented May 2, 2022

and probably upgrading to pytorch 1.10 should solve your particular issue: https://pytorch.org/get-started/locally/

@wolfgangmeyers
Copy link
Author

Pip freeze (in the current state):

absl-py==1.0.0
aiohttp==3.8.1
aiosignal==1.2.0
albumentations==0.4.3
altair==4.2.0
antlr4-python3-runtime==4.8
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.5
async-timeout==4.0.2
atomicwrites==1.4.0
attrs==21.4.0
axial-positional-embedding==0.2.1
backcall==0.2.0
backports.zoneinfo==0.2.1
beautifulsoup4==4.11.1
bleach==5.0.0
blinker==1.4
blobfile==1.3.0
braceexpand==0.1.7
cachetools==5.0.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
click==8.0.4
-e git+https://github.com/openai/CLIP.git@b4ae44927b78d0093b556e3ce43cbdcff422017a#egg=clip
colorama==0.4.4
Cython==0.29.28
DALL-E==0.1
-e git+https://github.com/lucidrains/DALLE-pytorch.git@fcd35de4571b50e2d051826514dafc0bd0c69d98#egg=dalle_pytorch
dataclasses==0.6
debugpy==1.6.0
decorator==5.1.1
defusedxml==0.7.1
einops==0.4.1
entrypoints==0.4
executing==0.8.3
fastjsonschema==2.15.3
filelock==3.6.0
frozenlist==1.3.0
fsspec==2022.3.0
ftfy==6.1.1
future==0.18.2
gitdb==4.0.9
GitPython==3.1.27
google-auth==2.6.6
google-auth-oauthlib==0.4.6
grpcio==1.44.0
-e git+https://github.com/Jack000/glid-3-xl.git@a0b5be4b04378d4d4779240d3e0a599360c1a133#egg=guided_diffusion
idna==3.3
imageio==2.9.0
imageio-ffmpeg==0.4.2
imgaug==0.2.6
importlib-metadata==4.11.3
importlib-resources==5.7.1
iniconfig==1.1.1
ipykernel==6.13.0
ipython==8.3.0
ipython-genutils==0.2.0
ipywidgets==7.7.0
jedi==0.18.1
Jinja2==3.1.2
joblib==1.1.0
jsonschema==4.4.0
jupyter-client==7.3.0
jupyter-core==4.10.0
jupyterlab-pygments==0.2.2
jupyterlab-widgets==1.1.0
-e git+https://github.com/CompVis/latent-diffusion.git@5a6571e384f9a9b492bbfaca594a2b00cad55279#egg=latent_diffusion
Markdown==3.3.6
MarkupSafe==2.1.1
matplotlib-inline==0.1.3
mistune==0.8.4
mkl-fft==1.3.0
mkl-random==1.1.1
mkl-service==2.3.0
multidict==6.0.2
mypy==0.950
mypy-extensions==0.4.3
nbclient==0.6.0
nbconvert==6.5.0
nbformat==5.3.0
nest-asyncio==1.5.5
networkx==2.8
notebook==6.4.11
numpy @ file:///C:/ci/numpy_and_numpy_base_1603466732592/work
oauthlib==3.2.0
omegaconf==2.1.1
opencv-python==4.1.2.30
opencv-python-headless==4.5.5.64
packaging==21.3
pandas==1.4.2
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.0.1
pluggy==1.0.0
prometheus-client==0.14.1
prompt-toolkit==3.0.29
protobuf==3.20.1
psutil==5.9.0
pudb==2019.2
pure-eval==0.2.2
py==1.11.0
pyarrow==7.0.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
pycryptodomex==3.14.1
pydeck==0.7.1
pyDeprecate==0.3.1
Pygments==2.12.0
Pympler==1.0.1
pyparsing==3.0.8
pyrsistent==0.18.1
pytest==7.1.2
python-dateutil==2.8.2
pytorch-lightning==1.4.2
pytz==2022.1
pytz-deprecation-shim==0.1.0.post0
PyWavelets==1.3.0
pywin32==303
pywinpty==2.0.5
PyYAML==6.0
pyzmq==22.3.0
regex==2022.4.24
requests==2.27.1
requests-oauthlib==1.3.1
rotary-embedding-torch==0.1.5
rsa==4.8
sacremoses==0.0.49
scikit-image==0.19.2
scipy==1.8.0
semver==2.13.0
Send2Trash==1.8.0
six @ file:///tmp/build/80754af9/six_1644875935023/work
smmap==5.0.0
soupsieve==2.3.2.post1
stack-data==0.2.0
streamlit==1.8.1
-e git+https://github.com/CompVis/taming-transformers.git@24268930bf1dce879235a7fddd0b2355b84d7ea6#egg=taming_transformers
taming-transformers-rom1504==0.0.6
tensorboard==2.9.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
terminado==0.13.3
test-tube==0.7.5
tifffile==2022.4.28
tinycss2==1.1.1
tokenizers==0.10.3
toml==0.10.2
tomli==2.0.1
toolz==0.11.2
torch==1.7.1
torch-fidelity==0.3.0
torchmetrics==0.6.0
torchvision==0.8.1
tornado==6.1
tqdm==4.64.0
traitlets==5.1.1
transformers==4.3.1
typing-extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
tzdata==2022.1
tzlocal==4.2
urllib3==1.26.9
urwid==2.1.2
validators==0.18.2
watchdog==2.1.7
wcwidth==0.2.5
webdataset==0.2.5
webencodings==0.5.1
Werkzeug==2.1.2
widgetsnbextension==3.6.0
wincertstore==0.2
xmltodict==0.12.0
yarl==1.7.2
youtokentome==1.0.6
zipp==3.8.0

@wolfgangmeyers
Copy link
Author

installing pytorch 1.11, I'll let you know how that goes

@wolfgangmeyers
Copy link
Author

wolfgangmeyers commented May 2, 2022

new error:

python sample.py --model_path finetune.pt --batch_size 6 --text "a cyberpunk girl with a scifi neuralink device on her head | cyberpunk anime girl"
Using device: cuda:0
C:\Users\wolfg\anaconda3\envs\ldm\lib\site-packages\torch\nn\__init__.py
100%|███████████████████████████████████████| 890M/890M [02:40<00:00, 5.80MiB/s]
  0%|                                                                                           | 0/27 [00:00<?, ?it/s]Traceback (most recent call last):
  File "sample.py", line 522, in <module>
    do_run()
  File "sample.py", line 517, in do_run
    save_sample(i, sample)
  File "sample.py", line 470, in save_sample
    with open(npy_filename, 'wb') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: 'output_npy/00000.npy'

After creating output_npy:

python sample.py --model_path finetune.pt --batch_size 6 --text "a cyberpunk girl with a scifi neuralink device on her head | cyberpunk anime girl"
Using device: cuda:0
C:\Users\wolfg\anaconda3\envs\ldm\lib\site-packages\torch\nn\__init__.py
  0%|                                                                                           | 0/27 [00:00<?, ?it/s]Traceback (most recent call last):
  File "sample.py", line 522, in <module>
    do_run()
  File "sample.py", line 517, in do_run
    save_sample(i, sample)
  File "sample.py", line 476, in save_sample
    out.save(filename)
  File "C:\Users\wolfg\anaconda3\envs\ldm\lib\site-packages\PIL\Image.py", line 2209, in save
    fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: 'output/00000.png'

@wolfgangmeyers
Copy link
Author

I created a couple of output folders, and got the sampling working. Probably worth adding (if not exists, create folder) logic, and updating the docs to mention need for updated pytorch (latent diffusion installs an old version)

@wolfgangmeyers
Copy link
Author

I updated to pytorch 1.11. And the sampling is working! Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants