File size: 12,203 Bytes
8969f81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<header>
	<div class="header">
		{{#if doc.hasCustomLogo}}
			{{#eq doc.model "ctrl"}}
				<a class="cross-collab" href="/model/ctrl">
					<img class="logo-collab logo-hf" src="/front/assets/huggingface_logo.svg">
					<img class="cross" src="/front/assets/cross-collab.svg">
					<img class="logo-collab logo-salesforce" src="/front/assets/Salesforce_logo.svg">
				</a>
			{{/eq}}
			{{#eq doc.model "pplm"}}
				<a class="cross-collab" href="/model/pplm">
					<img class="logo-collab logo-hf" src="/front/assets/huggingface_logo.svg">
					<img class="cross" src="/front/assets/cross-collab.svg">
					<img class="logo-collab logo-uber" src="/front/assets/Uber_logo.svg">
				</a>
			{{/eq}}
		{{else}}
			<a href="/">
				<img class="logo" src="/front/assets/unicorn-tweaked.svg">
			</a>
		{{/if}}
		<div class="header-inner" data-page-editable="{{editable}}">
			<div class="title">
				{{#if doc.title}}
					{{doc.title}}
				{{else}}
					Write With Transformer
				{{/if}}
				{{#if doc.modelFamily}}
					<code>
						{{#if doc.title}}
							written with {{doc.modelFamily}}
						{{else}}
							{{doc.modelFamily}}
						{{/if}}
					</code>
				{{/if}}
				<a target="_blank" href="{{doc.modelInfoLink}}">
					<img class="info" src="/front/assets/Icon-info.svg">
				</a>
			</div>
			{{#if editable}}
				<div class="toolbar">
					<div class="toolbar-el">
						<a href="#" class="js-shuffle"><img src="/front/assets/iconmonstr-media-control-55.svg"> Shuffle initial text</a>
					</div>
					<div class="toolbar-el">
						<a href="#" class="js-trigger"><img src="/front/assets/iconmonstr-download-14.svg"> Trigger autocomplete</a>
						&nbsp; or <kbd>tab</kbd>
					</div>
					<div class="toolbar-el">
						Select suggestion <kbd>↑</kbd> <kbd>↓</kbd> and <kbd>enter</kbd>
					</div>
					<div class="toolbar-el">
						Cancel suggestion <kbd>esc</kbd>
					</div>
				</div>
			{{/if}}
		</div>
		<div class="rightbar">
			{{#if legacy}}
				<a href="#" class="js-share">Share <img src="/front/assets/iconmonstr-share-11.svg"></a>
			{{else}}
				{{#if editable}}
					<a href="#" class="js-save">Save &amp; Publish <img src="/front/assets/icon-publish.svg"></a>
				{{else}}
					<span class="doc-status">Read-only document</span>
					<a class="btn btn-primary js-duplicate" href="#">Duplicate &amp; edit</a>
				{{/if}}
			{{/if}}
		</div>
	</div>
	<div class="ruler"></div>
</header>

<div class="page-wrapper">
	<div class="page-container">
		<img class="js-loader hide" src="/front/assets/tail-spin.svg">
		<a href="#" class="js-share share-screenshot fadeout hide" data-html2canvas-ignore>
			Share screenshot <img src="/front/assets/iconmonstr-share-11-purple.svg">
		</a>
		<div class="page-inner">
			<div class="editor">
				{{#if doc.getHTML}}
					{{{ doc.getHTML }}}
				{{else}}
					{{#eq doc.model "pplm"}}
						<p>
							PPLM builds on top of other large transformer-based generative models (like GPT-2), where it enables 
							finer-grained control of attributes of the generated language (e.g. gradually switching topic 🐱 or sentiment πŸ˜ƒ).
						</p>
						<p>
							⚠️ 🐍 We had to turn off the PPLM machine as it was costly to host – try it locally using
							<a target="_blank" href="https://github.com/huggingface/transformers">transformers</a>,
							or contact us if you really need it as a hosted service. 🐍 ⚠️
							{{!-- Replace this text and hit tab to trigger generations. Have fun! --}}
						</p>
					{{else}}
						<p>
							See how a modern neural network auto-completes your text πŸ€—
						</p>
						<p>
							{{!-- In February, OpenAI unveiled a language model called GPT-2 – for Generative Pre-Trained Transformer – that generates coherent paragraphs of text one word at a time. --}}
							This site, built by the <a target="_blank" href="https://huggingface.co">Hugging Face</a> team, lets you write a whole document directly from your browser, 
							and you can trigger the Transformer anywhere using the Tab key. It's like having a smart machine that completes your thoughts πŸ˜€
						</p>
						<p>
							Get started by typing a custom snippet, 
							<a target="_blank" href="https://github.com/huggingface/transformers">check out the repository</a>,
							or <a href="#js-shuffle">try one of the examples</a>. Have fun!
						</p>
					{{/eq}}
				{{/if}}
			</div>
			<div class="watermark">
				<strong>Written by Transformer</strong> <span class="sep">Β·</span> <span class="website">transformer.huggingface.co πŸ¦„</span>
			</div>
		</div>
	</div>
</div>

{{#if editable}}
	<div class="decoder-settings">
		<div class="title">
			Model &amp; decoder settings
			<a target="_blank" href="{{doc.modelInfoLink}}">
				<img src="/front/assets/Icon-info.svg">
			</a>
		</div>
		{{#eq doc.model "pplm"}}
			<div class="setting bow_or_discrim">
				<div class="desc">
					<span>Bag-of-words</span>
				</div>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="legal" checked> πŸ‘©β€πŸ’Ό legal</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="military"> πŸŽ– military</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="monsters"> πŸ•· monsters</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="politics"> 🀴 politics</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="religion"> πŸ”― religion</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="science"> πŸ§ͺ science</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="space"> πŸš€ space</label>
				<label class="radio block"><input type="radio" name="bow_or_discrim" value="technology"> ⌨️ technology</label>
				
				<div class="desc">
					<span>Discriminators</span>
				</div>
				<div>
					<label class="radio block"><input type="radio" name="bow_or_discrim" value="clickbait:0"> 🐭 clickbait</label>
					<label class="radio block"><input type="radio" name="bow_or_discrim" value="clickbait:1"> πŸ™ non clickbait</label>
				</div>
				<div>
					<label class="radio block"><input type="radio" name="bow_or_discrim" value="sentiment:2"> πŸ™‚ positive sentiment</label>
					<label class="radio block"><input type="radio" name="bow_or_discrim" value="sentiment:3"> πŸ™ neg sentiment</label>
				</div>
				{{!-- <div>
					<label class="radio block"><input type="radio" name="bow_or_discrim" value="toxicity:0"> πŸ‘ non toxic</label>
					<label class="radio block"><input type="radio" name="bow_or_discrim" value="toxicity:1"> ⚠️ toxic</label>
				</div> --}}
			</div>
		{{/eq}}
		
		<div class="setting model_size">
			{{#not doc.model "pplm"}}
				<div class="desc">
					<span>Model size</span><span class="js-val"></span>
				</div>
			{{/not}}
			{{#eq doc.model "pplm"}}
				<span class="hide js-val">pplm</span>
			{{/eq}}
			
			{{#eq doc.model "distil-gpt2"}}
				<input
					class="slider" type="range" step="1"
					min="0" max="3"
					value="0"
					data-value-0="distilgpt2/small" data-value-1="gpt2/small" data-value-2="gpt2/medium"
					data-value-3="gpt2/large"
				>
			{{/eq}}
			{{#eq doc.model "arxiv-nlp"}}
				<input
					class="slider" type="range" step="1"
					min="0" max="4"
					value="4"
					data-value-0="distilgpt2/small" data-value-1="gpt2/small" data-value-2="gpt2/medium"
					data-value-3="gpt2/large" data-value-4="gpt2/arxiv-nlp"
				>
			{{/eq}}
			{{#eq doc.model "gpt2-large"}}
				<input
					class="slider" type="range" step="1"
					min="0" max="3"
					value="3"
					data-value-0="distilgpt2/small" data-value-1="gpt2/small" data-value-2="gpt2/medium"
					data-value-3="gpt2/large"
				>
			{{/eq}}
			{{#eq doc.model "xlnet"}}
				<input
					class="slider" type="range" step="1"
					min="0" max="0"
					value="0"
					data-value-0="xlnet"
				>
			{{/eq}}
			{{#eq doc.model "gpt"}}
				<input
					class="slider" type="range" step="1"
					min="0" max="0"
					value="0"
					data-value-0="gpt"
				>
			{{/eq}}
		</div>
		{{#not doc.model "pplm"}}
			<div class="setting top_p">
				<div class="desc">
					<span>Top-p</span><span class="js-val"></span>
				</div>
				<input
					class="slider js-inverted" type="range" step="any"
					min="0" max="1"
					value="0.9"
				>
			</div>
			<div class="setting temperature">
				<div class="desc">
					<span>Temperature</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="any"
					min="0" max="3"
					value="1"
				>
			</div>
		{{/not}}
		{{#eq doc.model "pplm"}}
			<div class="setting step_size">
				<div class="desc">
					<span>Step size</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="0.01"
					min="0.01" max="0.1"
					value="0.05"
				>
			</div>
			<div class="setting kl_scale">
				<div class="desc">
					<span>KL-scale</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="0.01"
					min="0" max="1"
					value="0.01"
				>
			</div>
			<div class="setting gm_scale">
				<div class="desc">
					<span>GM-scale</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="0.01"
					min="0" max="1"
					value="0.95"
				>
			</div>
			<div class="setting num_iterations">
				<div class="desc">
					<span>Num iterations (impacts gen. time)</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="1"
					min="1" max="30"
					value="3"
				>
			</div>
			<div class="setting gen_length">
				<div class="desc">
					<span>Gen. length (impacts gen. time)</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="1"
					min="5" max="80"
					value="30"
				>
			</div>
			<div class="setting use_sampling">
				<div class="desc">
					<span>Use sampling</span>
				</div>
				<input type="checkbox" name="use_sampling" checked>
			</div>
		{{/eq}}
		
		{{#not doc.model "pplm"}}
			<div class="setting max_time">
				<div class="desc">
					<span>Max time</span><span class="js-val"></span>
				</div>
				<input
					class="slider" type="range" step="0.1"
					min="1" max="5"
					value="1"
				>
			</div>
		{{/not}}
	</div>
{{/if}}

<div class="modal hide share-screenshot">
	<div class="modal-inner">
		<div class="modal-content">
			<p>From desktop:</p>
			<ol>
				<li>Right-click on your completion below and select "<strong>Copy Image</strong>".</li>
				<li>To share on Twitter, start a tweet and paste the image.</li>
			</ol>
			<p>From mobile:</p>
			<ol>
				<li>Press and hold (long press) your completion below and either "<strong>Share</strong>" directly or "<strong>Copy Image</strong>".</li>
				<li>If you copied the image, you can long press in Twitter to paste it into a new tweet.</li>
			</ol>
		</div>
		<img class="js-loader big" src="/front/assets/oval.svg">
		<img class="js-result">
		<div class="buttons">
			<a href="#" class="js-close">Done</a>
		</div>
	</div>
</div>

{{#if editable}}
	<div class="modal hide save-publish">
		<div class="modal-inner">
			<div class="modal-content">
				<div class="modal-title">Save &amp; Publish</div>
				<div>Your document will be shared at this url:</div>
				<input
					readonly type="text" class="doc-url"
					value="{{doc.shareUrl}}"
				>
				<div>To be able to edit this document in the future, keep this url:</div>
				<input
					readonly type="text" class="doc-url doc-edit-url"
					value="{{doc.editUrl}}"
				>
				<div class="descr-doc-title">Title</div>
				<form>
					<input
						required type="text" class="doc-title"
						placeholder="Enter your document’s title..."
						value="{{ doc.title }}"
					>
				</form>
			</div>
			<img class="js-loader hide" src="/front/assets/oval.svg">
			<div class="buttons">
				<a href="#" class="js-save">Save</a>
			</div>
		</div>
	</div>
{{/if}}

<script>
	window.doc = {
		shortId: "{{doc.shortId}}",
		longId:  "{{doc.longId}}",
		model:   "{{doc.model}}",
	};
	{{#if doc.contents}}
		window.QUILL_C = {{{ doc.contentsJson }}};
	{{/if}}
</script>