locuslab/lcp-physics

inference_demo.py issue, detailed install instructions of tested platform?

erwincoumans opened this issue · 4 comments

I'm getting errors after installing it, see below. Can you describe on what platform you develop and test lcp-physics, which versions of all relevant packages (Linux distro, mac, windows etc), python3 version (anaconda?) etc.

demo.py seems to work (but sim runs pretty slow), but python inference_demo.py gives an error:

erwincoumans-macbookpro2:demos erwincoumans$ python inference_demo.py 
  10 / 11  30.0Traceback (most recent call last):
  File "inference_demo.py", line 248, in <module>
    inference_demo(screen)
  File "inference_demo.py", line 49, in inference_demo
    grad = c.mass.grad.data
AttributeError: 'NoneType' object has no attribute 'data'


(python and pip are an alias to python3 and pip3)

conda install pytorch torchvision -c pytorch
pip install pygame
python setup.py develop
cd demos
python demo.py

erwincoumans-macbookpro2:demos erwincoumans$ python inference_demo.py 
  10 / 11  30.0Traceback (most recent call last):
  File "inference_demo.py", line 248, in <module>
    inference_demo(screen)
  File "inference_demo.py", line 49, in inference_demo
    grad = c.mass.grad.data
AttributeError: 'NoneType' object has no attribute 'data'

image

image

I had introduced a small bug on the inference script, should be fixed right now. (Currently testing here.)

Regarding demo running slowly, for simple examples like that, most of that is simply because the pygame display is not really optimized, if you run with no display (python demo.py -nd or setting screen=None in the run_world code) it should run much faster than real time. On top of that, especially for more complex examples, the solver is still running on dense matrices, so we're currently working on speeding that up taking advantage of the sparsity in the formulation.

Thanks for the quick reply, performance makes sense now. After updating, the error is as follows:

[torch.DoubleTensor of size 1]

Traceback (most recent call last):
  File "inference_demo.py", line 247, in <module>
    inference_demo(screen)
  File "inference_demo.py", line 71, in inference_demo
    rec = Recorder(DT, screen)
  File "/Users/erwincoumans/dev/lcp-physics/lcp_physics/physics/utils.py", line 58, in __init__
    os.mkdir(path)
FileNotFoundError: [Errno 2] No such file or directory: 'videos/frames'

Fixed. Strange that it passed the tests, I'll check on that.