harvardnlp / im2markup

Neural model for converting Image-to-Markup (by Yuntian Deng yuntiandeng.com)
https://im2markup.yuntiandeng.com
MIT License
1.19k stars 214 forks source link

Want to train and test on CPU #7

Open bernardcwj opened 6 years ago

bernardcwj commented 6 years ago

I wish to test the model on a CPU, how can i achieve that? I have tried setting the gpd_id as 0 but it returns an error stating spatialconvolution requires cuda. Therefore, i included a line cudnn.convert(model[1], nn) in model.lua before line 55 to overcome the error. But now i'm getting another error:

 bad argument #2 to '?' (number expected, got userdata)
stack traceback:
        [C]: in ?
        [C]: in function '__add'
        ../im2markup/src/model/model.lua:593: in function 'feval'
        ../im2markup/src/model/model.lua:887: in function 'step'
        ../im2markup/src/train.lua:111: in function 'train'
        ../im2markup/src/train.lua:291: in function 'main'
        ../im2markup/src/train.lua:297: in main chunk

Any help is appreciated! Thanks

longzaitianguo commented 6 years ago

@bernardcwj @da03 Do you find a way to solve this problem?

da03 commented 6 years ago

Hmm a simple workaround is to just use modules from nn instead of cudnn, but I think training on CPU would be too slow to be realistic.

jellchou commented 4 years ago

I am training it on cpu, one epoch spends 5 hours