Hi, I found that
pretrained_fnames as input while
model.load_state_dict in strict mode.
So my suggestions are
- support pretrained_fnames in RNNLearner.classifier
model.load_state_dict with strict=False
model.load_state_dict is always called on strict mode throughout the library, so I don’t see why we should change it there.
Also I’m unsure why we would want to directly pass the pretrained weights without the fine-tuning step before. That doesn’t sound like good practice in general. With an
RNNLearner.classifier you are supposed to load the encoder from a previously fine-tuned model, so maybe adding an argument pretrained_encoder would be more interesting.
Maybe I misunderstood thnigs.
What I tried to do was load weights from finetuned saved LM model files.
In this case you want to use
learn.load_encoder(name) where name has been previously saved with
The docs have a fully working example.