AdvancedParams.svelte 20.6 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
<script lang="ts">
Timothy J. Baek's avatar
Timothy J. Baek committed
2
3
4
	import { getContext, createEventDispatcher } from 'svelte';

	const dispatch = createEventDispatcher();
5
6
7

	const i18n = getContext('i18n');

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

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

	let customFieldName = '';
	let customFieldValue = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
35
36
37
38

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

Timothy J. Baek's avatar
Timothy J. Baek committed
41
<div class=" space-y-1 text-xs">
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	<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
				class="p-1 px-3 text-xs flex rounded transition"
				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
59
60
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
61
62
63
64
65
66
67
68
69
70
71
72
		{#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
73
			</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
		{/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
				class="p-1 px-3 text-xs flex rounded transition"
				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
94
		</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
95
96
97
98
99
100
101
102
103
104
105
106
107
108

		{#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
109
110
111
112
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
130
		{#if (params?.temperature ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
131
132
133
134
135
136
137
138
			<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
139
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
140
141
142
143
144
						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
145
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
146
147
148
149
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
150
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
151
152
153
154
155
156
157
158
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
176
		{#if (params?.mirostat ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
177
178
179
180
181
182
183
184
			<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
185
						bind:value={params.mirostat}
Timothy J. Baek's avatar
Timothy J. Baek committed
186
187
188
189
190
						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
191
						bind:value={params.mirostat}
Timothy J. Baek's avatar
Timothy J. Baek committed
192
193
194
195
196
197
198
199
200
201
202
203
204
						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">
205
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Eta')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
206
207
208
209
210

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

Timothy J. Baek's avatar
Timothy J. Baek committed
222
		{#if (params?.mirostat_eta ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
223
224
225
226
227
228
229
230
			<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
231
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
232
233
234
235
236
						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
237
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
238
239
240
241
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
242
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
243
244
245
246
247
248
249
250
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
268
		{#if (params?.mirostat_tau ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
269
270
271
272
273
274
275
276
			<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
277
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
278
279
280
281
282
						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
283
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
284
285
286
287
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="10"
Timothy J. Baek's avatar
Timothy J. Baek committed
288
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
289
290
291
292
293
294
295
296
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
314
		{#if (params?.top_k ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
315
316
317
318
319
320
321
322
			<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
323
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
324
325
326
327
328
						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
329
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
330
331
332
333
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="100"
Timothy J. Baek's avatar
Timothy J. Baek committed
334
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
335
336
337
338
339
340
341
342
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
360
		{#if (params?.top_p ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
361
362
363
364
365
366
367
368
			<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
369
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
370
371
372
373
374
						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
375
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
376
377
378
379
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
380
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
381
382
383
384
385
386
387
388
					/>
				</div>
			</div>
		{/if}
	</div>

	<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
389
			<div class=" self-center text-xs font-medium">{$i18n.t('Frequency Penalty')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
390
391
392
393
394

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
395
					params.frequency_penalty = (params?.frequency_penalty ?? null) === null ? 1.1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
396
397
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
398
				{#if (params?.frequency_penalty ?? null) === null}
399
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
400
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
401
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
402
403
404
405
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
406
		{#if (params?.frequency_penalty ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
407
408
409
410
411
412
413
414
			<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"
415
						bind:value={params.frequency_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
416
417
418
419
420
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
421
						bind:value={params.frequency_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
422
423
424
425
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
Timothy J. Baek's avatar
Timothy J. Baek committed
426
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
427
428
429
430
431
432
433
434
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
452
		{#if (params?.repeat_last_n ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
453
454
455
456
457
458
459
460
			<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
461
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
462
463
464
465
466
						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
467
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
468
469
470
471
472
473
474
475
476
477
478
479
480
						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">
481
			<div class=" self-center text-xs font-medium">{$i18n.t('Tfs Z')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
482
483
484
485
486

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

Timothy J. Baek's avatar
Timothy J. Baek committed
498
		{#if (params?.tfs_z ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
499
500
501
502
503
504
505
506
			<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
507
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
508
509
510
511
512
						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
513
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
514
515
516
517
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
Timothy J. Baek's avatar
Timothy J. Baek committed
518
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
519
520
521
522
523
524
525
526
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
544
		{#if (params?.num_ctx ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
545
546
547
548
549
			<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
550
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
551
						max="10240000"
Timothy J. Baek's avatar
Timothy J. Baek committed
552
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
553
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
554
555
556
557
558
						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
559
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
560
561
						type="number"
						class=" bg-transparent text-center w-14"
Timothy J. Baek's avatar
Timothy J. Baek committed
562
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
563
						step="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
564
565
566
567
568
					/>
				</div>
			</div>
		{/if}
	</div>
569

Sam McLeod's avatar
Sam McLeod committed
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
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
	<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
				class="p-1 px-3 text-xs flex rounded transition"
				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
				class="p-1 px-3 text-xs flex rounded transition"
				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
662
663
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
664
			<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
665
666
667
668
669

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
670
					params.max_tokens = (params?.max_tokens ?? null) === null ? 128 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
671
672
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
673
				{#if (params?.max_tokens ?? null) === null}
674
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
675
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
676
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
677
678
679
680
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
681
		{#if (params?.max_tokens ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
682
683
684
685
686
687
688
689
			<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"
690
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
691
692
693
694
695
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
696
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
697
698
699
700
701
702
703
704
705
706
						type="number"
						class=" bg-transparent text-center w-14"
						min="-2"
						max="16000"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>
707

Timothy J. Baek's avatar
Timothy J. Baek committed
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
	{#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
					class="p-1 px-3 text-xs flex rounded transition"
					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}
						<span class="ml-2 self-center">{$i18n.t('On')}</span>
					{/if}
				</button>
			</div>
727
728
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
		<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
					class="p-1 px-3 text-xs flex rounded transition"
					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}
						<span class="ml-2 self-center">{$i18n.t('On')}</span>
					{/if}
				</button>
			</div>
747
748
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
		<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
					class="p-1 px-3 text-xs flex rounded transition"
					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>
767

Timothy J. Baek's avatar
Timothy J. Baek committed
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
			{#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}
793
794
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
		<!-- <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
					class="p-1 px-3 text-xs flex rounded transition"
					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>
812
813
			</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
814
815
816
817
818
819
820
821
822
823
			{#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
824
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
825
826
827
			{/if}
		</div> -->
	{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
828
</div>