Skip to content

Commit fae943b

Browse files
author
Guanheng Zhang
committed
update docs
1 parent ed76c2c commit fae943b

File tree

1 file changed

+51
-54
lines changed

1 file changed

+51
-54
lines changed

beginner_source/text_sentiment_ngrams_tutorial.py

Lines changed: 51 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,8 @@ def train(model, dataloader):
203203
total_count += label.size(0)
204204
if idx % log_interval == 0 and idx > 0:
205205
elapsed = time.time() - start_time
206-
print('| epoch {:3d} | {:5d}/{:5d} batches | lr {:05.5f} | '
207-
'ms/batch {:5.2f} '
206+
print('| epoch {:3d} | {:5d}/{:5d} batches '
208207
'| accuracy {:8.3f}'.format(epoch, idx, len(dataloader),
209-
scheduler.get_last_lr()[0],
210-
elapsed * 1000 / log_interval,
211208
total_acc/total_count))
212209
total_acc, total_count = 0, 0
213210
start_time = time.time()
@@ -292,66 +289,66 @@ def evaluate(model, dataloader):
292289
#
293290
# ::
294291
#
295-
# | epoch 1 | 500/ 1782 batches | lr 5.00000 | ms/batch 4.75 | accuracy 0.684
296-
# | epoch 1 | 1000/ 1782 batches | lr 5.00000 | ms/batch 4.42 | accuracy 0.852
297-
# | epoch 1 | 1500/ 1782 batches | lr 5.00000 | ms/batch 4.43 | accuracy 0.877
298-
# -----------------------------------------------------------------------------------------
292+
# | epoch 1 | 500/ 1782 batches | accuracy 0.684
293+
# | epoch 1 | 1000/ 1782 batches | accuracy 0.852
294+
# | epoch 1 | 1500/ 1782 batches | accuracy 0.877
295+
# -----------------------------------------------------------
299296
# | end of epoch 1 | time: 8.33s | valid accuracy 0.867
300-
# -----------------------------------------------------------------------------------------
301-
# | epoch 2 | 500/ 1782 batches | lr 5.00000 | ms/batch 4.45 | accuracy 0.895
302-
# | epoch 2 | 1000/ 1782 batches | lr 5.00000 | ms/batch 4.43 | accuracy 0.900
303-
# | epoch 2 | 1500/ 1782 batches | lr 5.00000 | ms/batch 4.43 | accuracy 0.903
304-
# -----------------------------------------------------------------------------------------
297+
# -----------------------------------------------------------
298+
# | epoch 2 | 500/ 1782 batches | accuracy 0.895
299+
# | epoch 2 | 1000/ 1782 batches | accuracy 0.900
300+
# | epoch 2 | 1500/ 1782 batches | accuracy 0.903
301+
# -----------------------------------------------------------
305302
# | end of epoch 2 | time: 8.18s | valid accuracy 0.890
306-
# -----------------------------------------------------------------------------------------
307-
# | epoch 3 | 500/ 1782 batches | lr 5.00000 | ms/batch 4.46 | accuracy 0.914
308-
# | epoch 3 | 1000/ 1782 batches | lr 5.00000 | ms/batch 4.44 | accuracy 0.914
309-
# | epoch 3 | 1500/ 1782 batches | lr 5.00000 | ms/batch 4.43 | accuracy 0.916
310-
# -----------------------------------------------------------------------------------------
303+
# -----------------------------------------------------------
304+
# | epoch 3 | 500/ 1782 batches | accuracy 0.914
305+
# | epoch 3 | 1000/ 1782 batches | accuracy 0.914
306+
# | epoch 3 | 1500/ 1782 batches | accuracy 0.916
307+
# -----------------------------------------------------------
311308
# | end of epoch 3 | time: 8.20s | valid accuracy 0.897
312-
# -----------------------------------------------------------------------------------------
313-
# | epoch 4 | 500/ 1782 batches | lr 5.00000 | ms/batch 4.44 | accuracy 0.926
314-
# | epoch 4 | 1000/ 1782 batches | lr 5.00000 | ms/batch 4.44 | accuracy 0.924
315-
# | epoch 4 | 1500/ 1782 batches | lr 5.00000 | ms/batch 4.43 | accuracy 0.921
316-
# -----------------------------------------------------------------------------------------
309+
# -----------------------------------------------------------
310+
# | epoch 4 | 500/ 1782 batches | accuracy 0.926
311+
# | epoch 4 | 1000/ 1782 batches | accuracy 0.924
312+
# | epoch 4 | 1500/ 1782 batches | accuracy 0.921
313+
# -----------------------------------------------------------
317314
# | end of epoch 4 | time: 8.18s | valid accuracy 0.895
318-
# -----------------------------------------------------------------------------------------
319-
# | epoch 5 | 500/ 1782 batches | lr 0.50000 | ms/batch 4.44 | accuracy 0.938
320-
# | epoch 5 | 1000/ 1782 batches | lr 0.50000 | ms/batch 4.42 | accuracy 0.935
321-
# | epoch 5 | 1500/ 1782 batches | lr 0.50000 | ms/batch 4.41 | accuracy 0.937
322-
# -----------------------------------------------------------------------------------------
315+
# -----------------------------------------------------------
316+
# | epoch 5 | 500/ 1782 batches | accuracy 0.938
317+
# | epoch 5 | 1000/ 1782 batches | accuracy 0.935
318+
# | epoch 5 | 1500/ 1782 batches | accuracy 0.937
319+
# -----------------------------------------------------------
323320
# | end of epoch 5 | time: 8.16s | valid accuracy 0.902
324-
# -----------------------------------------------------------------------------------------
325-
# | epoch 6 | 500/ 1782 batches | lr 0.50000 | ms/batch 4.43 | accuracy 0.939
326-
# | epoch 6 | 1000/ 1782 batches | lr 0.50000 | ms/batch 4.41 | accuracy 0.939
327-
# | epoch 6 | 1500/ 1782 batches | lr 0.50000 | ms/batch 4.41 | accuracy 0.938
328-
# -----------------------------------------------------------------------------------------
321+
# -----------------------------------------------------------
322+
# | epoch 6 | 500/ 1782 batches | accuracy 0.939
323+
# | epoch 6 | 1000/ 1782 batches | accuracy 0.939
324+
# | epoch 6 | 1500/ 1782 batches | accuracy 0.938
325+
# -----------------------------------------------------------
329326
# | end of epoch 6 | time: 8.16s | valid accuracy 0.906
330-
# -----------------------------------------------------------------------------------------
331-
# | epoch 7 | 500/ 1782 batches | lr 0.50000 | ms/batch 4.44 | accuracy 0.941
332-
# | epoch 7 | 1000/ 1782 batches | lr 0.50000 | ms/batch 4.42 | accuracy 0.939
333-
# | epoch 7 | 1500/ 1782 batches | lr 0.50000 | ms/batch 4.44 | accuracy 0.939
334-
# -----------------------------------------------------------------------------------------
327+
# -----------------------------------------------------------
328+
# | epoch 7 | 500/ 1782 batches | accuracy 0.941
329+
# | epoch 7 | 1000/ 1782 batches | accuracy 0.939
330+
# | epoch 7 | 1500/ 1782 batches | accuracy 0.939
331+
# -----------------------------------------------------------
335332
# | end of epoch 7 | time: 8.19s | valid accuracy 0.903
336-
# -----------------------------------------------------------------------------------------
337-
# | epoch 8 | 500/ 1782 batches | lr 0.05000 | ms/batch 4.44 | accuracy 0.942
338-
# | epoch 8 | 1000/ 1782 batches | lr 0.05000 | ms/batch 4.41 | accuracy 0.941
339-
# | epoch 8 | 1500/ 1782 batches | lr 0.05000 | ms/batch 4.42 | accuracy 0.942
340-
# -----------------------------------------------------------------------------------------
333+
# -----------------------------------------------------------
334+
# | epoch 8 | 500/ 1782 batches | accuracy 0.942
335+
# | epoch 8 | 1000/ 1782 batches | accuracy 0.941
336+
# | epoch 8 | 1500/ 1782 batches | accuracy 0.942
337+
# -----------------------------------------------------------
341338
# | end of epoch 8 | time: 8.16s | valid accuracy 0.904
342-
# -----------------------------------------------------------------------------------------
343-
# | epoch 9 | 500/ 1782 batches | lr 0.00500 | ms/batch 4.44 | accuracy 0.942
344-
# | epoch 9 | 1000/ 1782 batches | lr 0.00500 | ms/batch 4.42 | accuracy 0.941
345-
# | epoch 9 | 1500/ 1782 batches | lr 0.00500 | ms/batch 4.42 | accuracy 0.942
346-
# -----------------------------------------------------------------------------------------
339+
# -----------------------------------------------------------
340+
# | epoch 9 | 500/ 1782 batches | accuracy 0.942
341+
# | epoch 9 | 1000/ 1782 batches | accuracy 0.941
342+
# | epoch 9 | 1500/ 1782 batches | accuracy 0.942
343+
# -----------------------------------------------------------
347344
#| end of epoch 9 | time: 8.16s | valid accuracy 0.904
348-
# -----------------------------------------------------------------------------------------
349-
# | epoch 10 | 500/ 1782 batches | lr 0.00050 | ms/batch 4.43 | accuracy 0.940
350-
# | epoch 10 | 1000/ 1782 batches | lr 0.00050 | ms/batch 4.41 | accuracy 0.942
351-
# | epoch 10 | 1500/ 1782 batches | lr 0.00050 | ms/batch 4.41 | accuracy 0.942
352-
#i -----------------------------------------------------------------------------------------
345+
# -----------------------------------------------------------
346+
# | epoch 10 | 500/ 1782 batches | accuracy 0.940
347+
# | epoch 10 | 1000/ 1782 batches | accuracy 0.942
348+
# | epoch 10 | 1500/ 1782 batches | accuracy 0.942
349+
#i -----------------------------------------------------------
353350
# | end of epoch 10 | time: 8.15s | valid accuracy 0.904
354-
# -----------------------------------------------------------------------------------------
351+
# -----------------------------------------------------------
355352

356353

357354
######################################################################

0 commit comments

Comments
 (0)