locuslab / optnet

OptNet: Differentiable Optimization as a Layer in Neural Networks
Apache License 2.0
507 stars 76 forks source link

several issues #3

Closed jdily closed 7 years ago

jdily commented 7 years ago

Hi there, thx for sharing this wonderful works. I am trying to run the code, and encounter some situations:

  1. when I trying to run test and profile code, I fail to import adact. But I have no idea where the lib is?
  2. when running denoising example, I use the command as python main.py --nEpoch 50 optnet --learnD --Dpenalty 0.01 and I got the following error message: ('===>', 'Building model') Testing model: 0/1000 Traceback (most recent call last): File "main.py", line 229, in <module> main() File "main.py", line 136, in main test(args, 0, model, testF, testW, testX, testY) File "main.py", line 202, in test output = model(batch_data) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 206, in __call__ result = self.forward(*input, **kwargs) File "/home/jdily/Desktop/project/optnet-master/denoising/models.py", line 155, in forward x = QPFunction()(p.double(), Q.double(), G.double(), h.double(), e, e).float() File "/usr/local/lib/python2.7/dist-packages/qpth/qp.py", line 65, in forward p, _ = expandParam(p_, nBatch, 2) File "/usr/local/lib/python2.7/dist-packages/qpth/util.py", line 50, in expandParam raise RuntimeError("Unexpected number of dimensions.") RuntimeError: Unexpected number of dimensions. I use python 2.7 instead of 3.x, but I do update some part of the code to support python 2.7... Do you know how can I solve these issues?

Meanwhile, the link to the denoising data seems broken.

thanks a lot!

bamos commented 7 years ago

Hi, great to hear you're looking into our code!

  1. The profiling code here is outdated. I'll clean the code up within a month. I do have some profiling code in the qpth repo if you're interested in that.
  2. I updated the QPFunction interface in qpth but haven't yet updated it here. I just committed an update so the code should work with Python 3. (Not sure about Python 2, it should probably work too)
  3. I'll move the denoising data to somewhere more permanent soon. I put the server back online so the link in the README should work again.