whl 大法好!

1
pip install torch==1.11.0+cu115 torchvision==0.12.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html

jupyter notebook 中的ipykernel内核是jupyter notebook的python,尽量还是使用系统环境中的默认内核。

1
2
3
4
5
>>> torch.save(bn.state_dict(), 'bn.pt')
>>> bn_state_dict = torch.load('bn.pt')
>>> new_bn = torch.nn.BatchNorm1d(3, track_running_stats=True)
>>> new_bn.load_state_dict(bn_state_dict)
<All keys matched successfully>

https://www.w3cschool.cn/article/79305038.html