jiebi/CodeConvo huggingface dataset:
Change:
I installed to get available, but the test run failed this way: Log: So it sounds like we need a specific MPI backend for the tests, any old one won't do. CC and
Hmm can you try removing ?
Thank you, It's work!
I am sorry and , how to remove --noprefix,,? should I reinstall the mpi using --prefix,,? thank you
It needs to be removed from the script
Thank you so much adam, I have solved it Sent from Mail for Windows 10

Discussion:
os.mkdir(os.path.join(tmp_dir, 'barrier')) os.mkdir(os.path.join(tmp_dir, 'test_dir')) if backend == 'mpi': <del> mpiexec = 'mpiexec -n 3 --noprefix {}'.format(python) </del> <ins> # test mpiexec for --noprefix option devnull = open(os.devnull, 'w') noprefix_opt = '--noprefix' if subprocess.call( 'mpiexec -n 1 --noprefix bash -c ""', shell=True, stdout=devnull, stderr=subprocess.STDOUT) == 0 else '' mpiexec = 'mpiexec -n 3 {} {}'.format(noprefix_opt, python) </ins> return_code = run_test(mpiexec, test_module, test_directory, options) else:
Change:
I am not able to build the current version. Getting the following error: pytorch/aten/src/TH/generic/THTensorLapack.c:860:7: warning: unused variable ‘n’ [-Wunused-variable] int n = ra-size[1]; ^ make[2]: [] Error 1 make[1]: [] Error 2 make: * [all] Error 2 I am using Anaconda as directed in the readme. I have created a conda environment and have set: export CMAKEPREFIXPATH="/u/anaconda2/envs/pyt4/" As specified here: Thanks
What you posted here is only a warning, and it won't stop the build. Please paste the full log into a GitHub gist and link it here
Hi, Here are the logs: I see it says Could NOT find CUDNN, I am installing it in an env which submit jobs to a cluster, do I need to install CUDNN locally?
what compiler do you have? and what OS are you using? The issue is this:
lsbrelease -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 7.2 (Maipo) Release: 7.2 Codename: Maipo uname -a Linux 1 SMP Thu Oct 29 17:29:29 EDT 2015 x8664 x8664 x8664 GNU/Linux
- We are seeing the same error above with the build scripts that you provided in , on PyTorch master. I can bisect and let you know the commit that is breaking the build.
The CPU build script fails with this commit () -
Got the same error when trying to compile under CentOS 7.2.1511 with GCC 4.8 and GCC 5.4 (no newer gcc available on that server).
CC
Searching issues for "PRId64" shows that this error popped up and has been fixed in various places in the pytorch codebase, e.g. The problem seems to be that this format specifier is not defined by default in C++ and/or old gcc versions. A hacky way to fix this is replacing with in the two files currently causing this error on master. A better way is to find the proper place for addding as described in the issue linked above.
Could you try and see if the branch in fixes the issue? I wasn't able to reproduce the compile error locally, but based on the past issues it should be the right fix. Thanks!
your branch compiles without error with GCC 5.4

Discussion:
#ifndef TH_GENERAL_INC #define TH_GENERAL_INC <ins> #define __STDC_FORMAT_MACROS </ins> #include <stdint.h> #include <stdlib.h> #include <stdio.h>
Change:
Hi! OS: Linux PyTorch version: 0.4.0a0+ How you installed PyTorch (conda, pip, source): source Python version: 3.6Context around what you are trying to do I am trying to convert layer with torch.indexselect() operation to onnx A script to reproduce the bug. Please try to provide as minimal of a test case as possible.Error messages and/or stack traces of the bug What is the right way to export torch.indexselect() operation?
It kind of sounds like we forgot to implement constant export, which is embarrassing and should be fixed.
Are there any chances it will be fixed soon?
I took a look, and actually, it's just a spurious warning, the model seems to export successfully into

