zhanghang1989 / PyTorch-Encoding

A CV toolkit for my papers.
https://hangzhang.org/PyTorch-Encoding/
MIT License
2.04k stars 452 forks source link

Question about DataParallelModel - too many values to unpack #378

Open SiminLi opened 3 years ago

SiminLi commented 3 years ago

Dear HangZhang, Thanks for your code! I was working on a multi-GPU version of my code, which is like:

model = CDCK2(xxx) model = encoding.parallel.DataParallelModel(model).cuda()

The model is something like h, z=model(x).

While running the model using encoding.parallel.DataParallelModel, it gives me an error of "too many values to unpack". I believe the error must be that the model returns multiple output from different GPUs. I'm not very familiar of data parallelism. Could you please share some hints on how to fix this?

SiminLi commented 3 years ago

Sorry, and there's another problem. I successfully build encoding in a conda environment and successfully import encoding at the terminal. However, after I use linux's screen or tmux, and activate the conda environment again, python reports "cannot import name 'cpu' from encoding". How can that happen?

Zerg-Overmind commented 2 years ago

I met the same problem

zhanghang1989 commented 2 years ago

Please use it together with DataParallelCriterion https://hangzhang.org/PyTorch-Encoding/parallel.html#dataparallelcriterion