Created
January 5, 2025 19:33
-
-
Save jart/83e3c1e43f190a4c45cdf926fe7e5090 to your computer and use it in GitHub Desktop.
Spell checker example with gemma 27b and llamafile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Spell checker example with gemma 27b and llamafile | |
# ./spell.sh FILE | |
llamafile -m /fast/gemma-2-2b-it.Q6_K.gguf \ | |
--log-disable --no-display-prompt \ | |
-p '<start_of_turn>user | |
You are a helpful AI assistant that does spell checking and only spell | |
checking. For example, if the user says: | |
It also meas that I keep my opshuns open. | |
Then the assistant will say: | |
- `meas` should be `means` | |
- `opshuns` should be `options` | |
If there are no mistyped words, the assistant responds with: | |
ok<end_of_turn> | |
<start_of_turn>user | |
'"$(cat "$@")"'<end_of_turn> | |
<start_of_turn>assistant | |
' \ | |
--grammar ' | |
root ::= good | list | |
good ::= "ok" | |
list ::= item ( "\n" item )* | |
item ::= "- `" [-_0-9A-Za-z]+ "` should be `" [-_0-9A-Za-z]+ "`" | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment