refactor lstm model and add documentations in R#2329
refactor lstm model and add documentations in R#2329thirdwing merged 8 commits intoapache:masterfrom
Conversation
|
The testing failed because you didn't provide the There are other minor issues. I will look into it. |
|
@ziyeqinghan Awesome! Could you also post some results here from the added example? |
|
@thirdwing I have added |
|
@terrytangyuan I updated my comment to post some results here from the added example. :) |
R-package/R/lstm.R
Outdated
| @@ -0,0 +1,589 @@ | |||
| require(mxnet) | |||
|
@ziyeqinghan Thanks! Could you perhaps add some simple unit tests (mini-example) so it's easier for other people to contribute in the future? |
R-package/vignettes/CharRnnModel.Rmd
Outdated
|
|
||
| ```{r} | ||
| model <- mx.lstm(X.train, X.val, | ||
| ctx=mx.gpu(0), |
|
@ziyeqinghan A few comments:
|
|
We can add lint if we really want https://github.com/jimhester/lintr |
|
Yeah let's add that and have some important linters first.
|
|
This is a built-in function in RStudio and can be added into travis testing. On Fri, Jun 3, 2016 at 4:14 PM, Yuan (Terry) Tang notifications@github.com
Qiang Kou |
|
@thirdwing I added that for xgboost before but haven't enabled yet, here's the example you could borrow. |
f46145e to
3ff8f0f
Compare
|
I have modified the codes and have several questions.
Could you give me some suggestions or examples? Thank you so much! |
|
@ziyeqinghan The changes look good to me. Yea assert on training error would be good for now. Make sure you are using a very small sample of data and train just enough steps so it won't take too long. |
R-package/vignettes/CharRnnModel.Rmd
Outdated
| download.file(url='https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/tinyshakespeare/input.txt', | ||
| destfile='input.txt', method='wget') | ||
| } | ||
| setwd("..") |
There was a problem hiding this comment.
Can you change this a little bit? Please don't change the working directory, or it might fail other tests.
There was a problem hiding this comment.
I have changed it. :)
There was a problem hiding this comment.
I will merge this if all tests pass.
On Mon, Jun 6, 2016 at 9:47 AM, Yuqi Li notifications@github.com wrote:
In R-package/vignettes/CharRnnModel.Rmd
#2329 (comment):+num.round = 5
+learning.rate= 0.1
+wd=0.00001
+clip_gradient=1
+update.period = 1
++download the data. +{r}
+download.data <- function(data_dir) {
- dir.create(data_dir, showWarnings = FALSE)
- setwd(data_dir)
- if (!file.exists('input.txt')) {
download.file(url='https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/tinyshakespeare/input.txt',destfile='input.txt', method='wget')- }
- setwd("..")
I have changed it. :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dmlc/mxnet/pull/2329/files/ace088ea4cba974a18f13978009044c231eecead#r65903056,
or mute the thread
https://github.com/notifications/unsubscribe/ABebVf58crQ7KFXmw8S7D6hX9YUXiXiWks5qJDMQgaJpZM4Iteaz
.
Qiang Kou
qkou@umail.iu.edu
School of Informatics and Computing, Indiana University
|
https://travis-ci.org/dmlc/mxnet/jobs/135611995#L2930 The testing need too much time. Maybe we need to use another sets of parameters, or just skip the RNN example. |
|
I changed the parameter |
|
It is quite weird the mnist test failed. This is not your fault. Let's comment out related lines and merge your PR. I will fix that later. You should find Please also comment out the |
|
The reason why the mnist test failed is that I modified I'm sorry and have fixed the bug. |
* modify mx.io.arrayiter to let label support multi-dimension * refactor lstm model to some high-level reusable API in R * add the rnn example and documentations of Char-RNN model in R * modify some codes of lstm model in R * add unit-test for lstm model in R * modify the code in CharRnnModel.Rmd to unchange the working directory * change num.round smaller to decrease the running time * fix a bug on mx.io.arrayiter
I refactor the LSTM model in [#1673] to some high-level reusable API for R users. The high-level API include:
mx.lstmTraining LSTM Unrolled Modelmx.lstm.inferenceCreate a LSTM Inference Modelmx.lstm.forwardForward function for LSTM inference modelAlso, I add a char-rnn example and documentation to show how to use lstm model to build a char level language model and generate text from it.
The training result is:
The result of generating a sequence of 75 chars is: