dhroth/sketchedsgd

Error: Can't add this to a CSVec

BelhalK opened this issue · 2 comments

Seems likewhen running in example.py the following line

loss.backward()

it returns ValueError: Can't add this to a CSVec: tensor([...]).

I have not changed a single thing to the code.

In csvec.py: isinstance(other, CSVec) is returning False which is the bug.
Can it be because in sketched_optimizer.py what we are adding is not a CSVec object?

Any ideas?

Oh, sorry about that. We updated the csvec API for another project but didn't come back to fix the code in this repo (see nikitaivkin/csh@9d048bb).

It should work if you checkout a commit in the csh repo from before that commit. I think the only thing you really need that we've committed since then is this: nikitaivkin/csh@8e01986, since that'll give you a big performance improvement (in an earlier version of PyTorch, my recollection is that topk() was much slower).

I'll try to update the code in this repo to match the new CSVec API soon -- should just be a matter of changing every time we sketch a vector into a CSVec (ie sketch += tensor) to use the new accumulateVec() function. Or happy to merge a pull request if you get it working sooner

Fixed by a55cf75. Closing for now, and example.py works for me, but let me know if you're still running into issues.