| 43 | } |
| 44 | |
| 45 | void help_usage_interactive() { |
| 46 | fprintf(stderr, "Usage: <mode> [options]\n"); |
| 47 | fprintf(stderr, "Example: c -i \"Q: What is the meaning of life?\"\n"); |
| 48 | fprintf(stderr, "Modes:\n"); |
| 49 | fprintf(stderr, " h Display this help message\n"); |
| 50 | fprintf(stderr, " c Completion - complete a single prompt \n"); |
| 51 | fprintf(stderr, " p Perplexity - compute perplexity of a single prompt \n"); |
| 52 | fprintf(stderr, " k Passkey - test passkey extraction \n"); |
| 53 | fprintf(stderr, "\n"); |
| 54 | fprintf(stderr, "Perplexity mode options:\n"); |
| 55 | fprintf(stderr, " Choose one:\n"); |
| 56 | fprintf(stderr, " -i <string> input prompt\n"); |
| 57 | fprintf(stderr, " -f <filepath> input file with prompt\n"); |
| 58 | fprintf(stderr, " -w use wikitext as input\n"); |
| 59 | fprintf(stderr, "Completion mode options:\n"); |
| 60 | fprintf(stderr, " -n <int> number of steps to run for in completion mode, default 256. 0 = max_seq_len, -1 = infinite\n"); |
| 61 | fprintf(stderr, " Choose one:\n"); |
| 62 | fprintf(stderr, " -i <string> input prompt\n"); |
| 63 | fprintf(stderr, " -t <float> temperature (default - 1.0)\n"); |
| 64 | fprintf(stderr, " -p <float> p for top-p sampling (default - 0.95)\n"); |
| 65 | fprintf(stderr, " -f <filepath> input file with prompt\n"); |
| 66 | fprintf(stderr, "Passkey mode options:\n"); |
| 67 | fprintf(stderr, " -n <int> number of junk lines to insert (default - 250)\n"); |
| 68 | fprintf(stderr, " -l <int> passkey position (-1 - random)\n"); |
| 69 | } |
| 70 | |
| 71 | struct Session { |
| 72 | Session(const std::string& checkpoint_dir, bool lock_model_weights, int context, uint64_t sampler_seed): |