How to convert trained model to ONNX in neosr?

#1
by iamisha - opened

I have trained the model using the pretrain [ Phips/4xmssim_realplksr_dysample_pretrain ]

I used neosr to train the model:
[network_g]
type = "realplksr"
#type = "realplksr_s"
#type = "realplksr_l"
dysample = true

(neosr) (neosr) C:\Users\rrmah\neosr>uv run --isolated convert.py --input "C:\Users\rrmah\Desktop\100k_iteration\modals\net_g_100000.pth" -net realplksr -s 4 -static 3 128 128 --output model.onnx
Installed 36 packages in 7.69s

-------- Attempting to build network [realplksr].
-------- Finding parameter key...
Traceback (most recent call last):
File "C:\Users\rrmah\neosr\convert.py", line 297, in
to_onnx()
File "C:\Users\rrmah\neosr\convert.py", line 169, in to_onnx
model = load_net()
^^^^^^^^^^
File "C:\Users\rrmah\neosr\convert.py", line 116, in load_net
net.load_state_dict(load_net, strict=True) # type: ignore[reportAttributeAccessIssue,attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rrmah\AppData\Local\uv\cache\builds-v0.tmpUNXFfG\Lib\site-packages\torch\nn\modules\module.py", line 2581, in load_state_dict
raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for realplksr:
Unexpected key(s) in state_dict: "to_img.init_pos", "to_img.end_conv.weight", "to_img.end_conv.bias", "to_img.offset.weight", "to_img.offset.bias", "to_img.scope.weight".

Sign up or log in to comment