-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
198 lines (150 loc) · 5.24 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!doctype html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://github.com/lucylow/Yeezy-Taught-Me/tree/master/yeezytaughtme/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<style>
.monospace {
font-family: monospace;
padding: 50px;
}
.input-title {
display: inline-block;
width: 12em;
}
select {
font-size: 14pt;
}
button {
margin: 3px;
}
input:disabled {
background: #eeeeee;
}
textarea {
width: 98%;
}
</style>
<body class='tfjs-example-container'>
<section class='title-area'>
<div class="jumbotron text-center">
<h1>Yeezy Taught Me Text Generation:</h1>
<p>Train a LSTM (Long Short Term Memory) model to generate text</p>
</div>
</section>
<div class="container">
<section>
<p class='section-head'><strong>DESCRIPTION</strong></p>
<p>
Yeezy Taught Me Text Generation.
A neural network trained next-character prediction model. The model is designed to predict the <em>next character</em> in a text given some preceding string of characters.
Doing this repeatedly builds up a text, character by character.
</p>
<p>
As Kanye West said "Lack of visual empathy, equates the meaning of L-O-V-E."
</p>
</section>
<section>
<p class='section-head'> <strong>YEEZY'S STATUS </strong> </p>
<div id="app-status">
Please select a text data source or enter your custom text in the text box below and click <em>"Load source data"</em>.
</div>
</section>
<section>
<p class='section-head'><strong>YEEZY'S SOURCE DATA</strong></p>
<select id="text-data-select"></select>
<button id="load-text-data">Load source data</button>
<div>
<textarea class="monospace" id="test-text" value="" rows="10"></textarea>
</div>
</section>
<section>
<p class='section-head'><strong>YEEZY'S MODEL LOADING</strong></p>
<div>
<p>
<em>
Model saved in IndexedDB:
<span id="model-available">Load text data first.</span>
</em>
</p>
<div>
<span class="input-title">LSTM layer size(s) (e.g., 128 or 100,50):</span>
<input id="lstm-layer-sizes" value="128"></input>
<button id="create-or-load-model" disabled="true">Create or load model</button>
<button id="delete-model" disabled="true">Delete existing model</button>
</div>
</div>
</section>
<section>
<p class='section-head'><strong>YEEZY'S MODEL TRAINING</strong></p>
<p>
It can take a while to generate an effective model. Try increasing the number of <em>epochs</em> to improve the
results.
</p>
<div class="with-cols">
<div>
<div>
<span class="input-title">Number of Epochs:</span>
<input id="epochs" value="5"></input>
</div>
<div>
<span class="input-title">Examples per epoch:</span>
<input id="examples-per-epoch" value="2048"></input>
</div>
<div>
<span class="input-title">Batch size:</span>
<input id="batch-size" value="128"></input>
</div>
<div>
<span class="input-title">Validation spilt:</span>
<input id="validation-split" value="0.0625"></input>
</div>
<div>
<span class="input-title">Learning rate:</span>
<input id="learning-rate" value="1e-2"></input>
</div>
<div>
<button id="train-model" disabled="true">Train model</button>
</div>
</div>
<div class="canvases" id="batch-loss-canvas"></div>
<div class="canvases" id="epoch-loss-canvas"></div>
</div>
</section>
<section>
<p class='section-head'><strong>YEEZY'S TEXT GENERATION PARAMETERS</strong></p>
<p>
To generate text the model needs to have some number of preceding characters from which it continues,
we call these characters the <em>seed text</em>. You can type one in, or we will extract a random substring from
the input text to be the seed text. Note that the <strong> seed text must be at least 40 characters long</strong>.
</p>
<div>
<span class="input-title">Length of generated text:</span>
<input id="generate-length" value="200"></input>
</div>
<div>
<span class="input-title">Generation temperature:</span>
<input id="temperature" value="0.75"></input>
</div>
<div>
<button id="generate-text" disabled="true">Generate text</button>
<span id="text-generation-status"></span>
</div>
<div>
<span class="input-title">Seed text:</span>
<textarea class="monospace" id="seed-text" value="" rows="4"></textarea>
</div>
<p class='section-head'><strong>YEEZY'S MODEL OUTPUT</strong></p>
<div>
<span class="input-title"><Strong>Yeezy taught-me-well. </strong> Generated text:</span>
<textarea class="monospace" id="generated-text" readonly="true" value="" rows="10"></textarea>
</div>
<div>
</div>
</section>
</div>
</body>
<script src="index.js"></script>