| 241 | } |
| 242 | |
| 243 | void print_help() const { |
| 244 | printf( |
| 245 | "Description:\n" |
| 246 | " Runs a llm\n" |
| 247 | "\n" |
| 248 | "Usage:\n" |
| 249 | " llama-run [options] model [prompt]\n" |
| 250 | "\n" |
| 251 | "Options:\n" |
| 252 | " -c, --context-size <value>\n" |
| 253 | " Context size (default: %d)\n" |
| 254 | " --chat-template-file <path>\n" |
| 255 | " Path to the file containing the chat template to use with the model.\n" |
| 256 | " Only supports jinja templates and implicitly sets the --jinja flag.\n" |
| 257 | " --jinja\n" |
| 258 | " Use jinja templating for the chat template of the model\n" |
| 259 | " -n, -ngl, --ngl <value>\n" |
| 260 | " Number of GPU layers (default: %d)\n" |
| 261 | " --temp <value>\n" |
| 262 | " Temperature (default: %.1f)\n" |
| 263 | " -t, --threads <value>\n" |
| 264 | " Number of threads to use during generation (default: %d)\n" |
| 265 | " -v, --verbose, --log-verbose\n" |
| 266 | " Set verbosity level to infinity (i.e. log all messages, useful for debugging)\n" |
| 267 | " -h, --help\n" |
| 268 | " Show help message\n" |
| 269 | "\n" |
| 270 | "Commands:\n" |
| 271 | " model\n" |
| 272 | " Model is a string with an optional prefix of \n" |
| 273 | " huggingface:// (hf://), modelscope:// (ms://), ollama://, https:// or file://.\n" |
| 274 | " If no protocol is specified and a file exists in the specified\n" |
| 275 | " path, file:// is assumed, otherwise if a file does not exist in\n" |
| 276 | " the specified path, ollama:// is assumed. Models that are being\n" |
| 277 | " pulled are downloaded with .partial extension while being\n" |
| 278 | " downloaded and then renamed as the file without the .partial\n" |
| 279 | " extension when complete.\n" |
| 280 | "\n" |
| 281 | "Examples:\n" |
| 282 | " llama-run llama3\n" |
| 283 | " llama-run ollama://granite-code\n" |
| 284 | " llama-run ollama://smollm:135m\n" |
| 285 | " llama-run hf://QuantFactory/SmolLM-135M-GGUF/SmolLM-135M.Q2_K.gguf\n" |
| 286 | " llama-run " |
| 287 | "huggingface://bartowski/SmolLM-1.7B-Instruct-v0.2-GGUF/SmolLM-1.7B-Instruct-v0.2-IQ3_M.gguf\n" |
| 288 | " llama-run ms://QuantFactory/SmolLM-135M-GGUF/SmolLM-135M.Q2_K.gguf\n" |
| 289 | " llama-run " |
| 290 | "modelscope://bartowski/SmolLM-1.7B-Instruct-v0.2-GGUF/SmolLM-1.7B-Instruct-v0.2-IQ3_M.gguf\n" |
| 291 | " llama-run https://example.com/some-file1.gguf\n" |
| 292 | " llama-run some-file2.gguf\n" |
| 293 | " llama-run file://some-file3.gguf\n" |
| 294 | " llama-run --ngl 999 some-file4.gguf\n" |
| 295 | " llama-run --ngl 999 some-file5.gguf Hello World\n", |
| 296 | context_size_default, ngl_default, temperature_default, n_threads_default); |
| 297 | } |
| 298 | }; |
| 299 | |
| 300 | struct progress_data { |
no test coverage detected