efficient-kan icon indicating copy to clipboard operation
efficient-kan copied to clipboard

RuntimeError: false INTERNAL ASSERT FAILED

Open csinva opened this issue 9 months ago • 3 comments

Getting this error when running test_simple_math.py. Any idea how to resolve it?

  File "/home/chansingh/test/kan.py", line 131, in curve2coeff
    solution = torch.linalg.lstsq(
               ^^^^^^^^^^^^^^^^^^^
RuntimeError: false INTERNAL ASSERT FAILED at "../aten/src/ATen/native/BatchLinearAlgebra.cpp":1539, please report a bug to PyTorch. torch.linalg.lstsq: (Batch element 0): Argument 6 has illegal value. Most certainly there is a bug in the implementation calling the backend library.

(pytorch is up-to-date, version '2.3.0+cu121', python 3.11)

csinva avatar May 05 '24 23:05 csinva

Me, too. But the examples/mnist.py can work correctly.

pecanjk avatar May 08 '24 01:05 pecanjk

Worked okay when I just lowered the learning rate / switched the optimizer...

csinva avatar May 08 '24 12:05 csinva

That one happens somewhat randomly when reconstructing the splines on the new grid (performing update_grid)... Possibly some numerical failure in the Least Square optimization. I also encountered that in some cases. To workaround that, consider pre-normalize input into [-1, 1], and avoid calling update_grid.

Blealtan avatar May 17 '24 18:05 Blealtan