Discussion:
return g.op("Undefined") <ins> def Constant(g, value): return g.op("Constant", value_t=value) </ins> def add(g, self, other, alpha): if _scalar(alpha) != 1: return _unimplemented("add", "alpha != 1")
Change:
I am installing PyTorch from source. Python version: 2.7.14. CUDA: 8.0. GPU: gtx1080. GCC: 5.4. Processor: AMD Opteron(tm) Processor 6128 While executing "python install" build completes till 87% but after that I get the following errors And many more messages of the same type regarding errors with 'PRId64' I looked at similar issues online and most of the people facing this issue had an old version of gcc, so I'm a bit confused about what my exact problem is. Also, when I'm installing via conda, the installation completes, but when I run the following bit of code, I get an illegal instruction at the print command That I guess is because of the fact I'm using an AMD processor? Any help will be appreciated. Thanks
looks like the same issue as

Discussion:
#ifndef TH_GENERAL_INC #define TH_GENERAL_INC <ins> #define __STDC_FORMAT_MACROS </ins> #include <stdint.h> #include <stdlib.h> #include <stdio.h>
Change:
I'm working on checkpointing in our nn trainer. When saving the state objects, I get an error: PicklingError: Can't pickle <type 'function': attribute lookup builtin.function failed I tracked it down to trying to save the scheduler ReduceLROnPlateau. I think the issue is due to the scheduler referencing the optimizer, which has to be saved with statedict(). I presume the same error will occur with other schedulers too. It seems like the problem could be solved by providing a statedict() and loadstatedict() in the scheduler classes. pytorch master rev (Jan 22) installed from source x86_64 on centos 7.4 cuda 9.0 cudnn 7 k80 gcc 5.4 python 2.7.14
The following script reproduces the crash: import torch import from import ReduceLROnPlateau if name == 'main': model = (10,10) optim = (model.parameters()) sched = ReduceLROnPlateau(optim, mode='max', factor=0.5) with open('','wb') as f: # Works # ((model.statedict(), optim.statedict()), f) # Crashes ((model.statedict(), optim.state_dict(), sched), f)

Discussion:
msg='LR is wrong in epoch {}: expected {}, got {}'.format( epoch, target[epoch], param_group['lr']), delta=1e-5) if __name__ == '__main__': run_tests()

import math from bisect import bisect_right <ins> from functools import partial </ins> from .optimizer import Optimizer

def in_cooldown(self): return self.cooldown_counter > 0 <del> def _init_is_better(self, mode, threshold, threshold_mode): if mode not in {'min', 'max'}: raise ValueError('mode ' + mode + ' is unknown!') if threshold_mode not in {'rel', 'abs'}: raise ValueError('threshold mode ' + threshold_mode + ' is unknown!') </del> <ins> def _cmp(self, mode, threshold_mode, threshold, a, best): </ins> if mode == 'min' and threshold_mode == 'rel': rel_epsilon = 1. - threshold <del> self.is_better = lambda a, best: a < best * rel_epsilon self.mode_worse = float('Inf') </del> <ins> return a < best * rel_epsilon </ins> elif mode == 'min' and threshold_mode == 'abs': <del> self.is_better = lambda a, best: a < best - threshold self.mode_worse = float('Inf') </del> <ins> return a < best - threshold </ins> elif mode == 'max' and threshold_mode == 'rel': rel_epsilon = threshold + 1. <del> self.is_better = lambda a, best: a > best * rel_epsilon self.mode_worse = -float('Inf') </del> <ins> return a > best * rel_epsilon </ins> else:  # mode == 'max' and epsilon_mode == 'abs': <del> self.is_better = lambda a, best: a > best + threshold self.mode_worse = -float('Inf') </del> <ins> return a > best + threshold def _init_is_better(self, mode, threshold, threshold_mode): if mode not in {'min', 'max'}: raise ValueError('mode ' + mode + ' is unknown!') if threshold_mode not in {'rel', 'abs'}: raise ValueError('threshold mode ' + threshold_mode + ' is unknown!') if mode == 'min': self.mode_worse = float('inf') else:  # mode == 'max': self.mode_worse = (-float('inf')) self.is_better = partial(self._cmp, mode, threshold_mode, threshold) </ins>
Change:
OS: MacOS Sierra PyTorch version: How you installed PyTorch (conda, pip, source): Just pulled the dockerfile I pulled the dockerfile just now and tried to build it using a tool that we plan on open-sourcing at some point. The command translates to a simple .
CC
It seems to work now.

