shaltielshmid / TorchSharp.PyBridge

A library enabling easy transfer and handling of PyTorch models between .NET and Python environments
MIT License
14 stars 3 forks source link

UnpickleStateDict on BatchNorm2d error #13

Closed dongfangzhizhu closed 4 months ago

dongfangzhizhu commented 5 months ago

On BatchNorm2d ,the track_running_stats is default value true,by UnpickleStateDict function get num_batches_tracked is [1], type = Int64,this raise exception.But if convert pytorch_model.bin to pytorch_model.safetensors format,get num_batches_tracked is [], type = Int64,it' load right.

shaltielshmid commented 5 months ago

Thank you for pointing this out! I'll look into it.

shaltielshmid commented 5 months ago

Should be fixed with this commit: https://github.com/shaltielshmid/TorchSharp.PyBridge/commit/459d9c49d1451f668c55d88b273e6ccc24b85bdd

I added a release with this fix (version 1.3.2), and it should be available on NuGet shortly.

dongfangzhizhu commented 5 months ago

Thank you very much, your work has been very helpful to me。

Should be fixed with this commit: 459d9c4

I added a release with this fix (version 1.3.2), and it should be available on NuGet shortly.