|
5 | 5 | from exllamav2 import model_init |
6 | 6 | from exllamav2 import ExLlamaV2Cache, ExLlamaV2Cache_Q4, ExLlamaV2Cache_Q6, ExLlamaV2Cache_Q8 |
7 | 7 | from exllamav2.generator import ExLlamaV2DynamicGenerator, ExLlamaV2DynamicJob, ExLlamaV2Sampler |
8 | | -import argparse, contextlib |
| 8 | +import argparse, contextlib, subprocess |
9 | 9 | import util |
10 | 10 |
|
11 | 11 | # Args |
|
20 | 20 | parser.add_argument("--max_tokens", type = int, default = 768, help = "Max number of tokens for each completion") |
21 | 21 | parser.add_argument("-pf", "--prompt_format", type = str, help = "Instruct format to apply. Default is raw completion (for base models) ") |
22 | 22 | parser.add_argument("-v", "--verbose", action = "store_true", help = "Spam completions to console while generating") |
| 23 | +parser.add_argument("-e", "--eval", action = "store_true", help = "Run evaluation script on output file after sampling") |
23 | 24 | model_init.add_args(parser) |
24 | 25 | args = parser.parse_args() |
25 | 26 |
|
|
52 | 53 | "<|start_header_id|>assistant<|end_header_id|>\n\n" |
53 | 54 | "Sure! Here is how you might implement the function:\n\n```python\n{{problem}} ", |
54 | 55 | " " |
| 56 | + ), |
| 57 | + "gemma": ( |
| 58 | + "<bos><start_of_turn>user\n" |
| 59 | + "Complete the following Python function:\n\n{{problem}}<|eot_id|>" |
| 60 | + "<start_of_turn>model\n" |
| 61 | + "```python\n{{problem}} ", |
| 62 | + " " |
55 | 63 | ) |
56 | 64 | } |
57 | 65 |
|
|
192 | 200 | print(f" -- Saving: {args.output}") |
193 | 201 | write_jsonl(args.output, samples) |
194 | 202 |
|
| 203 | +# Optionally launch eval script |
| 204 | + |
| 205 | +if args.eval: |
| 206 | + subprocess.run(["evaluate_functional_correctness", args.output]) |
| 207 | + |
0 commit comments