Discussion:
<del> FROM nvidia/cuda:9.1-cudnn7-devel-ubuntu16.04 RUN echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list </del> <ins> FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 </ins> RUN apt-get update && apt-get install -y --no-install-recommends  build-essential
Change:
hi, I just saw this error in the last few days. both for GPU and CPU only environment. Is the test precision assertion correct ?
On PPC64 it looks like denormal flags aren't being set correctly. This PR from 2 days ago denormals support, but likely assumed only AMD64 / x86
currently the setflushdenormal call will always return False if on ppc64le. The unittest has a skipIf as below. I believe the intention is to skip this test if not running on x86. But since setflushdenormal returns a False on ppc64le , then it actually runs the test and not run on x86 "flushdenormal not supported") I believe is you just add a not as below in the torch.setflushdenormal(False), "flush_denormal not supported") the test should then run on x86 but skipped for ppc64le or other platforms.
Doing calls that have side effects in skipIf is a bad idea. We should write a context manager that always resets the previous state + skips the test if the call returned False
what can we do in the meantime to skip over the denormal test, which is invalid, on ppc64 ?
Skip this test everywhere. These checks will affect all tests and we don’t want that
closed via

Discussion:
y = x[2:] self.assertEqual(int(y), 3) <del> @unittest.skipIf(torch.set_flush_denormal(False), "flush_denormal not supported") </del> <ins> # skip this test for now as it affects all tests @unittest.skipIf(True, "flush_denormal not supported") </ins> def test_set_flush_denormal(self): tiny_float = 1e-42 tiny_double = 1e-320
Change:
I'm creating a in my script ([]), and I get an error when this script is close to ending. I am using MPI through mpi4py, not the MPI PyTorch distributed backend. This error only happens when under , not under (which completes successfully). Nothing in the traceback reveals this is an issue with my code, and I haven't touched the DataLoader at all. I've been running this code for a couple months in the same environment, and I haven't seen this bug pop before. That is, this command does not raise an error: However, this command does raise an error: Traceback: PyTorch version: 0.3.1.post2 How you installed PyTorch (conda, pip, source): conda Python version: 3.6.1 OS/CUDA/cuDNN version: A modification of the Deep Learning AMI GPU models and configuration: Amazon instance []
I do not see this bug with Pytorch 0.3.0.post4`

Discussion:
if not self.shutdown: self.shutdown = True self.done_event.set() <del> # if worker_manager_thread is waiting to put while not self.data_queue.empty(): self.data_queue.get() </del> <ins> # if worker_manager_thread is waiting to put, make place for it try: while not self.data_queue.empty(): self.data_queue.get() except FileNotFoundError: # FileNotFoundError can happen when we rebuild the fd # fetched from the queue but the socket is already closed # from the worker side (e.g. due to Python shutting down). pass </ins> for _ in self.workers: self.index_queue.put(None) # done_event should be sufficient to exit worker_manager_thread,
Change:
(old title) When build C extension, the error: FileNotFoundError was got. OS: Windows 10 pro PyTorch version: 0.4.0a0+ How you installed PyTorch (conda, pip, source): source Python version: 3.6.4 CUDA/cuDNN version: CUDA 9.0 GCC version (if compiling from source): msvc 14/15 (then compiling with CUDA I use VS2015, but when build extension, the program automatically use vs2017) When building c extension on Windows, I got the error: (The Chinese above means compiler success compile the library, and generated .lib and .exp) And the same error was got on a Linux Work Station. (gcc is 5.4.0)
In , copy the linked file from , for example , but in my Windows, and a Linux work station, the linked one is in: ,for example . So, there must be a bug, or error in pytorch's ffi or python's ffi. (pyhton 3.6.4, cffi 1.11.4), If it broke down because of change in cffi, I think I can create a PR. I do think this is because of the change of cffi api,
CC who enabled extension build for Windows on
Is this change documented in somewhere like Python SDK?

Discussion:
tmpdir = tempfile.mkdtemp() ext_suf = '.pyd' if os.sys.platform == 'win32' else '.so' libname = cffi_wrapper_name + ext_suf <del> ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname) shutil.copy(os.path.join(tmpdir, libname), os.path.join(target_dir, libname)) </del> <ins> outfile = ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname) shutil.copy(outfile, os.path.join(target_dir, libname)) </ins> finally: shutil.rmtree(tmpdir)
Change:
OS: Ubuntu 16.04 PyTorch version: 0.3.0.post4 How you installed PyTorch (conda, pip, source): pip Python version: 3.5.2 CUDA/cuDNN version: CUDA 8 The below script produces an incorrect error message () The below script produces an incorrect error message ()

Discussion:
if (weight_dim != k) { std::stringstream ss; <del> ss << "Expected " << weight_dim << "-dimensional input for " << weight_dim << "-dimensional weight " << weight.sizes() << ", but got input of size " << input.sizes() << " instead"; </del> <ins> ss << "Expected " << k << "-dimensional weight for " << k << "-dimensional input " << input.sizes() << ", but got weight of size " << weight.sizes() << " instead"; </ins> throw std::runtime_error(ss.str()); } if (weight.size(0) < groups) {
Change:
! OS: Ubuntu 17.10 PyTorch version: 0.3.1 How you installed PyTorch (conda, pip, source): conda Python version: 3.6.4 CUDA/cuDNN version: - GPU models and configuration: -
This is a floating point problem that has been mitigated in master with this commit: But even with that fix, arange doesn't always give the expected result. You can avoid this issue by doing
It’s impossible to have arange work in all kinda of possible conditions due to rounding errors in floating point math. What we did in master was to make it consistent with numpy. An alternate solution would be to avoid having the length of the interval be exactly divisible by its length (you can make it a tiny bit larger).
The numpy docs have a note saying "When using a non-integer step, such as 0.1, the results will often not be consistent." Maybe this could be to the doc as well?

Discussion:
with values from the interval ``[start, end)`` taken with common difference :attr:`step` beginning from `start`. <ins> Note that non-integer `step` is subject to floating point rounding errors when comparing against `end`; to avoid inconsistency, we advise adding a small epsilon to `end` in such cases. </ins> .. math:: out_{i+1} = out_{i} + mathrm{step}
Change:
The math rendering doesn't end where it should, making the text after it difficult to read: <img width="719" alt="screen shot 2018-03-12 at 5 07 03 pm" src="https://user-"
Thanks for the report! Would you be interested in submitting a PR that fixes it?
Sure, I can give it a try!
This is being fixed in this PR

Discussion:
.. math:: f(X) = sqrt[p]{sum_{x in X} x^{p}} <del> - At p = infinity, one gets Max Pooling - At p = 1, one gets Average Pooling </del> <ins> - At p = infinity, one gets Max Pooling - At p = 1, one gets Sum Pooling (which is proportional to Average Pooling) </ins> The parameters :attr:`kernel_size`, :attr:`stride` can either be:

.. math:: f(X) = sqrt[p]{sum_{x in X} x^{p}} <del> - At p = infinity, one gets Max Pooling - At p = 1, one gets Average Pooling </del> <ins> - At p = infinity, one gets Max Pooling - At p = 1, one gets Sum Pooling (which is proportional to Average Pooling) </ins> Args: kernel_size: a single int, the size of the window
Change:
PyTorch version: 0.4.0a0+ Repro: Result:
Emm. I fail to reproduce this bug in Python 3.5.0 and Mac OS 10.13.3. What's your system environment?
The bug is probably specific to the sharing mode. Mac OS uses by default.

Discussion:
self.assertEqual(list(tensor), [4, 4, 4, 4]) p.join() <ins> def _test_empty_tensor_sharing(self, dtype): q = mp.Queue() empty = torch.tensor([], dtype=dtype) q.put(empty) out = q.get(timeout=1) self.assertEqual(out, empty) def test_empty_tensor_sharing(self): self._test_empty_tensor_sharing(torch.float32) self._test_empty_tensor_sharing(torch.int64) @unittest.skipIf(not torch.cuda.is_available(), 'CUDA not available') def test_empty_tensor_sharing_cuda(self): self._test_empty_tensor_sharing(torch.cuda.float32) self._test_empty_tensor_sharing(torch.cuda.int64) </ins> def _test_autograd_sharing(self, var): ready = mp.Event() master_modified = mp.Event()

return storage <ins> def rebuild_storage_empty(cls): return cls() </ins> def reduce_storage(storage): from . import get_sharing_strategy if storage.is_cuda:

cache_key = metadata[1] rebuild = rebuild_storage_filename storage._shared_incref() <ins> elif storage.size() == 0: # This is special cased because Empty tensors # (with size 0) cannot be mmapped. return (rebuild_storage_empty, (type(storage),)) </ins> else: fd, size = storage._share_fd_() if sys.version_info[0] == 2:
Change:
gdb points that the error might be in trying to get a size from an empty tensor: I'm using PyTorch version 0.4.0a0+
There's a check that should exclude zero-dim tensors from ( should be 0 in this case), so I'm wondering why that's not happening right now... edit: Nevermind, I was running an old build. I pulled the latest master and with being an empty tensor (with shape (0,)), cat crashes.
Related: We should probably rewrite to better handle these cases
Okay, I found the bug. The CUDA version of check doesn't check the case where the input contains all empty tensors, while the CPU version does. I'll put up a fix soon.

Discussion:
} } <ins> // If all inputs are empty tensors, return an empty tensor if (notEmptyTensor == NULL) { return; } </ins> // In the event that the user specified -1 as the concat dimension, then // we want to pick the nDims as dimension to cat along (and thus nDims - 1 as the // value due to 0-based indexing). If the nDims is // 0 (i.e. we are catting all

z = torch.cat([x, y]) self.assertEqual(z.size(), (21, SIZE, SIZE)) <ins> def test_cat_empty(self): TestTorch._test_cat_empty(self, use_cuda=True) </ins> def test_bernoulli(self): x = torch.tensor([0, 1], dtype=torch.cuda.float32) self.assertEqual(x.bernoulli().tolist(), [0, 1])

'zero-dimensional.*cannot be concatenated'): torch.cat([x, y]) <del> def test_cat_empty(self): </del> <ins> @staticmethod def _test_cat_empty(self, use_cuda=False): </ins> # FIXME: this is legacy behavior and should be removed # when we support empty tensors with arbitrary sizes <del> x = torch.randn(4, 3, 32, 32) empty = torch.randn(0) </del> <ins> if use_cuda: dtype = torch.cuda.float32 else: dtype = torch.float32 x = torch.randn((4, 3, 32, 32), dtype=dtype) empty = torch.randn((0,), dtype=dtype) </ins> res1 = torch.cat([x, empty], dim=1) res2 = torch.cat([empty, x], dim=1) self.assertEqual(res1, res2) <del> conv = torch.nn.Conv2d(3, 3, kernel_size=1) </del> <ins> conv = torch.nn.Conv2d(3, 3, kernel_size=1).float() if use_cuda: conv = conv.cuda() </ins> res1 = torch.cat([conv(x), empty], dim=1) res2 = torch.cat([empty, conv(x)], dim=1) self.assertEqual(res1, res2)

'expected a non-empty list of Tensors'): torch.cat([], dim=1) <ins> def test_cat_empty(self): self._test_cat_empty(self) </ins> def test_stack(self): x = torch.rand(2, 3, 4) y = torch.rand(2, 3, 4)
Change:
OS: ubuntu 16.04 PyTorch version: 0.4.0a0+ How you installed PyTorch (conda, pip, source): source Python version: 3.6.3 CUDA/cuDNN version: v9.1, cudnn-9.1-linux-x64-v7 GPU models and configuration: 4x Tesla M60 GCC version (if compiling from source): 5.4.0 When using context () on a model with dataparallel operation (same with ) on 1 GPU the flag requires_grad does not come back to True. If only one GPU is used then everything works fine. Script: On 2 GPUs, this outputs which is wrong in the last line. On 1 GPU (set ) the output is correct.
is looking into it

Discussion:
self.assertRaisesRegex(RuntimeError, 'modified by an inplace operation', lambda: z.backward()) <ins> def test_no_grad_input(self): class MyFunction(Function): @staticmethod def forward(self, x): return x @staticmethod def backward(self, grad_output): return grad_output x = torch.randn(5, requires_grad=True) with torch.no_grad(): y = MyFunction.apply(x) self.assertTrue(x.requires_grad) self.assertIsNone(y.grad_fn) </ins> def test_backward_copy(self): # This tests checks backward engine for a very subtle bug that appreared # in one of the initial versions of autograd. Gradients tensors were

self.assertEqual(input_var.requires_grad, broadcasted_var.requires_grad) @unittest.skipIf(not TEST_MULTIGPU, "multi-GPU not supported") <ins> def test_broadcast_no_grad(self): x = torch.randn(1, 2, dtype=torch.cuda.float32, requires_grad=True) with torch.no_grad(): broadcasted = Broadcast.apply((0, 1), x) self.assertTrue(x.requires_grad) for output in broadcasted: self.assertFalse(output.requires_grad) @unittest.skipIf(not TEST_MULTIGPU, "multi-GPU not supported") </ins> def test_replicate(self): module = nn.Linear(10, 5).float().cuda() input = Variable(torch.randn(2, 10).float().cuda())

auto set_history = [&](Variable& var, uint32_t output_nr, bool is_input, bool is_modified, bool is_differentiable) { if (!is_differentiable) { <del> if (!var.requires_grad()) return; </del> <ins> if (!var.requires_grad()) { return; } </ins> // NB: we don't support returning non-differentiable views that could require grad <del> // (this could happen if someone were to return an input to the function). </del> if (var.is_view()) { throw std::runtime_error("Returning Variables sharing storage with other Variables " "that require grad is not supported in Python functions. " "Please submit a feature request if you hit this error."); } <del> var.detach_(); </del> <ins> // Return detached aliases of inputs, instead of changing their requires_grad // property. if (is_input) { var = var.detach(); } else { var.detach_(); } </ins> } else if (is_modified) { if (var.is_leaf() && var.requires_grad()) { throw std::runtime_error("a leaf Variable that requires grad has been used in an in-place operation.");
Change:
Trying to build master (), I'm seeing I tried in to no avail.
NM, also needed a .
Need a check to see if this is folder is checked out in , like the other submodules. Should be a simple patch.

Discussion:
check_file(os.path.join(lib_path, "pybind11", "CMakeLists.txt")) check_file(os.path.join('aten', 'src', 'ATen', 'cpu', 'cpuinfo', 'CMakeLists.txt')) check_file(os.path.join('aten', 'src', 'ATen', 'cpu', 'tbb', 'tbb_remote', 'Makefile')) <ins> check_file(os.path.join('aten', 'src', 'ATen', 'utils', 'catch', 'CMakeLists.txt')) </ins> check_pydep('yaml', 'pyyaml') check_pydep('typing', 'typing')