melgan
melgan copied to clipboard
Torch hub command not working
Hello,
Thanks a lot for your implementation.
I am slightly confused because I am trying to run your torch hub command but it does not work.
Also if I look in /home/user/.cache/torch/checkpoints/
, I cannot find the checkpoint even though I do get the logging: Downloading: "https://github.com/seungwonpark/melgan/releases/download/v0.1-alpha/nvidia_tacotron2_LJ11_epoch3200.pt" to /home/user/.cache/torch/checkpoints/nvidia_tacotron2_LJ11_epoch3200.pt
Hi, can you please briefly describe about your environment?
In my case, it worked for CentOS but not for Windows 10.
Not OP but exactly the same error here. Environment:
- Ubuntu 16.04.06 LTS 'xenial'
- Python 3.6.9 (Anaconda)
- Pytorch 1.1.0
- CUDA 9.0_0, CuDNN 7.6.0
HTH - would be nice to try your work!
@raphpapercup @te0006 Have you solve this error? I encountered the same error.
Bug is still persisting.
I tried a different approach of manually downloading the pretrained model and then try loading it via PyTorch, and I hit a different bug for that.
This worked for me. I downloaded the checkpoint from the releases page.
from melgan.model.generator import Generator
from melgan.utils.hparams import HParam
checkpoint = torch.load("./nvidia_tacotron2_LJ11_epoch6400.pt")
hp = HParam("./melgan/config/default.yaml")
melgan = Generator(hp.audio.n_mel_channels).cuda()
melgan.load_state_dict(checkpoint["model_g"])
melgan.eval(inference=False)
I am having the same issue. not able to download the pretrained checkpoint.
hash_prefix = HASH_REGEX.search(filename).group(1) AttributeError: 'NoneType' object has no attribute 'group'
This worked for me. I downloaded the checkpoint from the releases page.
from melgan.model.generator import Generator from melgan.utils.hparams import HParam checkpoint = torch.load("./nvidia_tacotron2_LJ11_epoch6400.pt") hp = HParam("./melgan/config/default.yaml") melgan = Generator(hp.audio.n_mel_channels).cuda() melgan.load_state_dict(checkpoint["model_g"]) melgan.eval(inference=False)
This also worked for me. Go to Releases and download the checkpoint from the last release.
I tried a different approach of manually downloading the pretrained model and then try loading it via PyTorch, and I hit a different bug for that.
@delip you should reach checkpoint's generator module by loading the state dict via:
model.load_state_dict(torch.load('nvidia-tacotron2_LJ11_epoch6400.pt')['model_g'])
instead of
model.load_state_dict(torch.load('nvidia-tacotron2_LJ11_epoch6400.pt'))
having the same issue with torch.hub.load_state_dict_from_url()
I had the same problem but, in another application. In my case, I am the model "provider". Computing the SHA-256 Hash of the file and adding it to the checkpoint filename worked for me.
- On Linux, I ran:
sha256sum <checkpoint_model_filename.ext>
- I copied the first eight digits of the hash and added them to the filename:
checkpoint_model_filename-<sha256>.ext
- Then, I changed the filename in the release.
So, in this case, the model's filename should be https://github.com/seungwonpark/melgan/releases/download/v0.1-alpha/nvidia_tacotron2_LJ11_epoch3200-<sha256>.pt
Source: https://pytorch.org/docs/stable/hub.html#torch.hub.load_state_dict_from_url