diff --git a/.gitignore b/.gitignore index fd37ef97a61d8a713c9654c42bcdca0011975fac..e44694496114b0e6077c5e0882e4c0cd0a49653c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -/DeepSeek-R1-Distill-Qwen-32B-Q5_K_L.gguf +/DeepSeek-*.gguf /log/* !/log/.keep +prompt.tmp diff --git a/prepare.sh b/download-32b.sh similarity index 100% rename from prepare.sh rename to download-32b.sh diff --git a/download-70b.sh b/download-70b.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bde0d3d7a8099b9bedafdc81f56d55103b2d55e --- /dev/null +++ b/download-70b.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +wget https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-70B-GGUF/resolve/main/DeepSeek-R1-Distill-Llama-70B-Q5_K_M.gguf?download=true -O DeepSeek-R1-Distill-Llama-70B-Q5_K_M.gguf diff --git a/frontend.rb b/frontend.rb index 378070edbd36bb6ab8594e4ae0744a4333781d6a..4382b5d5a1d60aad45005616a6a7baf20da4ab21 100755 --- a/frontend.rb +++ b/frontend.rb @@ -1,13 +1,20 @@ -#!/usr/bin/env - -cmd = 'llama-cli -m /DeepSeek-R1-Distill-Qwen-32B-Q6_K_L.gguf -ngl 15000 -cnv --grammar-file grammar -f prompt --repeat-penalty 1.1 --repeat-last-n 20 -c 32768 --no-display-prompt' +#!/usr/bin/env ruby require 'open3' require 'date' +word = "beach" # TODO randomize + +prompt = File.open('prompt') { |f| f.read.gsub('{WORD}', word) } +File.open('prompt.tmp', 'w') { |f| f.write(prompt) } # easier than escaping in bash command lol + + +cmd = %{llama-cli -m DeepSeek*.gguf -ngl 15000 -cnv --grammar-file grammar -f prompt.tmp --repeat-penalty 1.1 --repeat-last-n 20 -c 32768 --no-display-prompt} + stdin, stdout, _ = Open3.popen2e(cmd) file = File.open("log/#{DateTime.now.to_s}.txt", 'w') +file.write("Word: #{word}\n") Thread.new do cur_line = '' diff --git a/grammar b/grammar index 54f93afbb1cca06c0c3bca08b43bbc27378936f6..e4772f18df822c29f3d60a929409fb4067398eb5 100644 --- a/grammar +++ b/grammar @@ -1,5 +1,5 @@ root ::= thinking newline sentence{0,5} -thinking ::= "<think>" ([^<>]){1000,10000} "</think>" +thinking ::= "<think>" ([^<>]){3500,10000} "</think>" sentence ::= (wordsthenchar terminate space{0, 1}) wordsthenchar ::= (word (space | comma space){0,1}){0,100} space ::= " " diff --git a/prompt b/prompt index 368615a779fddb52db1894ff0193cd525c24cddd..e140871fe9f74fa2a71123e96d8a043f0e15443c 100644 --- a/prompt +++ b/prompt @@ -40,4 +40,4 @@ Example Game 3 (target word "bird"): YOU MUST GIVE HINTS AS LESS THAN OR EQUAL TO 3 SHORT SENTENCES OR YOU WILL DIE! YOU WILL BE CUT OFF IF YOU GIVE A HINT THAT IS TOO LONG. -Your target word is "beach". Now describe that to the user using only words in the word bank. +Your target word is "{WORD}". Now describe that to the user using only words in the word bank.