Coder Social home page Coder Social logo

Sampling code about lstm-char-cnn HOT 6 OPEN

yoonkim avatar yoonkim commented on July 26, 2024
Sampling code

from lstm-char-cnn.

Comments (6)

LiyuanLucasLiu avatar LiyuanLucasLiu commented on July 26, 2024

Hi, I'm a rookie on torch too. However, I tried to write a sample function for this model myself (unfortunately it's super slow), and you can find it on https://github.com/LiyuanLucasLiu/lstm-char-cnn

from lstm-char-cnn.

 avatar commented on July 26, 2024

Hi, another rookie here. The previous version using Squeeze.lua works fine.
I would like to test your sample.lua as per karpathy but it doesn't work with the previous version.
Unfortunately, when I run the new version without Squeeze.lua I get an error which references 'Squeeze': #18

Any suggestions to fix are appreciated.

Also, sample-beam.lua increases the quality of karpathy output dramatically (imho)

https://github.com/pender/char-rnn/blob/master/sample-beam.lua

Would be cool to see this working for this model.

cheers

from lstm-char-cnn.

 avatar commented on July 26, 2024

Updated torch and everything working. Generated a quick .t7 file with lowest possible settings and only 5 epochs to test sample.lua. Following " batch_size' failed. " error generated.

Is there a value I can set to prevent this or do I have to run "main.lua" with the values given?

thanks

aaron@aaron-Macmini ~/Desktop/lstm-char-cnn-NEXT $ th sample.lua
loading data files...
Word vocab size: 4040, Char vocab size: 71
reshaping tensors...
data load done. Number of batches in train: 14, val: 2, test: 1
number of parameters in the model: 6073985
/home/aaron/torch/install/bin/luajit: /home/aaron/torch/install/share/lua/5.1/nn/THNN.lua:109: Assertion `THIndexTensor_(size)(target, 0) == batch_size' failed. at /home/aaron/torch/extra/nn/lib/THNN/generic/ClassNLLCriterion.c:43
stack traceback:
[C]: in function 'v'
/home/aaron/torch/install/share/lua/5.1/nn/THNN.lua:109: in function 'ClassNLLCriterion_updateOutput'
...ron/torch/install/share/lua/5.1/nn/ClassNLLCriterion.lua:41: in function 'forward'
sample.lua:216: in function 'sample'
sample.lua:236: in main chunk
[C]: in function 'dofile'
...aron/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00406670

from lstm-char-cnn.

LiyuanLucasLiu avatar LiyuanLucasLiu commented on July 26, 2024

Hi, I'm not sure what caused this error (as a rookie...), but it seems that you ignored several necessary options while running sample.lua (the default value might not fit your checkpoint's setting), such as '-model'.

from lstm-char-cnn.

 avatar commented on July 26, 2024

Thanks for your reply.

Could you supply an example of the terminal commands to run sample.lua ?

The commands should be based on running main.lua and generating the necessary .t7 file from the supplied PTB files.

This is easy with the karpathy original but not so much with this lstm version.

Thanks

from lstm-char-cnn.

LiyuanLucasLiu avatar LiyuanLucasLiu commented on July 26, 2024

Hi, I spent some time to train a new model and try sample.lua, I find that:

$ th main.lua -savefile char-large -EOS '+'
$ th sample.lua -model cv/lm_char-large_epoch25.00_81.97.t7 -gpuid 0 -cudnn 1 -length 20 -savefile tmpresult.t7 -temperature 0.5`

works fine with me.

hope it could help.

from lstm-char-cnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.