Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
update word_lm example
Browse files Browse the repository at this point in the history
  • Loading branch information
liyujiel committed Jun 27, 2018
1 parent 13bc6d8 commit 7c1acb4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions example/rnn/old/bucket_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import sys
sys.path.insert(0, "../../python")
import numpy as np
import math
import mxnet as mx

# The interface of a data iter that works for bucketing
Expand Down Expand Up @@ -203,7 +202,7 @@ def make_data_iter_plan(self):
# truncate each bucket into multiple of batch-size
bucket_n_batches = []
for i in range(len(self.data)):
bucket_n_batches.append(math.floor((self.data[i]) / self.batch_size))
bucket_n_batches.append(np.floor((self.data[i]) / self.batch_size))
self.data[i] = self.data[i][:int(bucket_n_batches[i]*self.batch_size)]

bucket_plan = np.hstack([np.zeros(n, int)+i for i, n in enumerate(bucket_n_batches)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if [[ ! -d "${DATA_DIR}" ]]; then
mkdir -p ${DATA_DIR}
fi

wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.train.txt;
wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.valid.txt;
wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.test.txt;
wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/sherlockholmes/sherlockholmes.train.txt;
wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/sherlockholmes/sherlockholmes.valid.txt;
wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/sherlockholmes/sherlockholmes.test.txt;
wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/tinyshakespeare/input.txt;
2 changes: 1 addition & 1 deletion example/rnn/word_lm/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from mxnet.model import BatchEndParam

parser = argparse.ArgumentParser(description='PennTreeBank LSTM Language Model')
parser.add_argument('--data', type=str, default='./data/ptb.',
parser.add_argument('--data', type=str, default='./data/sherlockholmes.',
help='location of the data corpus')
parser.add_argument('--emsize', type=int, default=650,
help='size of word embeddings')
Expand Down

0 comments on commit 7c1acb4

Please sign in to comment.