forked from KoboldAI/KoboldAI-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gensettings.py
415 lines (413 loc) · 10.4 KB
/
gensettings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
gensettingstf = [
{
"uitype": "slider",
"unit": "int",
"label": "Amount to Generate",
"id": "setoutput",
"min": 16,
"max": 512,
"step": 2,
"default": 80,
"tooltip": "Number of tokens the AI should generate. Higher numbers will take longer to generate."
},
{
"uitype": "slider",
"unit": "float",
"label": "Temperature",
"id": "settemp",
"min": 0.1,
"max": 2.0,
"step": 0.01,
"default": 0.5,
"tooltip": "Randomness of sampling. High values can increase creativity but may make text less sensible. Lower values will make text more predictable but can become repetitious."
},
{
"uitype": "slider",
"unit": "float",
"label": "Top p Sampling",
"id": "settopp",
"min": 0.0,
"max": 1.0,
"step": 0.01,
"default": 0.9,
"tooltip": "Used to discard unlikely text in the sampling process. Lower values will make text more predictable but can become repetitious. (Put this value on 1 to disable its effect)"
},
{
"uitype": "slider",
"unit": "int",
"label": "Top k Sampling",
"id": "settopk",
"min": 0,
"max": 100,
"step": 1,
"default": 0,
"tooltip": "Alternative sampling method, can be combined with top_p. (Put this value on 0 to disable its effect)"
},
{
"uitype": "slider",
"unit": "float",
"label": "Tail-free Sampling",
"id": "settfs",
"min": 0.0,
"max": 1.0,
"step": 0.01,
"default": 1.0,
"tooltip": "Alternative sampling method; it is recommended to disable top_p and top_k (set top_p to 1 and top_k to 0) if using this. 0.95 is thought to be a good value. (Put this value on 1 to disable its effect)"
},
{
"uitype": "slider",
"unit": "float",
"label": "Typical Sampling",
"id": "settypical",
"min": 0.0,
"max": 1.0,
"step": 0.01,
"default": 1.0,
"tooltip": "Alternative sampling method described in the paper \"Typical Decoding for Natural Language Generation\" (10.48550/ARXIV.2202.00666). The paper suggests 0.2 as a good value for this setting. Set this setting to 1 to disable its effect."
},
{
"uitype": "slider",
"unit": "float",
"label": "Top a Sampling",
"id": "settopa",
"min": 0.0,
"max": 1.0,
"step": 0.01,
"default": 0.0,
"tooltip": "Alternative sampling method that reduces the randomness of the AI whenever the probability of one token is much higher than all the others. Higher values have a stronger effect. Set this setting to 0 to disable its effect."
},
{
"uitype": "slider",
"unit": "float",
"label": "Repetition Penalty",
"id": "setreppen",
"min": 1.0,
"max": 3.0,
"step": 0.01,
"default": 1.1,
"tooltip": "Used to penalize words that were already generated or belong to the context (Going over 1.2 breaks 6B models)."
},
{
"uitype": "slider",
"unit": "int",
"label": "Rep Penalty Range",
"id": "setreppenrange",
"min": 0,
"max": 4096,
"step": 4,
"default": 0,
"tooltip": "Repetition penalty range. If set higher than 0, only applies repetition penalty to the last few tokens of your story rather than applying it to the entire story. This slider controls the amount of tokens at the end of your story to apply it to."
},
{
"uitype": "slider",
"unit": "float",
"label": "Rep Penalty Slope",
"id": "setreppenslope",
"min": 0.0,
"max": 10.0,
"step": 0.1,
"default": 0.0,
"tooltip": "Repetition penalty slope. If BOTH this setting and Rep Penalty Range are set higher than 0, will use sigmoid interpolation to apply repetition penalty more strongly on tokens that are closer to the end of your story. This setting controls the tension of the sigmoid curve; higher settings will result in the repetition penalty difference between the start and end of your story being more apparent. Setting this to 1 uses linear interpolation; setting this to 0 disables interpolation."
},
{
"uitype": "slider",
"unit": "int",
"label": "Max Tokens",
"id": "settknmax",
"min": 512,
"max": 2048,
"step": 8,
"default": 1024,
"tooltip": "Max number of tokens of context to submit to the AI for sampling. Make sure this is higher than Amount to Generate. Higher values increase VRAM/RAM usage."
},
{
"uitype": "slider",
"unit": "int",
"label": "Gens Per Action",
"id": "setnumseq",
"min": 1,
"max": 5,
"step": 1,
"default": 1,
"tooltip": "Number of results to generate per submission. Increases VRAM/RAM usage."
},
{
"uitype": "slider",
"unit": "int",
"label": "W Info Depth",
"id": "setwidepth",
"min": 1,
"max": 5,
"step": 1,
"default": 3,
"tooltip": "Number of historic actions to scan for W Info keys."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Auto Save",
"id": "autosave",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Whether the game is saved after each action."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Always Add Prompt",
"id": "setuseprompt",
"min": 0,
"max": 1,
"step": 1,
"default": 1,
"tooltip": "Whether the prompt should be sent in the context of every action."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Adventure Mode",
"id": "setadventure",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Turn this on if you are playing a Choose your Adventure model."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Chat Mode",
"id": "setchatmode",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "This mode optimizes KoboldAI for chatting."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Dynamic WI Scan",
"id": "setdynamicscan",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Scan the AI's output for world info keys as it's generating the output."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "No Prompt Generation",
"id": "setnopromptgen",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "When enabled the AI does not generate when you enter the prompt, instead you need to do an action first."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Random Story Persist",
"id": "setrngpersist",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "When enabled, the Memory text box in the Random Story dialog will be prefilled by default with your current story's memory instead of being empty."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "No Genmod",
"id": "setnogenmod",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Disables userscript generation modifiers."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Debug",
"id": "debug",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Show debug info"
}
]
gensettingsik =[{
"uitype": "slider",
"unit": "float",
"label": "Temperature",
"id": "settemp",
"min": 0.1,
"max": 2.0,
"step": 0.05,
"default": 0.5,
"tooltip": "Randomness of sampling. High values can increase creativity but may make text less sensible. Lower values will make text more predictable but can become repetitious."
},
{
"uitype": "slider",
"unit": "float",
"label": "Top p Sampling",
"id": "settopp",
"min": 0.0,
"max": 1.0,
"step": 0.05,
"default": 1.1,
"tooltip": "Used to discard unlikely text in the sampling process. Lower values will make text more predictable but can become repetitious."
},
{
"uitype": "slider",
"unit": "int",
"label": "Top k Sampling",
"id": "settopk",
"min": 0,
"max": 100,
"step": 1,
"default": 0,
"tooltip": "Alternative sampling method, can be combined with top_p."
},
{
"uitype": "slider",
"unit": "float",
"label": "Tail-free Sampling",
"id": "settfs",
"min": 0.0,
"max": 1.0,
"step": 0.05,
"default": 0.0,
"tooltip": "Alternative sampling method; it is recommended to disable (set to 0) top_p and top_k if using this. 0.95 is thought to be a good value."
},
{
"uitype": "slider",
"unit": "int",
"label": "Amount to Generate",
"id": "setikgen",
"min": 50,
"max": 3000,
"step": 2,
"default": 200,
"tooltip": "Number of characters the AI should generate."
},
{
"uitype": "slider",
"unit": "int",
"label": "W Info Depth",
"id": "setwidepth",
"min": 1,
"max": 5,
"step": 1,
"default": 3,
"tooltip": "Number of historic actions to scan for W Info keys."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Auto Save",
"id": "autosave",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Whether the game is saved after each action."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Always Add Prompt",
"id": "setuseprompt",
"min": 0,
"max": 1,
"step": 1,
"default": 1,
"tooltip": "Whether the prompt should be sent in the context of every action."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Adventure Mode",
"id": "setadventure",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Turn this on if you are playing a Choose your Adventure model."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Chat Mode",
"id": "setchatmode",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "This mode optimizes KoboldAI for chatting."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "No Prompt Generation",
"id": "setnopromptgen",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "When enabled the AI does not generate when you enter the prompt, instead you need to do an action first."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Random Story Persist",
"id": "setrngpersist",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "When enabled, the Memory text box in the Random Story dialog will be prefilled by default with your current story's memory instead of being empty."
},
{
"uitype": "toggle",
"unit": "bool",
"label": "Debug",
"id": "debug",
"min": 0,
"max": 1,
"step": 1,
"default": 0,
"tooltip": "Show debug info"
}
]
formatcontrols = [{
"label": "Trim incomplete sentences",
"id": "frmttriminc",
"tooltip": "Remove text after last sentence closure. If no closure is found, all tokens will be returned."
},
{
"label": "Remove blank lines",
"id": "frmtrmblln",
"tooltip": "Replace double newlines (\\n\\n) with single newlines to avoid blank lines."
},
{
"label": "Remove special characters",
"id": "frmtrmspch",
"tooltip": "Remove special characters (@,#,%,^, etc)"
},
{
"label": "Add sentence spacing",
"id": "frmtadsnsp",
"tooltip": "If the last action ended with punctuation, add a space to the beginning of the next action."
},
{
"label": "Single Line",
"id": "singleline",
"tooltip": "Only allows the AI to output anything before the enter"
}]