当前位置:网站首页>Pytorch same structure different parameter name model loading weight
Pytorch same structure different parameter name model loading weight
2022-06-13 08:52:00 【Knife, kesselamo】
- Because the declared network model is better than the saved model bn One more parameter for layer
num_batches_tracked, So skip it
import torch, copy
net=yourNet()
state_dict = copy.deepcopy(net.state_dict())
keys=[]
for key in state_dict:
if(key.split('.')[-1] == 'num_batches_tracked'):
continue
keys.append(key)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
paras=torch.load('weights.pth', map_location=device)
for k1,k2 in zip(keys, paras):
state_dict[k1] = paras[k2]
边栏推荐
- [pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory
- output. Interpretation of topk() function
- Object array de encapsulation
- Namespace in TS (2)
- JS obtain geographic location information according to longitude and latitude and mark it on the map
- JS - for cycle case: Horse grain
- Problems in the deconstruction and assignment of objects, comparison between empty strings and undefined
- Container concept and cloud native
- useRoutes() may be used only in the context of a <Router> component.
- 网络安全漏洞分析之重定向漏洞分析
猜你喜欢

A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
![WARNING:tornado.access:404 GET /favicon.ico (172.16.8.1) 1.84ms [附静态文件设置]](/img/6d/6eef1f0ebcab45e9a209a3b6c62b03.png)
WARNING:tornado.access:404 GET /favicon.ico (172.16.8.1) 1.84ms [附静态文件设置]

CentOS installing MySQL and setting up remote access

Cesium displays a pop-up box at the specified position and moves with the map

Browser render passes

2020-12-28

2021-04-16

JS - simple ATM of the for cycle case

À propos des principes de chiffrement et de décryptage RSA

turf. JS usage
随机推荐
Web page H5 wechat sharing
Can I open an account for the reverse repurchase of treasury bonds? Can I directly open the security of securities companies on the app for the reverse repurchase of treasury bonds? How can I open an
JS obtain geographic location information according to longitude and latitude and mark it on the map
PHP wechat special merchant incoming V3 packaging interface
Explanation of JS event loop mechanism and asynchronous tasks
Cesium achieves sunny, rainy, foggy, snowy and other effects
Taobao commodity sales interface / Taobao commodity sales monitoring interface / cumulative commodity sales interface
2021-04-16
JS string method
Differences and uses among cookies, localstorage, sessionstorage, and application caching
A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
JS - print 99 multiplication table of the for cycle case
12. constructor explanation, explicit, initialization list
Review one flex knowledge point every day
Uni app subcontracting loading and optimization
4. Relationship selector (parent-child relationship, ancestor offspring relationship, brother relationship)
网上开户安全吗?新手可以开账户吗?
Namespace in TS (2)
Problems in the deconstruction and assignment of objects, comparison between empty strings and undefined
À propos des principes de chiffrement et de décryptage RSA