Pytorch:state_dict

时间:2018-06-24 00:43:27

标签: pytorch

我尝试将pytorch模型转换为部署(ios),因此将模型转换为cafffe或Onnx(https://discuss.pytorch.org/t/typeerror-forward-missing-2-required-positional-arguments-cap-lens-and-hidden/20010/8)。我最初的错误是在lstm中只有“一层”,但是我遇到了另一个问题。

我尝试通过实例化一个称为text_encoder的新rnn对象来实现两层(nlayers = 2)

enter image description here

但是,我收到了state_dict内部缺少某些键的错误提示。仅有一层还没有发生此错误,但是在转换过程中确实出现了错误(https://discuss.pytorch.org/t/typeerror-forward-missing-2-required-positional-arguments-cap-lens-and-hidden/20010/8

我不确定这是否正在发生,因为我加载的模型只有一层或另一个问题。添加新图层时,如何恢复丢失的密钥?还是那不可能?原始帖子(https://discuss.pytorch.org/t/missing-key-s-in-state-dict/20154和(https://discuss.pytorch.org/t/typeerror-forward-missing-2-required-positional-arguments-cap-lens-and-hidden/20010/11

enter image description here

0 个答案:

没有答案
相关问题