AdvancedParams.svelte 24.1 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
<script lang="ts">
2
	import Switch from '$lib/components/common/Switch.svelte';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
4
5
	import { getContext, createEventDispatcher } from 'svelte';

	const dispatch = createEventDispatcher();
6
7
8

	const i18n = getContext('i18n');

Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
	export let admin = false;

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
11
	export let params = {
Timothy J. Baek's avatar
Timothy J. Baek committed
12
		// Advanced
Timothy J. Baek's avatar
Timothy J. Baek committed
13
		seed: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
14
		stop: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
15
16
17
18
19
20
21
22
		temperature: null,
		frequency_penalty: null,
		repeat_last_n: null,
		mirostat: null,
		mirostat_eta: null,
		mirostat_tau: null,
		top_k: null,
		top_p: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
23
		min_p: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
24
25
		tfs_z: null,
		num_ctx: null,
Sam McLeod's avatar
Sam McLeod committed
26
27
		num_batch: null,
		num_keep: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
28
		max_tokens: null,
29
30
31
		use_mmap: null,
		use_mlock: null,
		num_thread: null,
32
		num_gpu: null,
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
33
		template: null
Timothy J. Baek's avatar
Timothy J. Baek committed
34
	};
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
35
36
37

	let customFieldName = '';
	let customFieldValue = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
38
39
40
41

	$: if (params) {
		dispatch('change', params);
	}
Timothy J. Baek's avatar
Timothy J. Baek committed
42
43
</script>

Timothy J. Baek's avatar
Timothy J. Baek committed
44
<div class=" space-y-1 text-xs">
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
45
46
47
48
49
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('Seed')}</div>

			<button
50
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
51
52
53
54
55
56
57
58
59
60
61
				type="button"
				on:click={() => {
					params.seed = (params?.seed ?? null) === null ? 0 : null;
				}}
			>
				{#if (params?.seed ?? null) === null}
					<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
				{:else}
					<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
				{/if}
			</button>
Timothy J. Baek's avatar
Timothy J. Baek committed
62
63
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
64
65
66
67
68
69
70
71
72
73
74
75
		{#if (params?.seed ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
						type="number"
						placeholder="Enter Seed"
						bind:value={params.seed}
						autocomplete="off"
						min="0"
					/>
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
76
			</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
77
78
79
80
81
82
83
84
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('Stop Sequence')}</div>

			<button
85
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
86
87
88
89
90
91
92
93
94
95
96
				type="button"
				on:click={() => {
					params.stop = (params?.stop ?? null) === null ? '' : null;
				}}
			>
				{#if (params?.stop ?? null) === null}
					<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
				{:else}
					<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
				{/if}
			</button>
Timothy J. Baek's avatar
Timothy J. Baek committed
97
		</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111

		{#if (params?.stop ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
						type="text"
						placeholder={$i18n.t('Enter stop sequence')}
						bind:value={params.stop}
						autocomplete="off"
					/>
				</div>
			</div>
		{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
112
113
114
115
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
116
			<div class=" self-center text-xs font-medium">{$i18n.t('Temperature')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
117
118

			<button
119
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
120
121
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
122
					params.temperature = (params?.temperature ?? null) === null ? 0.8 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
123
124
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
125
				{#if (params?.temperature ?? null) === null}
126
					<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
Timothy J. Baek's avatar
Timothy J. Baek committed
127
				{:else}
128
					<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
Timothy J. Baek's avatar
Timothy J. Baek committed
129
130
131
132
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
133
		{#if (params?.temperature ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
134
135
136
137
138
139
140
141
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="1"
						step="0.05"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
142
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
143
144
145
146
147
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
148
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
149
150
151
152
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
153
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
154
155
156
157
158
159
160
161
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
162
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
163
164

			<button
165
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
166
167
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
168
					params.mirostat = (params?.mirostat ?? null) === null ? 0 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
169
170
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
171
				{#if (params?.mirostat ?? null) === null}
172
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
173
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
174
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
175
176
177
178
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
179
		{#if (params?.mirostat ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
180
181
182
183
184
185
186
187
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="2"
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
188
						bind:value={params.mirostat}
Timothy J. Baek's avatar
Timothy J. Baek committed
189
190
191
192
193
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
194
						bind:value={params.mirostat}
Timothy J. Baek's avatar
Timothy J. Baek committed
195
196
197
198
199
200
201
202
203
204
205
206
207
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
208
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Eta')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
209
210

			<button
211
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
212
213
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
214
					params.mirostat_eta = (params?.mirostat_eta ?? null) === null ? 0.1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
215
216
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
217
				{#if (params?.mirostat_eta ?? null) === null}
218
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
219
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
220
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
221
222
223
224
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
225
		{#if (params?.mirostat_eta ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
226
227
228
229
230
231
232
233
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="1"
						step="0.05"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
234
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
235
236
237
238
239
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
240
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
241
242
243
244
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
245
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
246
247
248
249
250
251
252
253
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
254
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Tau')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
255
256

			<button
257
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
258
259
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
260
					params.mirostat_tau = (params?.mirostat_tau ?? null) === null ? 5.0 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
261
262
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
263
				{#if (params?.mirostat_tau ?? null) === null}
264
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
265
				{:else}
266
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
267
268
269
270
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
271
		{#if (params?.mirostat_tau ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
272
273
274
275
276
277
278
279
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="10"
						step="0.5"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
280
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
281
282
283
284
285
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
286
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
287
288
289
290
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="10"
Timothy J. Baek's avatar
Timothy J. Baek committed
291
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
292
293
294
295
296
297
298
299
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
300
			<div class=" self-center text-xs font-medium">{$i18n.t('Top K')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
301
302

			<button
303
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
304
305
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
306
					params.top_k = (params?.top_k ?? null) === null ? 40 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
307
308
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
309
				{#if (params?.top_k ?? null) === null}
310
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
311
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
312
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
313
314
315
316
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
317
		{#if (params?.top_k ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
318
319
320
321
322
323
324
325
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="100"
						step="0.5"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
326
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
327
328
329
330
331
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
332
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
333
334
335
336
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="100"
Timothy J. Baek's avatar
Timothy J. Baek committed
337
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
338
339
340
341
342
343
344
345
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
346
			<div class=" self-center text-xs font-medium">{$i18n.t('Top P')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
347
348

			<button
349
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
350
351
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
352
					params.top_p = (params?.top_p ?? null) === null ? 0.9 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
353
354
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
355
				{#if (params?.top_p ?? null) === null}
356
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
357
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
358
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
359
360
361
362
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
363
		{#if (params?.top_p ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
364
365
366
367
368
369
370
371
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="1"
						step="0.05"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
372
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
373
374
375
376
377
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
378
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
379
380
381
382
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
383
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
384
385
386
387
388
389
					/>
				</div>
			</div>
		{/if}
	</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('Min P')}</div>

			<button
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
				type="button"
				on:click={() => {
					params.min_p = (params?.min_p ?? null) === null ? 0.0 : null;
				}}
			>
				{#if (params?.min_p ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
				{/if}
			</button>
		</div>

		{#if (params?.min_p ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="1"
						step="0.05"
						bind:value={params.min_p}
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
						bind:value={params.min_p}
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
						step="any"
					/>
				</div>
			</div>
		{/if}
	</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
436
437
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
Timothy J. Baek's avatar
Timothy J. Baek committed
438
			<div class=" self-center text-xs font-medium">{$i18n.t('Frequency Penalty')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
439
440

			<button
441
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
442
443
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
444
					params.frequency_penalty = (params?.frequency_penalty ?? null) === null ? 1.1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
445
446
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
447
				{#if (params?.frequency_penalty ?? null) === null}
448
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
449
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
450
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
451
452
453
454
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
455
		{#if (params?.frequency_penalty ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
456
457
458
459
460
461
462
463
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="2"
						step="0.05"
464
						bind:value={params.frequency_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
465
466
467
468
469
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
470
						bind:value={params.frequency_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
471
472
473
474
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
Timothy J. Baek's avatar
Timothy J. Baek committed
475
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
476
477
478
479
480
481
482
483
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
484
			<div class=" self-center text-xs font-medium">{$i18n.t('Repeat Last N')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
485
486

			<button
487
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
488
489
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
490
					params.repeat_last_n = (params?.repeat_last_n ?? null) === null ? 64 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
491
492
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
493
				{#if (params?.repeat_last_n ?? null) === null}
494
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
495
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
496
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
497
498
499
500
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
501
		{#if (params?.repeat_last_n ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
502
503
504
505
506
507
508
509
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="-1"
						max="128"
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
510
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
511
512
513
514
515
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
516
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
517
518
519
520
521
522
523
524
525
526
527
528
529
						type="number"
						class=" bg-transparent text-center w-14"
						min="-1"
						max="128"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
530
			<div class=" self-center text-xs font-medium">{$i18n.t('Tfs Z')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
531
532

			<button
533
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
534
535
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
536
					params.tfs_z = (params?.tfs_z ?? null) === null ? 1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
537
538
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
539
				{#if (params?.tfs_z ?? null) === null}
540
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
541
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
542
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
543
544
545
546
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
547
		{#if (params?.tfs_z ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
548
549
550
551
552
553
554
555
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="0"
						max="2"
						step="0.05"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
556
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
557
558
559
560
561
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
562
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
563
564
565
566
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
Timothy J. Baek's avatar
Timothy J. Baek committed
567
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
568
569
570
571
572
573
574
575
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
576
			<div class=" self-center text-xs font-medium">{$i18n.t('Context Length')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
577
578

			<button
579
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
580
581
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
582
					params.num_ctx = (params?.num_ctx ?? null) === null ? 2048 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
583
584
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
585
				{#if (params?.num_ctx ?? null) === null}
586
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
587
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
588
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
589
590
591
592
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
593
		{#if (params?.num_ctx ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
594
595
596
597
598
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
Timothy J. Baek's avatar
Timothy J. Baek committed
599
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
600
						max="10240000"
Timothy J. Baek's avatar
Timothy J. Baek committed
601
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
602
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
603
604
605
606
607
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
608
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
609
610
						type="number"
						class=" bg-transparent text-center w-14"
Timothy J. Baek's avatar
Timothy J. Baek committed
611
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
612
						step="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
613
614
615
616
617
					/>
				</div>
			</div>
		{/if}
	</div>
618

Sam McLeod's avatar
Sam McLeod committed
619
620
621
622
623
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('Batch Size (num_batch)')}</div>

			<button
624
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Sam McLeod's avatar
Sam McLeod committed
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
				type="button"
				on:click={() => {
					params.num_batch = (params?.num_batch ?? null) === null ? 512 : null;
				}}
			>
				{#if (params?.num_batch ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
				{/if}
			</button>
		</div>

		{#if (params?.num_batch ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="256"
						max="8192"
						step="256"
						bind:value={params.num_batch}
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
						bind:value={params.num_batch}
						type="number"
						class=" bg-transparent text-center w-14"
						min="256"
						step="256"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">
				{$i18n.t('Tokens To Keep On Context Refresh (num_keep)')}
			</div>

			<button
671
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Sam McLeod's avatar
Sam McLeod committed
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
				type="button"
				on:click={() => {
					params.num_keep = (params?.num_keep ?? null) === null ? 24 : null;
				}}
			>
				{#if (params?.num_keep ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
				{/if}
			</button>
		</div>

		{#if (params?.num_keep ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="-1"
						max="10240000"
						step="1"
						bind:value={params.num_keep}
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
						bind:value={params.num_keep}
						type="number"
						class=" bg-transparent text-center w-14"
						min="-1"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
711
712
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
713
			<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
714
715

			<button
716
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
717
718
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
719
					params.max_tokens = (params?.max_tokens ?? null) === null ? 128 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
720
721
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
722
				{#if (params?.max_tokens ?? null) === null}
723
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
724
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
725
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
726
727
728
729
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
730
		{#if (params?.max_tokens ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
731
732
733
734
735
736
737
738
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="-2"
						max="16000"
						step="1"
739
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
740
741
742
743
744
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
745
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
746
747
748
749
750
751
752
753
754
755
						type="number"
						class=" bg-transparent text-center w-14"
						min="-2"
						max="16000"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>
756

Timothy J. Baek's avatar
Timothy J. Baek committed
757
758
759
760
761
762
	{#if admin}
		<div class=" py-0.5 w-full justify-between">
			<div class="flex w-full justify-between">
				<div class=" self-center text-xs font-medium">{$i18n.t('use_mmap (Ollama)')}</div>

				<button
763
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
764
765
766
767
768
769
770
771
					type="button"
					on:click={() => {
						params.use_mmap = (params?.use_mmap ?? null) === null ? true : null;
					}}
				>
					{#if (params?.use_mmap ?? null) === null}
						<span class="ml-2 self-center">{$i18n.t('Default')}</span>
					{:else}
772
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
773
774
775
					{/if}
				</button>
			</div>
776
777
778
779
780
781
782
783
784
785
786
787

			{#if (params?.use_mmap ?? null) !== null}
				<div class="flex justify-between items-center mt-1">
					<div class="text-xs text-gray-500">
						{params.use_mmap ? 'Enabled' : 'Disabled'}
					</div>

					<div class=" pr-2">
						<Switch bind:state={params.use_mmap} />
					</div>
				</div>
			{/if}
788
789
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
790
791
792
793
794
		<div class=" py-0.5 w-full justify-between">
			<div class="flex w-full justify-between">
				<div class=" self-center text-xs font-medium">{$i18n.t('use_mlock (Ollama)')}</div>

				<button
795
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
796
797
798
799
800
801
802
803
					type="button"
					on:click={() => {
						params.use_mlock = (params?.use_mlock ?? null) === null ? true : null;
					}}
				>
					{#if (params?.use_mlock ?? null) === null}
						<span class="ml-2 self-center">{$i18n.t('Default')}</span>
					{:else}
804
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
805
806
807
					{/if}
				</button>
			</div>
808
809
810
811
812
813
814
815
816
817
818
819

			{#if (params?.use_mlock ?? null) !== null}
				<div class="flex justify-between items-center mt-1">
					<div class="text-xs text-gray-500">
						{params.use_mlock ? 'Enabled' : 'Disabled'}
					</div>

					<div class=" pr-2">
						<Switch bind:state={params.use_mlock} />
					</div>
				</div>
			{/if}
820
821
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
822
823
824
825
826
		<div class=" py-0.5 w-full justify-between">
			<div class="flex w-full justify-between">
				<div class=" self-center text-xs font-medium">{$i18n.t('num_thread (Ollama)')}</div>

				<button
827
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
828
829
830
831
832
833
834
835
836
837
838
839
					type="button"
					on:click={() => {
						params.num_thread = (params?.num_thread ?? null) === null ? 2 : null;
					}}
				>
					{#if (params?.num_thread ?? null) === null}
						<span class="ml-2 self-center">{$i18n.t('Default')}</span>
					{:else}
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
					{/if}
				</button>
			</div>
840

Timothy J. Baek's avatar
Timothy J. Baek committed
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
			{#if (params?.num_thread ?? null) !== null}
				<div class="flex mt-0.5 space-x-2">
					<div class=" flex-1">
						<input
							id="steps-range"
							type="range"
							min="1"
							max="256"
							step="1"
							bind:value={params.num_thread}
							class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
						/>
					</div>
					<div class="">
						<input
							bind:value={params.num_thread}
							type="number"
							class=" bg-transparent text-center w-14"
							min="1"
							max="256"
							step="1"
						/>
					</div>
				</div>
			{/if}
866
867
		</div>

868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
		<div class=" py-0.5 w-full justify-between">
			<div class="flex w-full justify-between">
				<div class=" self-center text-xs font-medium">{$i18n.t('num_gpu (Ollama)')}</div>

				<button
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
					type="button"
					on:click={() => {
						params.num_gpu = (params?.num_gpu ?? null) === null ? 0 : null;
					}}
				>
					{#if (params?.num_gpu ?? null) === null}
						<span class="ml-2 self-center">{$i18n.t('Default')}</span>
					{:else}
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
					{/if}
				</button>
			</div>

			{#if (params?.num_gpu ?? null) !== null}
				<div class="flex mt-0.5 space-x-2">
					<div class=" flex-1">
						<input
							id="steps-range"
							type="range"
							min="0"
							max="256"
							step="1"
							bind:value={params.num_gpu}
							class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
						/>
					</div>
					<div class="">
						<input
							bind:value={params.num_gpu}
							type="number"
							class=" bg-transparent text-center w-14"
							min="0"
							max="256"
							step="1"
						/>
					</div>
				</div>
			{/if}
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
914
915
916
917
918
		<!-- <div class=" py-0.5 w-full justify-between">
			<div class="flex w-full justify-between">
				<div class=" self-center text-xs font-medium">{$i18n.t('Template')}</div>

				<button
919
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
920
921
922
923
924
925
926
927
928
929
930
					type="button"
					on:click={() => {
						params.template = (params?.template ?? null) === null ? '' : null;
					}}
				>
					{#if (params?.template ?? null) === null}
						<span class="ml-2 self-center">{$i18n.t('Default')}</span>
					{:else}
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
					{/if}
				</button>
931
932
			</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
933
934
935
936
937
938
939
940
941
942
			{#if (params?.template ?? null) !== null}
				<div class="flex mt-0.5 space-x-2">
					<div class=" flex-1">
						<textarea
							class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg -mb-1"
							placeholder="Write your model template content here"
							rows="4"
							bind:value={params.template}
						/>
					</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
943
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
944
945
946
			{/if}
		</div> -->
	{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
947
</div>