internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ycm-core/ycmd

Issue:
Not compatible with virtualenv.
I use a Mac machine and created a python virtual environment use virtualenv on `~/pyvenv`, so the  `sys.exec_prefix` is `'~/pyvenv/bin/..'`

When I run install.py in virtualenv, the `FindPythonLibrariesOnMac()` function expect to find the python library  `~/pyvenv/lib/libpython2.7.dylib`, it seems that virtualenv not made the symlink, so the script  report "unable to find an appropriate Python library", and I have to manual add this link.

Prior version of ycmd could find correct path of python library, so keep the original behaviour when FindPythonLibraries\* functions find nothing may be a better choice for backward compatibility.



Discussion:

Resolving patch:
diff --git a/build.py b/build.py
--- a/build.py
+++ b/build.py
@@ -7,6 +7,7 @@
 from __future__ import division
 from __future__ import absolute_import
 
+from distutils import sysconfig
 from shutil import rmtree
 from tempfile import mkdtemp
 import errno
@@ -144,15 +145,16 @@ def GetPythonNameOnUnix():
   return python_name
 
 
-def GetStandardPythonLocationsOnUnix( prefix, name ):
-  return ( '{0}/lib/lib{1}'.format( prefix, name ),
-           '{0}/include/{1}'.format( prefix, name ) )
+def GetStandardPythonLocationsOnUnix( name ):
+  library_dir = sysconfig.get_config_var( 'LIBDIR' )
+  include_dir = sysconfig.get_config_var( 'INCLUDEDIR' )
+  return p.join( library_dir, 'lib' + name ), p.join( include_dir, name )
 
 
 def FindPythonLibrariesOnLinux():
   python_name = GetPythonNameOnUnix()
   python_library_root, python_include = GetStandardPythonLocationsOnUnix(
-    sys.exec_prefix, python_name )
+    python_name )
 
   python_library = python_library_root + '.so'
   if p.isfile( python_library ):
@@ -177,15 +179,9 @@ def FindPythonLibrariesOnLinux():
 
 
 def FindPythonLibrariesOnMac():
-  python_prefix = sys.exec_prefix
-
-  python_library = p.join( python_prefix, 'Python' )
-  if p.isfile( python_library ):
-    return python_library, p.join( python_prefix, 'Headers' )
-
   python_name = GetPythonNameOnUnix()
   python_library_root, python_include = GetStandardPythonLocationsOnUnix(
-    python_prefix, python_name )
+    python_name )
 
   # On MacOS, ycmd does not work with statically linked python library.
   # It typically manifests with the following error when there is a
@@ -220,12 +216,13 @@ def FindPythonLibrariesOnMac():
 
 
 def FindPythonLibrariesOnWindows():
-  python_prefix = sys.exec_prefix
   python_name = 'python' + str( PY_MAJOR ) + str( PY_MINOR )
 
-  python_library = p.join( python_prefix, 'libs', python_name + '.lib' )
+  python_include = sysconfig.get_config_var( 'INCLUDEPY' )
+  python_library = p.join(
+    p.dirname( python_include ), 'libs', python_name + '.lib' )
   if p.isfile( python_library ):
-    return python_library, p.join( python_prefix, 'include' )
+    return python_library, python_include
 
   sys.exit( NO_PYTHON_LIBRARY_ERROR )
 


Test patch:
Repository: ycm-core/ycmd

Issue:
Update package.json ...ycmd/third_party/tern_runtime/package.json
This tool is indispensable for **JS/node autocomplete**

The latest version of **tern.js is 0.19** 



Discussion:

Resolving patch:
diff --git a/build.py b/build.py
--- a/build.py
+++ b/build.py
@@ -427,7 +427,7 @@ def SetUpTern():
   # node_modules of the Tern runtime.  We also want to be able to install our
   # own plugins to improve the user experience for all users.
   #
-  # This is not possible if we use a git submodle for Tern and simply run 'npm
+  # This is not possible if we use a git submodule for Tern and simply run 'npm
   # install' within the submodule source directory, as subsequent 'npm install
   # tern-my-plugin' will (heinously) install another (arbitrary) version of Tern
   # within the Tern source tree (e.g. third_party/tern/node_modules/tern. The
@@ -438,19 +438,7 @@ def SetUpTern():
   # So instead, we have a package.json within our "Tern runtime" directory
   # (third_party/tern_runtime) that defines the packages that we require,
   # including Tern and any plugins which we require as standard.
-  TERN_RUNTIME_DIR = os.path.join( DIR_OF_THIS_SCRIPT,
-                                   'third_party',
-                                   'tern_runtime' )
-  try:
-    os.makedirs( TERN_RUNTIME_DIR )
-  except Exception:
-    # os.makedirs throws if the dir already exists, it also throws if the
-    # permissions prevent creating the directory. There's no way to know the
-    # difference, so we just let the call to os.chdir below throw if this fails
-    # to create the target directory.
-    pass
-
-  os.chdir( TERN_RUNTIME_DIR )
+  os.chdir( p.join( DIR_OF_THIS_SCRIPT, 'third_party', 'tern_runtime' ) )
   subprocess.check_call( [ paths[ 'npm' ], 'install', '--production' ] )
 
 


Test patch:
Repository: ycm-core/ycmd

Issue:
Processing .ycm_extra_conf.py creates __pycache__ directory
I'm not sure if this is the intended behaviour. When YCM reads configuration creates a compiled version in `__pycache__`. I know that this behaviour can be disabled passing to `python` the `-B` argument or setting `PYTHONDONTWRITEBYTECODE=1` environmental variable. I don't want to disable global bytecode generation but I want to disable for `.ycm_extra_conf.py` because I feel it pollutes my project directory. 

Is there a easy/reliable way to disable it in the YCM config?



Discussion:
We could disable the compiled version with [the `sys.dont_write_bytecode` variable](https://docs.python.org/3/library/sys.html#sys.dont_write_bytecode) before loading the `.ycm_extra_conf.py` file then re-enable it just after. Seems to work in my tests.

I don't think we should add an option for that. Instead, we should always disable it as the only benefit of the compiled version is to improve loading time by skipping the compilation step but in practice the time to compile a `.ycm_extra_conf.py` file is negligible (~8ms for YCM's `.ycm_extra_conf.py` file) and is only done once by editing session.


Resolving patch:
diff --git a/ycmd/extra_conf_store.py b/ycmd/extra_conf_store.py
--- a/ycmd/extra_conf_store.py
+++ b/ycmd/extra_conf_store.py
@@ -146,7 +146,21 @@ def Load( module_file, force = False ):
   # anymore, but there are a lot of old ycm_extra_conf.py files that we don't
   # want to break.
   sys.path.insert( 0, _PathToCppCompleterFolder() )
-  module = LoadPythonSource( _RandomName(), module_file )
+
+  # By default, the Python interpreter compiles source files into bytecode to
+  # load them faster next time they are run. These *.pyc files are generated
+  # along the source files prior to Python 3.2 or in a __pycache__ folder for
+  # newer versions. We disable the generation of these files when loading
+  # ycm_extra_conf.py files as users do not want them inside their projects.
+  # The drawback is negligible since ycm_extra_conf.py files are generally small
+  # files thus really fast to compile and only loaded once by editing session.
+  old_dont_write_bytecode = sys.dont_write_bytecode
+  sys.dont_write_bytecode = True
+  try:
+    module = LoadPythonSource( _RandomName(), module_file )
+  finally:
+    sys.dont_write_bytecode = old_dont_write_bytecode
+
   del sys.path[ 0 ]
 
   with _module_for_module_file_lock:


Test patch:
Repository: pytorch/examples

Issue:
Division error
Training a model for `fast-neural-style` raises a RuntimeError from variable division during input normalization. 

- python2.7
- torch==0.1.12.post2
- torchvision==0.1.8

````
Traceback (most recent call last):
  File "neural_style/neural_style.py", line 226, in <module>
    main()
  File "neural_style/neural_style.py", line 220, in main
    train(args)
  File "neural_style/neural_style.py", line 65, in train
    style_v = utils.normalize_batch(style_v)
  File "/home/paperspace/embro/neural_style/utils.py", line 42, in normalize_batch
    batch /= Variable(std)
  File "/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py", line 793, in __idiv__
    return self.div_(other)
  File "/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py", line 323, in div_
    raise RuntimeError("div_ only supports scalar multiplication")
````





Discussion:

Resolving patch:
diff --git a/fast_neural_style/neural_style/utils.py b/fast_neural_style/neural_style/utils.py
--- a/fast_neural_style/neural_style/utils.py
+++ b/fast_neural_style/neural_style/utils.py
@@ -39,5 +39,5 @@ def normalize_batch(batch):
     std[:, 2, :, :] = 0.225
     batch = torch.div(batch, 255.0)
     batch -= Variable(mean)
-    batch /= Variable(std)
+    batch = batch / Variable(std)
     return batch


Test patch:
Repository: pytorch/examples

Issue:
[super_resolution]
def _get_orthogonal_init_weights(weights):
    fan_out = weights.size(0)
    fan_in = weights.size(1) * weights.size(2) * weights.size(3)
    u, _, v = svd(normal(0.0, 1.0, (fan_out, fan_in)), full_matrices=False)
    if u.shape == (fan_out, fan_in):
        return torch.Tensor(u.reshape(weights.size()))
    else:
        return torch.Tensor(v.reshape(weights.size()))

Why do the above operation？


Discussion:
I have the same question,did u solved that?

Resolving patch:
diff --git a/super_resolution/model.py b/super_resolution/model.py
--- a/super_resolution/model.py
+++ b/super_resolution/model.py
@@ -1,22 +1,11 @@
 import torch
 import torch.nn as nn
+import torch.nn.init as init
 from numpy.random import normal
 from numpy.linalg import svd
 from math import sqrt
 
 
-def _get_orthogonal_init_weights(weights):
-    fan_out = weights.size(0)
-    fan_in = weights.size(1) * weights.size(2) * weights.size(3)
-
-    u, _, v = svd(normal(0.0, 1.0, (fan_out, fan_in)), full_matrices=False)
-
-    if u.shape == (fan_out, fan_in):
-        return torch.Tensor(u.reshape(weights.size()))
-    else:
-        return torch.Tensor(v.reshape(weights.size()))
-
-
 class Net(nn.Module):
     def __init__(self, upscale_factor):
         super(Net, self).__init__()
@@ -38,7 +27,7 @@ def forward(self, x):
         return x
 
     def _initialize_weights(self):
-        self.conv1.weight.data.copy_(_get_orthogonal_init_weights(self.conv1.weight) * sqrt(2))
-        self.conv2.weight.data.copy_(_get_orthogonal_init_weights(self.conv2.weight) * sqrt(2))
-        self.conv3.weight.data.copy_(_get_orthogonal_init_weights(self.conv3.weight) * sqrt(2))
-        self.conv4.weight.data.copy_(_get_orthogonal_init_weights(self.conv4.weight))
+        init.orthogonal(self.conv1.weight, init.gain('relu'))
+        init.orthogonal(self.conv2.weight, init.gain('relu'))
+        init.orthogonal(self.conv3.weight, init.gain('relu'))
+        init.orthogonal(self.conv4.weight)


Test patch:
Repository: pytorch/examples

Issue:
Imagenet example broken
Looks like the following lines got deleted

```python3
model_names = sorted(name for name in models.__dict__
    if name.islower() and not name.startswith("__")
    and callable(models.__dict__[name]))
```

Causing an undefined variable error.

```bash
Traceback (most recent call last):
  File "main.py", line 25, in <module>
    choices=model_names,
NameError: name 'model_names' is not defined
```


Discussion:

Resolving patch:
diff --git a/imagenet/main.py b/imagenet/main.py
--- a/imagenet/main.py
+++ b/imagenet/main.py
@@ -15,6 +15,9 @@
 import torchvision.datasets as datasets
 import torchvision.models as models
 
+model_names = sorted(name for name in models.__dict__
+    if name.islower() and not name.startswith("__")
+    and callable(models.__dict__[name]))
 
 parser = argparse.ArgumentParser(description='PyTorch ImageNet Training')
 parser.add_argument('data', metavar='DIR',


Test patch:
Repository: pytorch/examples

Issue:
VAE loss
According to the expression in line 95, the KL-divergence term is calculated from
`0.5 * sum(1 + log(sigma^2) - mu^2 - sigma^2)`
but I think the code in line 96-97 represents
`0.5 * sum(1 + log(sigma^2) - mu^2 - sigma)`

This might not be essential because whether the last term is squared or not, the loss descending behavior stays unchanged.


Discussion:

Resolving patch:
diff --git a/vae/main.py b/vae/main.py
--- a/vae/main.py
+++ b/vae/main.py
@@ -4,6 +4,7 @@
 import torch.utils.data
 from torch import nn, optim
 from torch.autograd import Variable
+from torch.nn import functional as F
 from torchvision import datasets, transforms
 from torchvision.utils import save_image
 
@@ -77,18 +78,15 @@ def forward(self, x):
 if args.cuda:
     model.cuda()
 
-reconstruction_function = nn.BCELoss()
-
 
 def loss_function(recon_x, x, mu, logvar):
-    BCE = reconstruction_function(recon_x, x.view(-1, 784))
+    BCE = F.binary_cross_entropy(recon_x, x.view(-1, 784))
 
     # see Appendix B from VAE paper:
     # Kingma and Welling. Auto-Encoding Variational Bayes. ICLR, 2014
     # https://arxiv.org/abs/1312.6114
     # 0.5 * sum(1 + log(sigma^2) - mu^2 - sigma^2)
-    KLD_element = mu.pow(2).add_(logvar.exp()).mul_(-1).add_(1).add_(logvar)
-    KLD = torch.sum(KLD_element).mul_(-0.5)
+    KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())
     # Normalise by same number of elements as in reconstruction
     KLD /= args.batch_size * 784
 
@@ -131,8 +129,11 @@ def test(epoch):
         recon_batch, mu, logvar = model(data)
         test_loss += loss_function(recon_batch, data, mu, logvar).data[0]
         if i == 0:
-          save_image(recon_batch.data.cpu().view(args.batch_size, 1, 28, 28),
-                     'reconstruction_' + str(epoch) + '.png')
+          n = min(data.size(0), 8)
+          comparison = torch.cat([data[:n],
+                                  recon_batch.view(args.batch_size, 1, 28, 28)[:n]])
+          save_image(comparison.data.cpu(),
+                     'results/reconstruction_' + str(epoch) + '.png', nrow=n)
 
     test_loss /= len(test_loader.dataset)
     print('====> Test set loss: {:.4f}'.format(test_loss))
@@ -145,4 +146,5 @@ def test(epoch):
     if args.cuda:
        sample = sample.cuda()
     sample = model.decode(sample).cpu()
-    save_image(sample.data.view(64, 1, 28, 28), 'sample_' + str(epoch) + '.png')
+    save_image(sample.data.view(64, 1, 28, 28),
+               'results/sample_' + str(epoch) + '.png')


Test patch:
Repository: pytorch/examples

Issue:
Unused import of math in time_sequence_prediction example
The generate_sine_wave.py module imports math on the first line, but doesn't use it. This import should be removed.


Discussion:

Resolving patch:
diff --git a/time_sequence_prediction/generate_sine_wave.py b/time_sequence_prediction/generate_sine_wave.py
--- a/time_sequence_prediction/generate_sine_wave.py
+++ b/time_sequence_prediction/generate_sine_wave.py
@@ -1,12 +1,13 @@
-import math
 import numpy as np
 import torch
+
+np.random.seed(2)
+
 T = 20
 L = 1000
 N = 100
-np.random.seed(2)
+
 x = np.empty((N, L), 'int64')
-x[:] = np.array(range(L)) + np.random.randint(-4*T, 4*T, N).reshape(N, 1)
+x[:] = np.array(range(L)) + np.random.randint(-4 * T, 4 * T, N).reshape(N, 1)
 data = np.sin(x / 1.0 / T).astype('float64')
 torch.save(data, open('traindata.pt', 'wb'))
-


Test patch:
Repository: pytorch/examples

Issue:
Syntax error when running imagenet main.py
I got the following syntax error while running imagenet main.py
Command used: 
```
% python main.py --help
```
*Error* :
```
  File "main.py", line 300
    progress.print(i)
                 ^
SyntaxError: invalid syntax
```

I'm using python 2.7 with pytorch built from source.


Discussion:
This is an error that appears only for Py2 and not for Py3. Can someone please fix it so we can run benchmarks on both Py2 and Py3 like the earlier version did? To be clear, this is a regression in functionality.
this is so weird, i cant see why this is not Py2 syntax.

Does it help to add at the top of the file  `from __future__ import print_function` ?
That seems to have fixed this particular error, although the script now errors out on line 377:
```
root@9b47a454adcf:/data/pytorch_examples_latest/imagenet# python main.py 
  File "main.py", line 377
    def __init__(self, num_batches, *meters, prefix=""):
                                                  ^
SyntaxError: invalid syntax
```
@soumith I think I've introduced this with #529. But, just like you, I have no idea why this is a problem.

Resolving patch:
diff --git a/imagenet/main.py b/imagenet/main.py
--- a/imagenet/main.py
+++ b/imagenet/main.py
@@ -261,8 +261,10 @@ def train(train_loader, model, criterion, optimizer, epoch, args):
     losses = AverageMeter('Loss', ':.4e')
     top1 = AverageMeter('Acc@1', ':6.2f')
     top5 = AverageMeter('Acc@5', ':6.2f')
-    progress = ProgressMeter(len(train_loader), batch_time, data_time, losses, top1,
-                             top5, prefix="Epoch: [{}]".format(epoch))
+    progress = ProgressMeter(
+        len(train_loader),
+        [batch_time, data_time, losses, top1, top5],
+        prefix="Epoch: [{}]".format(epoch))
 
     # switch to train mode
     model.train()
@@ -296,7 +298,7 @@ def train(train_loader, model, criterion, optimizer, epoch, args):
         end = time.time()
 
         if i % args.print_freq == 0:
-            progress.print(i)
+            progress.display(i)
 
 
 def validate(val_loader, model, criterion, args):
@@ -332,7 +334,7 @@ def validate(val_loader, model, criterion, args):
             end = time.time()
 
             if i % args.print_freq == 0:
-                progress.print(i)
+                progress.display(i)
 
         # TODO: this should also be done with the ProgressMeter
         print(' * Acc@1 {top1.avg:.3f} Acc@5 {top5.avg:.3f}'
@@ -372,12 +374,12 @@ def __str__(self):
 
 
 class ProgressMeter(object):
-    def __init__(self, num_batches, *meters, prefix=""):
+    def __init__(self, num_batches, meters, prefix=""):
         self.batch_fmtstr = self._get_batch_fmtstr(num_batches)
         self.meters = meters
         self.prefix = prefix
 
-    def print(self, batch):
+    def display(self, batch):
         entries = [self.prefix + self.batch_fmtstr.format(batch)]
         entries += [str(meter) for meter in self.meters]
         print('\t'.join(entries))


Test patch:
Repository: pytorch/examples

Issue:
dcgan fails on "fake" dataset
I have been using the dcgan example as a stress test for a machine. To save time, I have made use of the `fake` dataset.

`python main.py --dataset 'fake'` fails because `dataroot` is a required parameter. However, the `fake` dataset, does not need such information.


Discussion:

Resolving patch:
diff --git a/dcgan/main.py b/dcgan/main.py
--- a/dcgan/main.py
+++ b/dcgan/main.py
@@ -15,7 +15,7 @@
 
 parser = argparse.ArgumentParser()
 parser.add_argument('--dataset', required=True, help='cifar10 | lsun | mnist |imagenet | folder | lfw | fake')
-parser.add_argument('--dataroot', required=True, help='path to dataset')
+parser.add_argument('--dataroot', required=False, help='path to dataset')
 parser.add_argument('--workers', type=int, help='number of data loading workers', default=2)
 parser.add_argument('--batchSize', type=int, default=64, help='input batch size')
 parser.add_argument('--imageSize', type=int, default=64, help='the height / width of the input image to network')
@@ -51,6 +51,9 @@
 
 if torch.cuda.is_available() and not opt.cuda:
     print("WARNING: You have a CUDA device, so you should probably run with --cuda")
+  
+if opt.dataroot is None and str(opt.dataset).lower() != 'fake':
+    raise ValueError("`dataroot` parameter is required for dataset \"%s\"" % opt.dataset)
 
 if opt.dataset in ['imagenet', 'folder', 'lfw']:
     # folder dataset


Test patch:
Repository: pytorch/examples

Issue:
two lines of code in mnist/main.py
There are two arguments called batch_size and test_batch_size:
`parser.add_argument('--batch-size', type=int, default=64, metavar='N',
                    help='input batch size for training (default: 64)')`
`parser.add_argument('--test-batch-size', type=int, default=1000, metavar='N',
                    help='input batch size for testing (default: 1000)')`
but batch_size is used here:
`test_loader = torch.utils.data.DataLoader(
    datasets.MNIST('../data', train=False, transform=transforms.Compose([
                       transforms.ToTensor(),
                       transforms.Normalize((0.1307,), (0.3081,))
                   ])),
    batch_size=args.batch_size, shuffle=True, **kwargs)`

Also, what does this line(line 105) do:
`test_loss = test_loss`

and it seems that `epoch` is not used in test().


Discussion:

Resolving patch:
diff --git a/mnist/main.py b/mnist/main.py
--- a/mnist/main.py
+++ b/mnist/main.py
@@ -100,12 +100,14 @@ def main():
 
     device = torch.device("cuda" if use_cuda else "cpu")
 
-    kwargs = {'batch_size': args.batch_size}
+    train_kwargs = {'batch_size': args.batch_size}
+    test_kwargs = {'batch_size': args.test_batch_size}
     if use_cuda:
-        kwargs.update({'num_workers': 1,
+        cuda_kwargs = {'num_workers': 1,
                        'pin_memory': True,
-                       'shuffle': True},
-                     )
+                       'shuffle': True}
+        train_kwargs.update(cuda_kwargs)
+        test_kwargs.update(cuda_kwargs)
 
     transform=transforms.Compose([
         transforms.ToTensor(),
@@ -115,8 +117,8 @@ def main():
                        transform=transform)
     dataset2 = datasets.MNIST('../data', train=False,
                        transform=transform)
-    train_loader = torch.utils.data.DataLoader(dataset1,**kwargs)
-    test_loader = torch.utils.data.DataLoader(dataset2, **kwargs)
+    train_loader = torch.utils.data.DataLoader(dataset1,**train_kwargs)
+    test_loader = torch.utils.data.DataLoader(dataset2, **test_kwargs)
 
     model = Net().to(device)
     optimizer = optim.Adadelta(model.parameters(), lr=args.lr)


Test patch:
Repository: pytorch/examples

Issue:
Typo
https://github.com/pytorch/examples/blob/4db11160c21d0e26634ca1fcb94a73ad8d870ba7/snli/train.py#L122

`validation` instead of `valiation`


Discussion:

Resolving patch:
diff --git a/snli/train.py b/snli/train.py
--- a/snli/train.py
+++ b/snli/train.py
@@ -119,7 +119,7 @@
                 epoch, iterations, 1+batch_idx, len(train_iter),
                 100. * (1+batch_idx) / len(train_iter), loss.item(), dev_loss.item(), train_acc, dev_acc))
 
