jukebox icon indicating copy to clipboard operation
jukebox copied to clipboard

No module named "torch"?

Open MadzRed opened this issue 4 years ago • 6 comments

Every time I try to sample using Rick Astley's voice, I get this message: Traceback (most recent call last): File "jukebox/sample.py", line 2, in import torch as t ModuleNotFoundError: No module named 'torch' I don't know Python or anything so I don't know what it's talking about.

MadzRed avatar Jan 30 '21 00:01 MadzRed

you won't get anywhere without an nvidia graphics card with lots of VRAM. You need to install miniconda https://docs.conda.io/en/latest/miniconda.html then run the install commands in readme to get pytorch installed.

johndpope avatar Jan 30 '21 03:01 johndpope

Every time I try to sample using Rick Astley's voice, I get this message: Traceback (most recent call last): File "jukebox/sample.py", line 2, in import torch as t ModuleNotFoundError: No module named 'torch' I don't know Python or anything so I don't know what it's talking about.

To solve this error, type the following in cmd.exe: "pip install torch". Maybe, that should solve the problem.

DevelopCMD avatar Feb 05 '21 02:02 DevelopCMD

i've already installed miniconda, installed torch,

MadzRed avatar Feb 05 '21 03:02 MadzRed

it seems miniconda didn't load - presumably you're on linux? If so - I recommend using zsh / and change your default shell to it. https://askubuntu.com/questions/131823/how-to-make-zsh-the-default-shell

apt-get install zsh / and then install oh-my-zsh - https://ohmyz.sh/

reinstall conda / and or add to the system path. see here you'll need to update the path ~/.zshrc https://stackoverflow.com/questions/50336405/installing-miniconda-with-zsh

when you run - conda init zsh

  • it will give you a context of which python environment you're on. eg. here my window says spleeter-cpu Screen Shot 2021-02-05 at 8 42 45 pm

when you follow the instructions in this readme - it says conda activate jukebox you should see clearly the environment - and providing you installed the requirements / with activated environment - it should work.

UPDATE - although - if you have a newer card 30XX - you will want to install pytorch via pip with the nightly build - not conda.

pip install numpy
pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu110/torch_nightly.html

johndpope avatar Feb 05 '21 09:02 johndpope

well i'm using windows

MadzRed avatar Feb 11 '21 21:02 MadzRed

Hi @johndpope, I'm wondering what were your installation steps for Jukebox when running on a 30XX GPU...

I've tried your method of using the torch nightly build, but now I'm getting this error:

File "jukebox/train.py", line 345, in <module> fire.Fire(run) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/fire/core.py", line 127, in Fire component_trace = _Fire(component, args, context, name) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/fire/core.py", line 366, in _Fire component, remaining_args) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/fire/core.py", line 542, in _CallCallable result = fn(*varargs, **kwargs) File "jukebox/train.py", line 328, in run train_metrics = train(distributed_model, model, opt, shd, scalar, ema, logger, metrics, data_processor, hps) File "jukebox/train.py", line 230, in train x_out, loss, _metrics = model(x, **forw_kwargs) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 702, in forward output = self.module(*inputs[0], **kwargs[0]) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/prior/prior.py", line 349, in forward loss, metrics = self.z_forward(z=z, z_conds=z_conds, y=y, fp16=fp16, get_preds=get_preds) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/prior/prior.py", line 332, in z_forward gen_loss, preds = self.prior(z, x_cond, y_cond, encoder_kv, fp16=fp16, get_preds=get_preds) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/prior/autoregressive.py", line 149, in forward x = self.transformer(x, encoder_kv=encoder_kv, fp16=fp16) # Transformer File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/transformer/transformer.py", line 182, in forward x = checkpoint(f, (x,), l.parameters(), True) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/utils/checkpoint.py", line 7, in checkpoint return CheckpointFunction.apply(func, len(inputs), *args) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/utils/checkpoint.py", line 18, in forward output_tensors = ctx.run_function(*ctx.input_tensors) File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/transformer/transformer.py", line 81, in forward self.checkpoint_mlp == 1) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/utils/checkpoint.py", line 9, in checkpoint return func(*inputs) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/transformer/transformer.py", line 79, in <lambda> m = checkpoint(lambda _x: self.mlp(self.ln_1(_x)), (x + a,), File "/home/factory-creators-lab/miniconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/transformer/transformer.py", line 28, in forward m = self.act(self.c_fc(x)) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/transformer/ops.py", line 53, in memory_efficient_quick_gelu return QuickGelu.apply(x) File "/home/factory-creators-lab/Desktop/AI/jukebox/jukebox/transformer/ops.py", line 46, in forward return quick_gelu(x) RuntimeError: Error in dlopen or dlsym: libnvrtc.so.11.0: cannot open shared object file: No such file or directory It seems I cannot make jukebox run and I'm using a RTX 3090. Thanks

moih avatar Feb 18 '21 19:02 moih