chess : tuning performance

This commit is contained in:
Georgi Gerganov 2023-11-30 10:50:47 +02:00
parent 70741ba794
commit 15c4fdce45
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735
3 changed files with 19 additions and 14 deletions

View File

@ -155,8 +155,8 @@ std::string Chessboard::getRules(const std::string& prompt) const {
"# leading space is very important!\n"
"\n";
if (prompt.empty()) {
// result += "move ::= \" \" ((piece | frompos) \" \" \"to \"?)? topos\n";
result += "move ::= \" \" frompos \" \" \"to \"? topos\n";
result += "move ::= \" \" ((piece | frompos) \" \" \"to \"?)? topos\n";
//result += "move ::= \" \" frompos \" \" \"to \"? topos\n";
}
else {
// result += "move ::= prompt \" \" ((piece | frompos) \" \" \"to \"?)? topos\n"
@ -174,12 +174,12 @@ std::string Chessboard::getRules(const std::string& prompt) const {
from_pos.insert(positions[m.first]);
to_pos.insert(positions[m.second]);
}
// if (!pieces.empty()) {
// result += "piece ::= (";
// for (auto& p : pieces) result += " \"" + p + "\" |";
// result.pop_back();
// result += ")\n\n";
// }
if (!pieces.empty()) {
result += "piece ::= (";
for (auto& p : pieces) result += " \"" + p + "\" |";
result.pop_back();
result += ")\n\n";
}
if (!from_pos.empty()) {
result += "frompos ::= (";
for (auto& p : from_pos) result += " \"" + p + "\" |";

View File

@ -188,7 +188,7 @@
// 'base-en-q5_1': 57,
// };
let url = 'https://whisper.ggerganov.com/ggml-model-whisper-tiny.en.bin';
let url = 'https://whisper.ggerganov.com/ggml-model-whisper-tiny.en-q8_0.bin';
let dst = 'whisper.bin';
let size_mb = 75;
@ -272,6 +272,7 @@
let audio = renderedBuffer.getChannelData(0);
if (instance) {
printTextarea('js: number of samples: ' + audio.length);
Module.set_audio(instance, audio);
}
});
@ -338,7 +339,9 @@
}
function onStop() {
printTextarea('js: stopping recording ...');
stopRecording();
var interval = setInterval(function() {
var moves = Module.get_moves();

View File

@ -55,19 +55,21 @@ void wchess_main(size_t i) {
wparams.print_progress = false;
wparams.print_timestamps = true;
wparams.print_special = false;
wparams.no_timestamps = true;
wparams.max_tokens = 32;
// wparams.audio_ctx = 768; // partial encoder context for better performance
wparams.audio_ctx = 768; // partial encoder context for better performance
wparams.temperature = 0.4f;
wparams.temperature_inc = 1.0f;
wparams.temperature = 0.0f;
wparams.temperature_inc = 2.0f;
wparams.greedy.best_of = 1;
wparams.beam_search.beam_size = 5;
wparams.beam_search.beam_size = 1;
wparams.language = "en";
wparams.grammar_penalty = 100.0;
wparams.initial_prompt = "bishop to c3, rook to d4, knight to e5, d4 d5, knight to c3, c3, queen to d4, king b1, pawn to a1, bishop to b2, knight to c3,";
printf("command: using %d threads\n", wparams.n_threads);