Advanced.svelte 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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">
  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. bind:value={options.temperature}
  74. step="0.05"
  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. />
  84. </div>
  85. </div>
  86. {/if}
  87. </div>
  88. <div class=" py-0.5 w-full justify-between">
  89. <div class="flex w-full justify-between">
  90. <div class=" self-center text-xs font-medium">Mirostat</div>
  91. <button
  92. class="p-1 px-3 text-xs flex rounded transition"
  93. type="button"
  94. on:click={() => {
  95. options.mirostat = options.mirostat === '' ? 0 : '';
  96. }}
  97. >
  98. {#if options.mirostat === ''}
  99. <span class="ml-2 self-center"> Default </span>
  100. {:else}
  101. <span class="ml-2 self-center"> Custom </span>
  102. {/if}
  103. </button>
  104. </div>
  105. {#if options.mirostat !== ''}
  106. <div class="flex mt-0.5 space-x-2">
  107. <div class=" flex-1">
  108. <input
  109. id="steps-range"
  110. type="range"
  111. min="0"
  112. max="2"
  113. bind:value={options.mirostat}
  114. step="1"
  115. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  116. />
  117. </div>
  118. <div>
  119. <input
  120. bind:value={options.mirostat}
  121. type="number"
  122. class=" bg-transparent text-center w-14"
  123. />
  124. </div>
  125. </div>
  126. {/if}
  127. </div>
  128. <div class=" py-0.5 w-full justify-between">
  129. <div class="flex w-full justify-between">
  130. <div class=" self-center text-xs font-medium">Mirostat Eta</div>
  131. <button
  132. class="p-1 px-3 text-xs flex rounded transition"
  133. type="button"
  134. on:click={() => {
  135. options.mirostat_eta = options.mirostat_eta === '' ? 0.1 : '';
  136. }}
  137. >
  138. {#if options.mirostat_eta === ''}
  139. <span class="ml-2 self-center"> Default </span>
  140. {:else}
  141. <span class="ml-2 self-center"> Custom </span>
  142. {/if}
  143. </button>
  144. </div>
  145. {#if options.mirostat_eta !== ''}
  146. <div class="flex mt-0.5 space-x-2">
  147. <div class=" flex-1">
  148. <input
  149. id="steps-range"
  150. type="range"
  151. min="0"
  152. max="1"
  153. bind:value={options.mirostat_eta}
  154. step="0.05"
  155. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  156. />
  157. </div>
  158. <div>
  159. <input
  160. bind:value={options.mirostat_eta}
  161. type="number"
  162. class=" bg-transparent text-center w-14"
  163. />
  164. </div>
  165. </div>
  166. {/if}
  167. </div>
  168. <div class=" py-0.5 w-full justify-between">
  169. <div class="flex w-full justify-between">
  170. <div class=" self-center text-xs font-medium">Mirostat Tau</div>
  171. <button
  172. class="p-1 px-3 text-xs flex rounded transition"
  173. type="button"
  174. on:click={() => {
  175. options.mirostat_tau = options.mirostat_tau === '' ? 5.0 : '';
  176. }}
  177. >
  178. {#if options.mirostat_tau === ''}
  179. <span class="ml-2 self-center"> Default </span>
  180. {:else}
  181. <span class="ml-2 self-center"> Custom </span>
  182. {/if}
  183. </button>
  184. </div>
  185. {#if options.mirostat_tau !== ''}
  186. <div class="flex mt-0.5 space-x-2">
  187. <div class=" flex-1">
  188. <input
  189. id="steps-range"
  190. type="range"
  191. min="0"
  192. max="10"
  193. bind:value={options.mirostat_tau}
  194. step="0.5"
  195. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  196. />
  197. </div>
  198. <div>
  199. <input
  200. bind:value={options.mirostat_tau}
  201. type="number"
  202. class=" bg-transparent text-center w-14"
  203. />
  204. </div>
  205. </div>
  206. {/if}
  207. </div>
  208. <div class=" py-0.5 w-full justify-between">
  209. <div class="flex w-full justify-between">
  210. <div class=" self-center text-xs font-medium">Top K</div>
  211. <button
  212. class="p-1 px-3 text-xs flex rounded transition"
  213. type="button"
  214. on:click={() => {
  215. options.top_k = options.top_k === '' ? 40 : '';
  216. }}
  217. >
  218. {#if options.top_k === ''}
  219. <span class="ml-2 self-center"> Default </span>
  220. {:else}
  221. <span class="ml-2 self-center"> Custom </span>
  222. {/if}
  223. </button>
  224. </div>
  225. {#if options.top_k !== ''}
  226. <div class="flex mt-0.5 space-x-2">
  227. <div class=" flex-1">
  228. <input
  229. id="steps-range"
  230. type="range"
  231. min="0"
  232. max="100"
  233. bind:value={options.top_k}
  234. step="0.5"
  235. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  236. />
  237. </div>
  238. <div>
  239. <input
  240. bind:value={options.top_k}
  241. type="number"
  242. class=" bg-transparent text-center w-14"
  243. />
  244. </div>
  245. </div>
  246. {/if}
  247. </div>
  248. <div class=" py-0.5 w-full justify-between">
  249. <div class="flex w-full justify-between">
  250. <div class=" self-center text-xs font-medium">Top P</div>
  251. <button
  252. class="p-1 px-3 text-xs flex rounded transition"
  253. type="button"
  254. on:click={() => {
  255. options.top_p = options.top_p === '' ? 0.9 : '';
  256. }}
  257. >
  258. {#if options.top_p === ''}
  259. <span class="ml-2 self-center"> Default </span>
  260. {:else}
  261. <span class="ml-2 self-center"> Custom </span>
  262. {/if}
  263. </button>
  264. </div>
  265. {#if options.top_p !== ''}
  266. <div class="flex mt-0.5 space-x-2">
  267. <div class=" flex-1">
  268. <input
  269. id="steps-range"
  270. type="range"
  271. min="0"
  272. max="1"
  273. bind:value={options.top_p}
  274. step="0.05"
  275. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  276. />
  277. </div>
  278. <div>
  279. <input
  280. bind:value={options.top_p}
  281. type="number"
  282. class=" bg-transparent text-center w-14"
  283. />
  284. </div>
  285. </div>
  286. {/if}
  287. </div>
  288. <div class=" py-0.5 w-full justify-between">
  289. <div class="flex w-full justify-between">
  290. <div class=" self-center text-xs font-medium">Repeat Penalty</div>
  291. <button
  292. class="p-1 px-3 text-xs flex rounded transition"
  293. type="button"
  294. on:click={() => {
  295. options.repeat_penalty = options.repeat_penalty === '' ? 1.1 : '';
  296. }}
  297. >
  298. {#if options.repeat_penalty === ''}
  299. <span class="ml-2 self-center"> Default </span>
  300. {:else}
  301. <span class="ml-2 self-center"> Custom </span>
  302. {/if}
  303. </button>
  304. </div>
  305. {#if options.repeat_penalty !== ''}
  306. <div class="flex mt-0.5 space-x-2">
  307. <div class=" flex-1">
  308. <input
  309. id="steps-range"
  310. type="range"
  311. min="0"
  312. max="2"
  313. bind:value={options.repeat_penalty}
  314. step="0.05"
  315. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  316. />
  317. </div>
  318. <div>
  319. <input
  320. bind:value={options.repeat_penalty}
  321. type="number"
  322. class=" bg-transparent text-center w-14"
  323. />
  324. </div>
  325. </div>
  326. {/if}
  327. </div>
  328. <div class=" py-0.5 w-full justify-between">
  329. <div class="flex w-full justify-between">
  330. <div class=" self-center text-xs font-medium">Repeat Last N</div>
  331. <button
  332. class="p-1 px-3 text-xs flex rounded transition"
  333. type="button"
  334. on:click={() => {
  335. options.repeat_last_n = options.repeat_last_n === '' ? 64 : '';
  336. }}
  337. >
  338. {#if options.repeat_last_n === ''}
  339. <span class="ml-2 self-center"> Default </span>
  340. {:else}
  341. <span class="ml-2 self-center"> Custom </span>
  342. {/if}
  343. </button>
  344. </div>
  345. {#if options.repeat_last_n !== ''}
  346. <div class="flex mt-0.5 space-x-2">
  347. <div class=" flex-1">
  348. <input
  349. id="steps-range"
  350. type="range"
  351. min="-1"
  352. max="128"
  353. bind:value={options.repeat_last_n}
  354. step="1"
  355. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  356. />
  357. </div>
  358. <div>
  359. <input
  360. bind:value={options.repeat_last_n}
  361. type="number"
  362. class=" bg-transparent text-center w-14"
  363. />
  364. </div>
  365. </div>
  366. {/if}
  367. </div>
  368. <div class=" py-0.5 w-full justify-between">
  369. <div class="flex w-full justify-between">
  370. <div class=" self-center text-xs font-medium">Tfs Z</div>
  371. <button
  372. class="p-1 px-3 text-xs flex rounded transition"
  373. type="button"
  374. on:click={() => {
  375. options.tfs_z = options.tfs_z === '' ? 1 : '';
  376. }}
  377. >
  378. {#if options.tfs_z === ''}
  379. <span class="ml-2 self-center"> Default </span>
  380. {:else}
  381. <span class="ml-2 self-center"> Custom </span>
  382. {/if}
  383. </button>
  384. </div>
  385. {#if options.tfs_z !== ''}
  386. <div class="flex mt-0.5 space-x-2">
  387. <div class=" flex-1">
  388. <input
  389. id="steps-range"
  390. type="range"
  391. min="0"
  392. max="2"
  393. bind:value={options.tfs_z}
  394. step="0.05"
  395. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  396. />
  397. </div>
  398. <div>
  399. <input
  400. bind:value={options.tfs_z}
  401. type="number"
  402. class=" bg-transparent text-center w-14"
  403. />
  404. </div>
  405. </div>
  406. {/if}
  407. </div>
  408. <div class=" py-0.5 w-full justify-between">
  409. <div class="flex w-full justify-between">
  410. <div class=" self-center text-xs font-medium">Context Length</div>
  411. <button
  412. class="p-1 px-3 text-xs flex rounded transition"
  413. type="button"
  414. on:click={() => {
  415. options.num_ctx = options.num_ctx === '' ? 2048 : '';
  416. }}
  417. >
  418. {#if options.num_ctx === ''}
  419. <span class="ml-2 self-center"> Default </span>
  420. {:else}
  421. <span class="ml-2 self-center"> Custom </span>
  422. {/if}
  423. </button>
  424. </div>
  425. {#if options.num_ctx !== ''}
  426. <div class="flex mt-0.5 space-x-2">
  427. <div class=" flex-1">
  428. <input
  429. id="steps-range"
  430. type="range"
  431. min="1"
  432. max="16000"
  433. bind:value={options.num_ctx}
  434. step="1"
  435. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  436. />
  437. </div>
  438. <div class="">
  439. <input
  440. bind:value={options.num_ctx}
  441. type="number"
  442. class=" bg-transparent text-center w-14"
  443. />
  444. </div>
  445. </div>
  446. {/if}
  447. </div>
  448. </div>