@@ -20,7 +20,7 @@ const WHITE = chr(27) + "[37m"
2020const BOLD_CYAN = chr( 27 ) + "[1;36m"
2121
2222' llama configuration (quen settings)
23- const n_ctx = 32768
23+ const n_ctx = 65536
2424const n_batch = 512
2525const n_max_tokens = 4096
2626const n_temperature = 0.6
@@ -29,8 +29,12 @@ const n_top_p = 0.95
2929const n_min_p = 0
3030const n_penalty_repeat = 1.0
3131const n_penalty_last_n = 256
32+ const n_gpu_layers = 32
3233
33- sandbox_home = cwd
34+ sandbox_home = iff(len(command) > 0 , trim(command), cwd)
35+ if (left(sandbox_home) == "~" ) then
36+ sandbox_home = home + mid(sandbox_home, 1 )
37+ endif
3438
3539'
3640' Displays the welcome message
@@ -50,8 +54,8 @@ end sub
5054' handles the TOOL:LIST command
5155'
5256func tool_list_files(arg)
53- if (arg == "./" ) then
54- arg = sandbox_home + arg
57+ if (left( arg, 2 ) == "./" ) then
58+ arg = sandbox_home + mid( arg, 2 )
5559 else if (len(arg) == 0 or arg == "." ) then
5660 arg = sandbox_home
5761 endif
@@ -151,11 +155,11 @@ func process_tool(cmd)
151155 endif
152156 endif
153157
154- ' print RED
155- ' print "["+op+"]"
156- ' print "["+arg1+"]"
157- ' print "["+arg2+"]"
158- ' print RESET
158+ ' print RED
159+ ' print "["+op+"]"
160+ ' print "["+arg1+"]"
161+ ' print "["+arg2+"]"
162+ ' print RESET
159163
160164 select case op
161165 case "TOOL:DATE"
219223' creates the llama instance
220224'
221225func create_llama()
222- local llama = llm.llama(model, n_ctx, n_batch, 50 )
226+ local llama = llm.llama(model, n_ctx, n_batch, n_gpu_layers )
223227 llama.add_stop( "<|turn|>" )
224228 llama.set_max_tokens(n_max_tokens)
225229 llama.set_temperature(n_temperature)
@@ -279,11 +283,21 @@ sub main()
279283 print
280284 print WHITE ;
281285 print "--- Tokens/sec: " + round(iter.tokens_sec(), 2 ) + " ---\n"
282- iter = llama.add_message( "user" , process_input())
286+ local next_iter = false
287+ repeat
288+ local user_input = process_input()
289+ if (user_input == "/meminfo" ) then
290+ print llama.mem_info()
291+ else
292+ iter = llama.add_message( "user" , user_input)
293+ next_iter = true
294+ endif
295+ until next_iter
283296 print BLUE ;
284297 endif
285298 wend
286299end
287300
288301welcome_message()
289302main()
303+
0 commit comments