gemma.cpp
gemma.cpp copied to clipboard
Wrong keyboard mapping in command line
System: macOS 14.3.1 on Macbook Air M2 Terminal: reproduced in iTerm as well as native Terminal Command:
./gemma \
--tokenizer tokenizer.spm \
--compressed_weights 2b-it-sfp.sbs \
--model 2b-it
When I try to navigate in the chat input using the arrow keys, it doesn't work and I get codes like ^[[D for the left arrow key. Also, I cannot add new lines in my prompt using Shift+Enter, and when I insert text from the clipboard containing new lines, I get multiple invocations.
Just saw this, which resolves the second part: https://github.com/google/gemma.cpp/pull/33
Hi, we are just using std::getline
for input. Does anyone have experience with handling array keys on OSX?
I've looked into this a bit more and there is a workaround, installing rlwrap: https://stackoverflow.com/questions/21384040/why-does-the-terminal-show-a-b-c-d-when-pressing-the-arrow-k/76418140#76418140
It seems that's about all we can do when using standard C or C++ libraries without other dependencies such as readline/ncurses, which we'd like to avoid. Closing :)