From eeba2c133735732f767c563cdbf345832e3629f2 Mon Sep 17 00:00:00 2001 From: Stephen D <webmaster@scd31.com> Date: Fri, 7 Feb 2025 10:40:14 -0500 Subject: [PATCH] another commit --- .gitignore | 3 ++- prepare.sh => download-32b.sh | 0 download-70b.sh | 3 +++ frontend.rb | 13 ++++++++++--- grammar | 2 +- prompt | 2 +- 6 files changed, 17 insertions(+), 6 deletions(-) rename prepare.sh => download-32b.sh (100%) create mode 100644 download-70b.sh diff --git a/.gitignore b/.gitignore index fd37ef9..e446944 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 0000000..3bde0d3 --- /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 378070e..4382b5d 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 54f93af..e4772f1 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 368615a..e140871 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. -- GitLab