Advertisement
Guest User

stack trace

a guest
Dec 22nd, 2022
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.64 KB | None | 0 0
  1. /home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/autograd/__init__.py:173: UserWarning: Error detected in MmBackward0. Traceback of forward call that caused the error:
  2. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/runpy.py", line 196, in _run_module_as_main
  3. return _run_code(code, main_globals, None,
  4. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/runpy.py", line 86, in _run_code
  5. exec(code, run_globals)
  6. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel_launcher.py", line 17, in <module>
  7. app.launch_new_instance()
  8. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/traitlets/config/application.py", line 978, in launch_instance
  9. app.start()
  10. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/kernelapp.py", line 712, in start
  11. self.io_loop.start()
  12. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/tornado/platform/asyncio.py", line 215, in start
  13. self.asyncio_loop.run_forever()
  14. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
  15. self._run_once()
  16. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/asyncio/base_events.py", line 1899, in _run_once
  17. handle._run()
  18. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/asyncio/events.py", line 80, in _run
  19. self._context.run(self._callback, *self._args)
  20. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 510, in dispatch_queue
  21. await self.process_one()
  22. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 499, in process_one
  23. await dispatch(*args)
  24. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 406, in dispatch_shell
  25. await result
  26. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 730, in execute_request
  27. reply_content = await reply_content
  28. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 383, in do_execute
  29. res = shell.run_cell(
  30. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/ipykernel/zmqshell.py", line 528, in run_cell
  31. return super().run_cell(*args, **kwargs)
  32. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2885, in run_cell
  33. result = self._run_cell(
  34. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2940, in _run_cell
  35. return runner(coro)
  36. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/IPython/core/async_helpers.py", line 129, in _pseudo_sync_runner
  37. coro.send(None)
  38. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3139, in run_cell_async
  39. has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
  40. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3318, in run_ast_nodes
  41. if await self.run_code(code, result, async_=asy):
  42. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3378, in run_code
  43. exec(code_obj, self.user_global_ns, self.user_ns)
  44. File "/tmp/ipykernel_6795/261130722.py", line 6, in <module>
  45. state_new = simulate(state_old, model)
  46. File "/tmp/ipykernel_6795/3537832075.py", line 3, in simulate
  47. state_new = model(state_old)
  48. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
  49. return forward_call(*input, **kwargs)
  50. File "/tmp/ipykernel_6795/4011584273.py", line 24, in forward
  51. out = self.linear_stack(x)
  52. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
  53. return forward_call(*input, **kwargs)
  54. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/nn/modules/container.py", line 141, in forward
  55. input = module(input)
  56. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
  57. return forward_call(*input, **kwargs)
  58. File "/home/marco/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 103, in forward
  59. return F.linear(input, self.weight, self.bias)
  60. (Triggered internally at ../torch/csrc/autograd/python_anomaly_mode.cpp:104.)
  61. Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
  62.  
  63. ---------------------------------------------------------------------------
  64. RuntimeError Traceback (most recent call last)
  65. Cell In [6], line 11
  66. 9 optimizer.zero_grad()
  67. 10 loss = lossNN(state_old, state_new, model)
  68. ---> 11 loss.backward(retain_graph=True)
  69. 12 optimizer.step()
  70. 14 state_old = state_new
  71.  
  72. File ~/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/_tensor.py:363, in Tensor.backward(self, gradient, retain_graph, create_graph, inputs)
  73. 354 if has_torch_function_unary(self):
  74. 355 return handle_torch_function(
  75. 356 Tensor.backward,
  76. 357 (self,),
  77. (...)
  78. 361 create_graph=create_graph,
  79. 362 inputs=inputs)
  80. --> 363 torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  81.  
  82. File ~/mambaforge/envs/PDE_torch/lib/python3.10/site-packages/torch/autograd/__init__.py:173, in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables, inputs)
  83. 168 retain_graph = create_graph
  84. 170 # The reason we repeat same the comment below is that
  85. 171 # some Python versions print out the first line of a multi-line function
  86. 172 # calls in the traceback and some print out the last line
  87. --> 173 Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
  88. 174 tensors, grad_tensors_, retain_graph, create_graph, inputs,
  89. 175 allow_unreachable=True, accumulate_grad=True)
  90.  
  91. RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [32, 4]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement