Skip to content

Commit 6b42073

Browse files
committed
Text generation experiments
1 parent a804fce commit 6b42073

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: class_21/TextGen.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def sample(preds, temperature=1.0):
110110
exp_preds = np.exp(preds)
111111
preds = exp_preds / np.sum(exp_preds)
112112
probas = np.random.multinomial(1, preds, 1)
113-
return probas
114-
# return np.argmax(probas)
113+
# return probas
114+
return np.argmax(probas)
115115

116116

117117
# In[107]:
@@ -137,7 +137,8 @@ def sample(preds, temperature=1.0):
137137
batch_size=128,
138138
epochs=1)
139139

140-
start_index = random.randint(0, len(text) - maxlen - 1)
140+
# start_index = random.randint(0, len(text) - maxlen - 1)
141+
start_index = len(text) - maxlen - 1
141142

142143
for diversity in [0.2, 0.5, 1.0, 1.2]:
143144
print()

0 commit comments

Comments
 (0)