-            # update best valiation set accuracy
+            # update best validation set accuracy
             if dev_acc > best_dev_acc:
 
                 # found a model with better validation set accuracy


Test patch:
Repository: pytorch/examples

Issue:
Inconsistent batch size calculation and description in imagenet main.py
https://github.com/pytorch/examples/blob/b9f3b2ebb9464959bdbf0c3ac77124a704954828/imagenet/main.py#L146-L149

As above shown,  `batch_size` should be adjusted by *total number of GPUs we have*, which should be equivalent to `world_size` rather than `ngpus_per_node` according to the comments.

However, the description of `--batch-size` says it's only the sum batch size of one node as follows.

https://github.com/pytorch/examples/blob/b9f3b2ebb9464959bdbf0c3ac77124a704954828/imagenet/main.py#L39-L43

Different description seems a bit confusing when trying to keep the same batch size on single GPU between test across nodes and within one node.


Discussion:
@yzs981130 would you like to make a PR for this fix?

Resolving patch:
diff --git a/imagenet/main.py b/imagenet/main.py
--- a/imagenet/main.py
+++ b/imagenet/main.py
@@ -148,7 +148,7 @@ def main_worker(gpu, ngpus_per_node, args):
             model.cuda(args.gpu)
             # When using a single GPU per process and per
             # DistributedDataParallel, we need to divide the batch size
-            # ourselves based on the total number of GPUs we have
+            # ourselves based on the total number of GPUs of the current node.
             args.batch_size = int(args.batch_size / ngpus_per_node)
             args.workers = int((args.workers + ngpus_per_node - 1) / ngpus_per_node)
             model = torch.nn.parallel.DistributedDataParallel(model, device_ids=[args.gpu])


Test patch: