Comments (7)
你好,需要仿照unimatch.py
里对model用DDP wrap一下再load_state_dict:
model = DeepLabV3Plus(cfg)
model.cuda()
model = torch.nn.parallel.DistributedDataParallel(model, device_ids=[local_rank], broadcast_buffers=False,
output_device=local_rank, find_unused_parameters=False)
model.load_state_dict(checkpoint['model'])
from unimatch.
您好,出现了一个新的问题:
似乎是单卡加载分布式训练模型时,所存的模型需要为:model.module.state_dict()
我注意到最初版本的代码里存模型时用的是model.module.state_dict(),当前版本用的是model.state_dict()
from unimatch.
如果是以model.state_dict()直接保存的(state_dict的keys里包含"module"),那需要DDP wrap一下再load;如果是以model.module.state_dict()保存的(state_dict的keys里不包含"module"),那可以直接load。上面这个报错是你没有配置DDP,可以仿照unimatch.py
里设置一下:
Line 40 in bb3af6c
from unimatch.
您好,添加上述之后:
出现错误:
from unimatch.
需要加上这个:
Line 28 in bb3af6c
另外注意启动方式也使用train.sh里的
from unimatch.
感谢您的解答,这似乎绕回到分布式构建模型,但是指定了单卡。我将torch.nn.parallel.DistributedDataParallel替换为torch.nn.DataParallel解决了此问题,能够直接启动。
谢谢您的耐心指点,祝科研顺利~
from unimatch.
好的~
from unimatch.
Related Issues (20)
- 关于医学图像分割场景下的结果 HOT 4
- Image-level Perturbations in LEVIR HOT 1
- Pascal Voc 数据集的checkpoint HOT 19
- 关于特征空间扰动 HOT 4
- 关于第四页的Algorithm 1 HOT 2
- Question about the batch size
- Reproducability of PASCAL VOC HQ dataset results HOT 4
- 关于在Transformer系列模型使用 HOT 2
- Can't find Resnet 101
- How much memory its necessary? HOT 1
- 轻量级backbone及训练问题 HOT 1
- Question about crop size HOT 2
- 关于sliding_window HOT 1
- 复现训练代码
- 256×256的分辨率需要多少的GPU运行内存 HOT 1
- 评估和可视化代码 HOT 2
- color_map function in the utils.py file HOT 1
- Minor Typo HOT 1
- 关于自己数据集的问题 HOT 2
- 关于您该项目的实验 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unimatch.