Hello everyone. when i save SGD optimizer using “torch::save(optimizer, “model-optimizer-checkpoint.pt”)”,
i got this error "
[W sgd.cpp:124] Warning: Your serialized SGD optimizer is still using the old serialization format. You should re-save your SGD optimizer to use the new serialization format. (function load)
terminate called after throwing an instance of ‘c10::Error’
what(): No such serialized tensor ‘momentum_buffers/size’
Exception raised from read at …/torch/csrc/api/src/serialize/input-archive.cpp:69 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) + 0x6b (0x7f02233dd05b in /home/modjo/dependencies/libtorch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0xbf (0x7f02233d7f6f in /home/modjo/dependencies/libtorch/lib/libc10.so)
frame #2: torch::serialize::InputArchive::read(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, at::Tensor&, bool) + 0xda (0x7f020ab9bcba in /home/modjo/dependencies/libtorch/lib/libtorch_cpu.so)
frame #3: + 0x514967e (0x7f020ab6767e in /home/modjo/dependencies/libtorch/lib/libtorch_cpu.so)
frame #4: torch::optim::SGD::load(torch::serialize::InputArchive&) + 0x19d (0x7f020ab94e0d in /home/modjo/dependencies/libtorch/lib/libtorch_cpu.so)
frame #5: torch::optim::operator>>(torch::serialize::InputArchive&, torch::optim::Optimizer&) + 0x31 (0x7f020ab872c1 in /home/modjo/dependencies/libtorch/lib/libtorch_cpu.so)
frame #6: ./build/train() [0x433a93]
frame #7: ./build/train() [0x4159dc]
frame #8: __libc_start_main + 0xf3 (0x7f02050cf493 in /lib64/libc.so.6)
frame #9: ./build/train() [0x41178e] "