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

Problems with flowtron_libritts2p3k #126

Open
AI-Guru opened this issue Jul 28, 2021 · 3 comments
Open

Problems with flowtron_libritts2p3k #126

AI-Guru opened this issue Jul 28, 2021 · 3 comments

Comments

@AI-Guru
Copy link

AI-Guru commented Jul 28, 2021

Hello!

I am very happy with Flowtron! I tested the flowtron_ljs model and it worked like a charm!

But when using the other two models, I run into problems. For example flowtron_libritts2p3k.

python inference.py -c config.json -f models/flowtron_libritts2p3k.pt -w models/waveglow_256channels_universal_v5.pt -t "I’ve seen things you people wouldn’t believe." -i 0

Gives me this output:

Traceback (most recent call last):
  File "inference.py", line 130, in <module>
    infer(args.flowtron_path, args.waveglow_path, args.output_dir, args.text,
  File "inference.py", line 53, in infer
    state_dict = torch.load(flowtron_path, map_location='cpu')['state_dict']
KeyError: 'state_dict'

Any ideas?

@rafaelvalle
Copy link
Contributor

take a look at the keys for flowtron_libritts2p3k.
i think we saved the model instead of just the state dict.
the code below should solve your issue.

ck = torch.load(flowtron_path, map_location='cpu')
if 'model' in ck:
  state_dict = ck['model'].state_dict()
else:
    state_dict = ck['state_dict']

@Syed044
Copy link

Syed044 commented Aug 11, 2021

KeyError Traceback (most recent call last)
in
1 model_path = "models/model_10100"
----> 2 state_dict = torch.load(model_path, map_location='cpu')['state_dict']
3 model = Flowtron(**model_config)
4 model.load_state_dict(state_dict)
5 _ = model.eval().cuda()

KeyError: 'state_dict'

what do i do about this error?

and Please rafael or anyone who drop in to help, I am a newbee so please explain in easy way.

@AI-Guru
Copy link
Author

AI-Guru commented Aug 11, 2021

# load flowtron
    model = Flowtron(**model_config).cuda()
    checkpoint = torch.load(flowtron_path, map_location='cpu')
    if 'model' in checkpoint:
        state_dict = checkpoint['model'].state_dict()
    else:
        state_dict = checkpoint['state_dict']
    model.load_state_dict(state_dict)
    model.eval()
    model.cuda()
    print("Loaded checkpoint '{}')" .format(flowtron_path))

This should 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

3 participants