Comments (4)
Thanks, that helped :) I was able to change line 55 in inference.py to
state_dict = torch.load(flowtron_path, map_location='cpu')["model"].state_dict()
and that allowed me to use the checkpoint.
Perhaps some code which tries the current method and, if the key state_dict is not found, tries this instead, would be a good addition to inference.py?
from flowtron.
The pretrained Waveglow model files contain the entire model. Use smth like this in the inference.py file:
m = torch.load(flowtron_path, map_location='cpu') state_dict = m['model'].state_dict() model.load_state_dict(state_dict)
Or a more general solution, as in train.py
: https://github.com/NVIDIA/flowtron/blob/master/train.py#L82
from flowtron.
from flowtron.
Thanks, that helped :) I was able to change line 55 in inference.py to
state_dict = torch.load(flowtron_path, map_location='cpu')["model"].state_dict()
and that allowed me to use the checkpoint.
Perhaps some code which tries the current method and, if the key state_dict is not found, tries this instead, would be a good addition to inference.py?
I was trying to use a Flowtron checkpoint and run into the same issue. Unfortunately your fix didn't work for me:
Traceback (most recent call last):
File "inference.py", line 140, in <module>
args.id, args.n_frames, args.sigma, args.gate, args.seed)
File "inference.py", line 63, in infer
model.load_state_dict(state_dict)
File "/home/serguei/anaconda3/envs/flowtron/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1052, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Flowtron:
size mismatch for speaker_embedding.weight: copying a param with shape torch.Size([123, 128]) from checkpoint, the shape in current model is torch.Size([1, 128]).
However, I was able to fix it by doing this:
model_on_disk = torch.load(flowtron_path, map_location='cpu')
if 'state_dict' in model_on_disk:
state_dict = model_on_disk['state_dict']
model.load_state_dict(state_dict)
elif 'model' in model_on_disk:
model = model_on_disk['model'].cuda()
else:
assert False, "cannot load model!"
from flowtron.
Related Issues (20)
- Inference starting repeat itself. HOT 5
- List index out of range
- Request for clarification on some of the readme scripts. HOT 8
- Custom model resumed from pre-trained model has a stuttering problem.
- How would one keep the model loaded for immediate synthesis? HOT 17
- Inference on pre-trained model (flowtron_ljs) speaking nonsense. HOT 4
- Inference Demo "Hitting gate limit" HOT 2
- .
- inference speed on CPU
- Accelerated inference with TensorRT HOT 2
- Single word input leads to ValueError: Expected more than 1 spatial element when training, got input size torch.Size([1, 512, 1]) HOT 1
- Error on loading training model "_pickle.UnpicklingError: invalid load key, '<'"
- Custom trained model and dataset problem
- Index out of range for custom dataset.
- value error while training custom dataset
- TypeError: guvectorize() missing 1 required positional argument 'signature' HOT 1
- _pickle.UnpicklingError: invalid load key, '<'. in inference.py in colab HOT 3
- What's the filelist used to train LibriTTS2k pretrained embedding?
- Unable to train on custom data with multiple speakers HOT 6
- Which torch version to use?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flowtron.