| 39 | |
| 40 | |
| 41 | def parse_arguments(args=None): |
| 42 | # see `add_common_args` for extended list of arguments |
| 43 | parser = argparse.ArgumentParser() |
| 44 | parser.add_argument('--max_input_length', type=int, default=923) |
| 45 | parser.add_argument('--max_output_len', type=int, required=True) |
| 46 | parser.add_argument( |
| 47 | '--draft_engine_dir', |
| 48 | type=str, |
| 49 | default=None, |
| 50 | help='Path to engine of draft model in Draft-Target-Model mode.') |
| 51 | parser.add_argument( |
| 52 | '--input_text', |
| 53 | type=str, |
| 54 | nargs='+', |
| 55 | default=["Born in north-east France, Soyer trained as a"]) |
| 56 | parser.add_argument( |
| 57 | '--input_file', |
| 58 | type=str, |
| 59 | help= |
| 60 | 'CSV or Numpy file containing tokenized input. Alternative to text input.', |
| 61 | default=None) |
| 62 | parser.add_argument('--multimodal_input_file', |
| 63 | type=str, |
| 64 | help='Path to multimodal input file.') |
| 65 | parser.add_argument( |
| 66 | '--input_token_extra_ids', |
| 67 | type=int, |
| 68 | nargs='+', |
| 69 | help= |
| 70 | 'Input token extra ids for using p-tuning and KV Cache reuse together (only available with cpp session).', |
| 71 | default=None) |
| 72 | parser.add_argument( |
| 73 | '--input_token_extra_ids_file', |
| 74 | type=str, |
| 75 | help= |
| 76 | 'CSV or Numpy file containing input token extra ids file. Alternative to text input (only available with cpp session).', |
| 77 | default=None) |
| 78 | parser.add_argument('--output_csv', |
| 79 | type=str, |
| 80 | help='CSV file where the tokenized output is stored.', |
| 81 | default=None) |
| 82 | parser.add_argument('--output_npy', |
| 83 | type=str, |
| 84 | help='Numpy file where the tokenized output is stored.', |
| 85 | default=None) |
| 86 | parser.add_argument('--output_generation_logits', |
| 87 | default=False, |
| 88 | action='store_true', |
| 89 | help="Enable gathering generation logits.") |
| 90 | parser.add_argument( |
| 91 | '--output_logits_npy', |
| 92 | type=str, |
| 93 | help= |
| 94 | 'Numpy file where the generation logits are stored. Use only when num_beams==1', |
| 95 | default=None) |
| 96 | parser.add_argument('--output_log_probs_npy', |
| 97 | type=str, |
| 98 | help='Numpy file where the log_probs are stored', |