AdvancedParams.svelte 21.8 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
23
24
		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
25
26
		num_batch: null,
		num_keep: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
27
		max_tokens: null,
28
29
30
		use_mmap: null,
		use_mlock: null,
		num_thread: null,
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
31
		template: null
Timothy J. Baek's avatar
Timothy J. Baek committed
32
	};
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
33
34
35

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Sam McLeod's avatar
Sam McLeod committed
571
572
573
574
575
	<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
576
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Sam McLeod's avatar
Sam McLeod committed
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
				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
623
				class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Sam McLeod's avatar
Sam McLeod committed
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
662
				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
663
664
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
665
			<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
666
667

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
709
710
711
712
713
714
	{#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
715
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
716
717
718
719
720
721
722
723
					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}
724
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
725
726
727
					{/if}
				</button>
			</div>
728
729
730
731
732
733
734
735
736
737
738
739

			{#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}
740
741
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
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
747
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
748
749
750
751
752
753
754
755
					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}
756
						<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
757
758
759
					{/if}
				</button>
			</div>
760
761
762
763
764
765
766
767
768
769
770
771

			{#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}
772
773
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
774
775
776
777
778
		<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
779
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
780
781
782
783
784
785
786
787
788
789
790
791
					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>
792

Timothy J. Baek's avatar
Timothy J. Baek committed
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
			{#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}
818
819
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
820
821
822
823
824
		<!-- <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
825
					class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
Timothy J. Baek's avatar
Timothy J. Baek committed
826
827
828
829
830
831
832
833
834
835
836
					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>
837
838
			</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
839
840
841
842
843
844
845
846
847
848
			{#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
849
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
850
851
852
			{/if}
		</div> -->
	{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
853
</div>