Advanced.svelte 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <script lang="ts">
  2. export let options = {
  3. // Advanced
  4. seed: 0,
  5. stop: '',
  6. temperature: '',
  7. repeat_penalty: '',
  8. repeat_last_n: '',
  9. mirostat: '',
  10. mirostat_eta: '',
  11. mirostat_tau: '',
  12. top_k: '',
  13. top_p: '',
  14. tfs_z: '',
  15. num_ctx: ''
  16. };
  17. </script>
  18. <div class=" space-y-3 text-xs">
  19. <div>
  20. <div class=" py-0.5 flex w-full justify-between">
  21. <div class=" w-20 text-xs font-medium self-center">Seed</div>
  22. <div class=" flex-1 self-center">
  23. <input
  24. class="w-full rounded py-1.5 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none border border-gray-100 dark:border-gray-600"
  25. type="number"
  26. placeholder="Enter Seed"
  27. bind:value={options.seed}
  28. autocomplete="off"
  29. min="0"
  30. />
  31. </div>
  32. </div>
  33. </div>
  34. <div>
  35. <div class=" py-0.5 flex w-full justify-between">
  36. <div class=" w-20 text-xs font-medium self-center">Stop Sequence</div>
  37. <div class=" flex-1 self-center">
  38. <input
  39. class="w-full rounded py-1.5 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none border border-gray-100 dark:border-gray-600"
  40. type="text"
  41. placeholder="Enter Stop Sequence"
  42. bind:value={options.stop}
  43. autocomplete="off"
  44. />
  45. </div>
  46. </div>
  47. </div>
  48. <div class=" py-0.5 w-full justify-between">
  49. <div class="flex w-full justify-between">
  50. <div class=" self-center text-xs font-medium">Temperature</div>
  51. <button
  52. class="p-1 px-3 text-xs flex rounded transition"
  53. type="button"
  54. on:click={() => {
  55. options.temperature = options.temperature === '' ? 0.8 : '';
  56. }}
  57. >
  58. {#if options.temperature === ''}
  59. <span class="ml-2 self-center"> Default </span>
  60. {:else}
  61. <span class="ml-2 self-center"> Custom </span>
  62. {/if}
  63. </button>
  64. </div>
  65. {#if options.temperature !== ''}
  66. <div class="flex mt-0.5 space-x-2">
  67. <div class=" flex-1">
  68. <input
  69. id="steps-range"
  70. type="range"
  71. min="0"
  72. max="1"
  73. step="0.05"
  74. bind:value={options.temperature}
  75. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  76. />
  77. </div>
  78. <div>
  79. <input
  80. bind:value={options.temperature}
  81. type="number"
  82. class=" bg-transparent text-center w-14"
  83. min="0"
  84. max="1"
  85. step="0.05"
  86. />
  87. </div>
  88. </div>
  89. {/if}
  90. </div>
  91. <div class=" py-0.5 w-full justify-between">
  92. <div class="flex w-full justify-between">
  93. <div class=" self-center text-xs font-medium">Mirostat</div>
  94. <button
  95. class="p-1 px-3 text-xs flex rounded transition"
  96. type="button"
  97. on:click={() => {
  98. options.mirostat = options.mirostat === '' ? 0 : '';
  99. }}
  100. >
  101. {#if options.mirostat === ''}
  102. <span class="ml-2 self-center"> Default </span>
  103. {:else}
  104. <span class="ml-2 self-center"> Custom </span>
  105. {/if}
  106. </button>
  107. </div>
  108. {#if options.mirostat !== ''}
  109. <div class="flex mt-0.5 space-x-2">
  110. <div class=" flex-1">
  111. <input
  112. id="steps-range"
  113. type="range"
  114. min="0"
  115. max="2"
  116. step="1"
  117. bind:value={options.mirostat}
  118. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  119. />
  120. </div>
  121. <div>
  122. <input
  123. bind:value={options.mirostat}
  124. type="number"
  125. class=" bg-transparent text-center w-14"
  126. min="0"
  127. max="2"
  128. step="1"
  129. />
  130. </div>
  131. </div>
  132. {/if}
  133. </div>
  134. <div class=" py-0.5 w-full justify-between">
  135. <div class="flex w-full justify-between">
  136. <div class=" self-center text-xs font-medium">Mirostat Eta</div>
  137. <button
  138. class="p-1 px-3 text-xs flex rounded transition"
  139. type="button"
  140. on:click={() => {
  141. options.mirostat_eta = options.mirostat_eta === '' ? 0.1 : '';
  142. }}
  143. >
  144. {#if options.mirostat_eta === ''}
  145. <span class="ml-2 self-center"> Default </span>
  146. {:else}
  147. <span class="ml-2 self-center"> Custom </span>
  148. {/if}
  149. </button>
  150. </div>
  151. {#if options.mirostat_eta !== ''}
  152. <div class="flex mt-0.5 space-x-2">
  153. <div class=" flex-1">
  154. <input
  155. id="steps-range"
  156. type="range"
  157. min="0"
  158. max="1"
  159. step="0.05"
  160. bind:value={options.mirostat_eta}
  161. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  162. />
  163. </div>
  164. <div>
  165. <input
  166. bind:value={options.mirostat_eta}
  167. type="number"
  168. class=" bg-transparent text-center w-14"
  169. min="0"
  170. max="1"
  171. step="0.05"
  172. />
  173. </div>
  174. </div>
  175. {/if}
  176. </div>
  177. <div class=" py-0.5 w-full justify-between">
  178. <div class="flex w-full justify-between">
  179. <div class=" self-center text-xs font-medium">Mirostat Tau</div>
  180. <button
  181. class="p-1 px-3 text-xs flex rounded transition"
  182. type="button"
  183. on:click={() => {
  184. options.mirostat_tau = options.mirostat_tau === '' ? 5.0 : '';
  185. }}
  186. >
  187. {#if options.mirostat_tau === ''}
  188. <span class="ml-2 self-center"> Default </span>
  189. {:else}
  190. <span class="ml-2 self-center"> Custom </span>
  191. {/if}
  192. </button>
  193. </div>
  194. {#if options.mirostat_tau !== ''}
  195. <div class="flex mt-0.5 space-x-2">
  196. <div class=" flex-1">
  197. <input
  198. id="steps-range"
  199. type="range"
  200. min="0"
  201. max="10"
  202. step="0.5"
  203. bind:value={options.mirostat_tau}
  204. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  205. />
  206. </div>
  207. <div>
  208. <input
  209. bind:value={options.mirostat_tau}
  210. type="number"
  211. class=" bg-transparent text-center w-14"
  212. min="0"
  213. max="10"
  214. step="0.5"
  215. />
  216. </div>
  217. </div>
  218. {/if}
  219. </div>
  220. <div class=" py-0.5 w-full justify-between">
  221. <div class="flex w-full justify-between">
  222. <div class=" self-center text-xs font-medium">Top K</div>
  223. <button
  224. class="p-1 px-3 text-xs flex rounded transition"
  225. type="button"
  226. on:click={() => {
  227. options.top_k = options.top_k === '' ? 40 : '';
  228. }}
  229. >
  230. {#if options.top_k === ''}
  231. <span class="ml-2 self-center"> Default </span>
  232. {:else}
  233. <span class="ml-2 self-center"> Custom </span>
  234. {/if}
  235. </button>
  236. </div>
  237. {#if options.top_k !== ''}
  238. <div class="flex mt-0.5 space-x-2">
  239. <div class=" flex-1">
  240. <input
  241. id="steps-range"
  242. type="range"
  243. min="0"
  244. max="100"
  245. step="0.5"
  246. bind:value={options.top_k}
  247. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  248. />
  249. </div>
  250. <div>
  251. <input
  252. bind:value={options.top_k}
  253. type="number"
  254. class=" bg-transparent text-center w-14"
  255. min="0"
  256. max="100"
  257. step="0.5"
  258. />
  259. </div>
  260. </div>
  261. {/if}
  262. </div>
  263. <div class=" py-0.5 w-full justify-between">
  264. <div class="flex w-full justify-between">
  265. <div class=" self-center text-xs font-medium">Top P</div>
  266. <button
  267. class="p-1 px-3 text-xs flex rounded transition"
  268. type="button"
  269. on:click={() => {
  270. options.top_p = options.top_p === '' ? 0.9 : '';
  271. }}
  272. >
  273. {#if options.top_p === ''}
  274. <span class="ml-2 self-center"> Default </span>
  275. {:else}
  276. <span class="ml-2 self-center"> Custom </span>
  277. {/if}
  278. </button>
  279. </div>
  280. {#if options.top_p !== ''}
  281. <div class="flex mt-0.5 space-x-2">
  282. <div class=" flex-1">
  283. <input
  284. id="steps-range"
  285. type="range"
  286. min="0"
  287. max="1"
  288. step="0.05"
  289. bind:value={options.top_p}
  290. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  291. />
  292. </div>
  293. <div>
  294. <input
  295. bind:value={options.top_p}
  296. type="number"
  297. class=" bg-transparent text-center w-14"
  298. min="0"
  299. max="1"
  300. step="0.05"
  301. />
  302. </div>
  303. </div>
  304. {/if}
  305. </div>
  306. <div class=" py-0.5 w-full justify-between">
  307. <div class="flex w-full justify-between">
  308. <div class=" self-center text-xs font-medium">Repeat Penalty</div>
  309. <button
  310. class="p-1 px-3 text-xs flex rounded transition"
  311. type="button"
  312. on:click={() => {
  313. options.repeat_penalty = options.repeat_penalty === '' ? 1.1 : '';
  314. }}
  315. >
  316. {#if options.repeat_penalty === ''}
  317. <span class="ml-2 self-center"> Default </span>
  318. {:else}
  319. <span class="ml-2 self-center"> Custom </span>
  320. {/if}
  321. </button>
  322. </div>
  323. {#if options.repeat_penalty !== ''}
  324. <div class="flex mt-0.5 space-x-2">
  325. <div class=" flex-1">
  326. <input
  327. id="steps-range"
  328. type="range"
  329. min="0"
  330. max="2"
  331. step="0.05"
  332. bind:value={options.repeat_penalty}
  333. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  334. />
  335. </div>
  336. <div>
  337. <input
  338. bind:value={options.repeat_penalty}
  339. type="number"
  340. class=" bg-transparent text-center w-14"
  341. min="0"
  342. max="2"
  343. step="0.05"
  344. />
  345. </div>
  346. </div>
  347. {/if}
  348. </div>
  349. <div class=" py-0.5 w-full justify-between">
  350. <div class="flex w-full justify-between">
  351. <div class=" self-center text-xs font-medium">Repeat Last N</div>
  352. <button
  353. class="p-1 px-3 text-xs flex rounded transition"
  354. type="button"
  355. on:click={() => {
  356. options.repeat_last_n = options.repeat_last_n === '' ? 64 : '';
  357. }}
  358. >
  359. {#if options.repeat_last_n === ''}
  360. <span class="ml-2 self-center"> Default </span>
  361. {:else}
  362. <span class="ml-2 self-center"> Custom </span>
  363. {/if}
  364. </button>
  365. </div>
  366. {#if options.repeat_last_n !== ''}
  367. <div class="flex mt-0.5 space-x-2">
  368. <div class=" flex-1">
  369. <input
  370. id="steps-range"
  371. type="range"
  372. min="-1"
  373. max="128"
  374. step="1"
  375. bind:value={options.repeat_last_n}
  376. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  377. />
  378. </div>
  379. <div>
  380. <input
  381. bind:value={options.repeat_last_n}
  382. type="number"
  383. class=" bg-transparent text-center w-14"
  384. min="-1"
  385. max="128"
  386. step="1"
  387. />
  388. </div>
  389. </div>
  390. {/if}
  391. </div>
  392. <div class=" py-0.5 w-full justify-between">
  393. <div class="flex w-full justify-between">
  394. <div class=" self-center text-xs font-medium">Tfs Z</div>
  395. <button
  396. class="p-1 px-3 text-xs flex rounded transition"
  397. type="button"
  398. on:click={() => {
  399. options.tfs_z = options.tfs_z === '' ? 1 : '';
  400. }}
  401. >
  402. {#if options.tfs_z === ''}
  403. <span class="ml-2 self-center"> Default </span>
  404. {:else}
  405. <span class="ml-2 self-center"> Custom </span>
  406. {/if}
  407. </button>
  408. </div>
  409. {#if options.tfs_z !== ''}
  410. <div class="flex mt-0.5 space-x-2">
  411. <div class=" flex-1">
  412. <input
  413. id="steps-range"
  414. type="range"
  415. min="0"
  416. max="2"
  417. step="0.05"
  418. bind:value={options.tfs_z}
  419. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  420. />
  421. </div>
  422. <div>
  423. <input
  424. bind:value={options.tfs_z}
  425. type="number"
  426. class=" bg-transparent text-center w-14"
  427. min="0"
  428. max="2"
  429. step="0.05"
  430. />
  431. </div>
  432. </div>
  433. {/if}
  434. </div>
  435. <div class=" py-0.5 w-full justify-between">
  436. <div class="flex w-full justify-between">
  437. <div class=" self-center text-xs font-medium">Context Length</div>
  438. <button
  439. class="p-1 px-3 text-xs flex rounded transition"
  440. type="button"
  441. on:click={() => {
  442. options.num_ctx = options.num_ctx === '' ? 2048 : '';
  443. }}
  444. >
  445. {#if options.num_ctx === ''}
  446. <span class="ml-2 self-center"> Default </span>
  447. {:else}
  448. <span class="ml-2 self-center"> Custom </span>
  449. {/if}
  450. </button>
  451. </div>
  452. {#if options.num_ctx !== ''}
  453. <div class="flex mt-0.5 space-x-2">
  454. <div class=" flex-1">
  455. <input
  456. id="steps-range"
  457. type="range"
  458. min="1"
  459. max="16000"
  460. step="1"
  461. bind:value={options.num_ctx}
  462. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  463. />
  464. </div>
  465. <div class="">
  466. <input
  467. bind:value={options.num_ctx}
  468. type="number"
  469. class=" bg-transparent text-center w-14"
  470. min="1"
  471. max="16000"
  472. step="1"
  473. />
  474. </div>
  475. </div>
  476. {/if}
  477. </div>
  478. </div>