Getting error to use Multiple GPU in pytorch

mmreza: <p>Hi, I am running my deep learning model using pytorch. When I am using single GUP, my model is running fine but facing problem using multiple GPU. I searched this problem in google and got idea to downgrade pytorch version 0.3.0. I don’t know where this is the way to rid of my problem or not. However I was trying to downgrade pytorch using<br>
pip install torch=0.3.0<br>
But getting error to install. Is there someone to help me to downgrade pytorch using pip.</p>
<p>I got below error during running multiple GPU:<br>
Exception NameError: “global name ‘FileNotFoundError’ is not defined” in &lt;bound method _DataLoaderIter.<strong>del</strong> of &lt;torch.utils.data.dataloader._DataLoaderIter object at 0x7fb3bbaba8d0&gt;&gt; ignored<br>
Traceback (most recent call last):<br>
File “train.py”, line 61, in <br>
Variable(data[‘image’]), Variable(data[‘feat’]), infer=save_fake)<br>
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 491, in <strong>call</strong><br>
result = self.forward(*input, **kwargs)<br>
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py”, line 114, in forward<br>
outputs = self.parallel_apply(replicas, inputs, kwargs)<br>
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py”, line 124, in parallel_apply<br>
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])<br>
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/parallel/parallel_apply.py”, line 65, in parallel_apply<br>
raise output<br>
TypeError: forward() takes at least 5 arguments (2 given)</p>

ptrblck: <p>I don’t think downgrading is an optimal solution. I would rather want to fix the issue using the latest release.<br>
Which PyTorch version are you currently using? If <code>&lt; 0.4.1</code>, could you update to it?</p>
<p>Also, could you share a bit of executable code so that we can have a look at this problem?</p>

mmreza: <p>Hi ptrblck, thanks for your quick reply. Earlier I was using torch 0.4.0. After getting your reply I updated it into torch 0.4.1 but facing the same problem.</p>
<p>Actually I am running pix2pixHD pytorch model for my image dataset. It run smoothly when I use single GPU but getting error if I want to use multiple GPU. My image size is big and having large dataset so I have to use multiple GPU to save time. Please help me to rid of this problem.</p>

ptrblck: <p>Could you post a small executable code snippet reproducing this error?<br>
This would make it easier to debug this issue.</p>

mmreza: <p>Here is the screen shot of the error.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/2/2ff7b9ff8656baa06765b4ece016849b35cf5f85.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ff7b9ff8656baa06765b4ece016849b35cf5f85" title="Screenshot%20from%202018-08-07%2017-33-36"><img src="https://discuss.pytorch.org/uploads/default/optimized/2X/2/2ff7b9ff8656baa06765b4ece016849b35cf5f85_2_690x387.png" alt="Screenshot%20from%202018-08-07%2017-33-36" data-base62-sha1="6QlbX9wG4nQ6omv4fl4l0RMr0ep" width="690" height="387" srcset="https://discuss.pytorch.org/uploads/default/optimized/2X/2/2ff7b9ff8656baa06765b4ece016849b35cf5f85_2_690x387.png, https://discuss.pytorch.org/uploads/default/optimized/2X/2/2ff7b9ff8656baa06765b4ece016849b35cf5f85_2_1035x580.png 1.5x, https://discuss.pytorch.org/uploads/default/original/2X/2/2ff7b9ff8656baa06765b4ece016849b35cf5f85.png 2x" data-dominant-color="3F1C33"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot%20from%202018-08-07%2017-33-36</span><span class="informations">1366×768 234 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

mmreza: <p>The above problem has solved. To see the error it seems the error come from torch but actually there was a limitation in pix2pixHD model and also for torch version 0.4.0.  Finally the model ran with multiple GPU after update torch version (0.4.1) and avoid model limitation.</p>

yjt2018: <aside class="quote no-group" data-username="mmreza" data-post="6" data-topic="22600">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmreza/48/6020_2.png" class="avatar"> mmreza:</div>
<blockquote>
<p>limitation in pix2pixHD model</p>
</blockquote>
</aside>
<p>I have get error to use Multiple GPU in pytorch when i train pix2pixHD，how to solve the limitation in pix2pixHD model？</p>