jmoso13 / jukebox-diffusion

MIT License
107 stars 13 forks source link

EOFError: Ran out of input #2

Open drscotthawley opened 10 months ago

drscotthawley commented 10 months ago

Hey Jeff! This looks really cool! I'm trying to run the Colab notebook but no matter what I supply for context_audio or set for token_multiplier, the Generate step always ends abruptly with "EOFError: Ran out of input". This happens with or without any init_audio, by the way. For context_audio I've tried a 5-second WAV file and a 23-second file. (All my other settings are just the defaults.)

Generate output reads like so:


--seconds-length 8 --context-audio /content/shadow_synth_441.wav --save-dir /content/drive/MyDrive/AI/Jbdiff --project-name jbdiff-fun --levels 12 --noise-style constant --noise-step-size 0.7 --dd-noise-style walk --dd-noise-step-size 0.15 --token-multiplier 4 --update-lowest-context False 

Using cuda True
levels:  [1, 2]
Loading Level 2
Downloading from azure
Traceback (most recent call last):
  File "/content/jukebox-diffusion/sample.py", line 269, in <module>
    main()
  File "/content/jukebox-diffusion/sample.py", line 262, in main
    run(**vars(args))
  File "/content/jukebox-diffusion/sample.py", line 94, in run
    vqvae, _, _ = make_jb(".", level, batch_size, base_tokens, context_mult, aug_shift, num_workers=12, train=False)
  File "/content/jukebox-diffusion/jbdiff/utils.py", line 186, in make_jb
    vqvae = make_vqvae(hps, device)
  File "/usr/local/lib/python3.10/dist-packages/jukebox/make_models.py", line 95, in make_vqvae
    restore_model(hps, vqvae, hps.restore_vqvae)
  File "/usr/local/lib/python3.10/dist-packages/jukebox/make_models.py", line 55, in restore_model
    checkpoint = load_checkpoint(checkpoint_path)
  File "/usr/local/lib/python3.10/dist-packages/jukebox/make_models.py", line 37, in load_checkpoint
    checkpoint = t.load(restore, map_location=t.device('cpu'))
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1028, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1246, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
EOFError: Ran out of input

Can you give me some idea of what might be going wrong here, and how I should fix it?
Thanks!

jmoso13 commented 10 months ago

Hey Scott, thanks for the kind words. Glad to hear you're interested in the CoLab. This is an odd error I haven't seen before but seems to be related to the downloading of the Jukebox autoencoder weights. I'm curious if there's some issue with the connection between CoLab and the azure storage? Could you try manually adding this cell to the beginning of the notebook and running it to see if the weights download to cache appropriately?

import os
os.makedirs(os.path.dirname("/root/.cache/jukebox/models/5b/vqvae.pth.tar"))
!wget -O /root/.cache/jukebox/models/5b/vqvae.pth.tar https://openaipublic.azureedge.net/jukebox/models/5b/vqvae.pth.tar

Then once you run the generate cell, these weights should be taken from cache rather than downloaded again. If the error still persists then there's something else weird going on that's unrelated to the download of the weights. Let me know what you get.

drscotthawley commented 10 months ago

@jmoso13, thanks for your reply.

When I add your suggested code at the top of the notebook, run the cells, restart the runtime after the installs, and finally get to down to generate, I get a different error:

python3: can't open file '/content/sample.py': [Errno 2] No such file or directory

I don't see any sample.py in the /content/ directory, as this screenshot reveals:

Screenshot 2023-11-16 at 9 12 52 PM

Here's a link to my Copy of your Colab with your suggested code at the top: https://colab.research.google.com/drive/1wdnXz0zuSFOlVODMI6_w3asV4jIzrNXq?usp=sharing

Not sure what to try next. :-/

jmoso13 commented 10 months ago

Hey Scott! Sorry for such a long awaited reply, have been busy these past couple weeks. There's no need to restart the runtime after the install, I know pip says there is, but there's really not ;).

There's a line in the Install cell that changes directories to jukebox-diffusion which is where the script sample.py is located:

%cd jukebox-diffusion

If you want to restart the runtime you can add this line back in wherever you want before running generate and you will be in the right directory. I've tried your script without restarting runtime however and got a successful generation. I hope you can get it working, would love your feedback.

There's also a tutorial video that might help explain directory structure, tips for using init audio (my favorite use), and other less intuitive things about the notebook here: https://www.youtube.com/watch?v=XSACG1bhNpQ&t=1886s