Skip to content

Commit dd87251

Browse files
committed
fix gb 0.8.10
1 parent 8ad920e commit dd87251

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Jenkinsfile

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ stage("Build and Publish") {
55
sh "git submodule update --init"
66
sh "build/utils/clean_build.sh"
77
sh "conda env update -f build/env.yml"
8+
sh "pip list"
89
sh "build/utils/build_html.sh zh"
910
sh "build/utils/build_pdf.sh zh"
1011
sh "build/utils/build_pkg.sh zh"

gluonbook/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
from .utils import *
33

4-
__version__ = '0.8.9'
4+
__version__ = '0.8.10'

gluonbook/utils.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,9 @@ def train_and_predict_rnn(rnn, get_params, init_rnn_state, num_hiddens,
573573
pred_len, prefixes):
574574
"""Train an RNN model and predict the next item in the sequence."""
575575
if is_random_iter:
576-
data_iter_fn = gb.data_iter_random
576+
data_iter_fn = data_iter_random
577577
else:
578-
data_iter_fn = gb.data_iter_consecutive
578+
data_iter_fn = data_iter_consecutive
579579
params = get_params()
580580
loss = gloss.SoftmaxCrossEntropyLoss()
581581

@@ -598,7 +598,7 @@ def train_and_predict_rnn(rnn, get_params, init_rnn_state, num_hiddens,
598598
l = loss(outputs, y).mean()
599599
l.backward()
600600
grad_clipping(params, clipping_theta, ctx)
601-
gb.sgd(params, lr, 1)
601+
sgd(params, lr, 1)
602602
l_sum += l.asscalar() * y.size
603603
n += y.size
604604

@@ -623,7 +623,7 @@ def train_and_predict_rnn_gluon(model, num_hiddens, vocab_size, ctx,
623623

624624
for epoch in range(num_epochs):
625625
l_sum, n, start = 0.0, 0, time.time()
626-
data_iter = gb.data_iter_consecutive(
626+
data_iter = data_iter_consecutive(
627627
corpus_indices, batch_size, num_steps, ctx)
628628
state = model.begin_state(batch_size=batch_size, ctx=ctx)
629629
for X, Y in data_iter:
@@ -635,7 +635,7 @@ def train_and_predict_rnn_gluon(model, num_hiddens, vocab_size, ctx,
635635
l = loss(output, y).mean()
636636
l.backward()
637637
params = [p.data() for p in model.collect_params().values()]
638-
gb.grad_clipping(params, clipping_theta, ctx)
638+
grad_clipping(params, clipping_theta, ctx)
639639
trainer.step(1)
640640
l_sum += l.asscalar() * y.size
641641
n += y.size
@@ -660,7 +660,7 @@ def train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,
660660
l = loss(y_hat, y).sum()
661661
l.backward()
662662
if trainer is None:
663-
gb.sgd(params, lr, batch_size)
663+
sgd(params, lr, batch_size)
664664
else:
665665
trainer.step(batch_size)
666666
y = y.astype('float32')

0 commit comments

Comments
 (0)