Skip to content

Commit 2b794a2

Browse files
committed
reverts to version used in video
1 parent 858b9fc commit 2b794a2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

videos/cnn-text/imdb-cnn.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import numpy as np
1010
from keras.preprocessing import text
1111

12+
import imdb
13+
1214
wandb.init()
1315
config = wandb.config
1416

@@ -22,7 +24,13 @@
2224
config.hidden_dims = 250
2325
config.epochs = 10
2426

25-
(X_train, y_train), (X_test, y_test) = imdb.load_data(num_words=config.vocab_size, maxlen=config.maxlen)
27+
(X_train, y_train), (X_test, y_test) = imdb.load_imdb()
28+
29+
30+
tokenizer = text.Tokenizer(num_words=config.vocab_size)
31+
tokenizer.fit_on_texts(X_train)
32+
X_train = tokenizer.texts_to_matrix(X_train)
33+
X_test = tokenizer.texts_to_matrix(X_test)
2634

2735
X_train = sequence.pad_sequences(X_train, maxlen=config.maxlen)
2836
X_test = sequence.pad_sequences(X_test, maxlen=config.maxlen)

0 commit comments

Comments
 (0)