| 1087 | } |
| 1088 | |
| 1089 | void print_common_train_usage(int /*argc*/, char ** /*argv*/, const struct train_params_common * params) { |
| 1090 | // fprintf(stderr, "usage: %s [options]\n", argv[0]); |
| 1091 | // fprintf(stderr, "\n"); |
| 1092 | // fprintf(stderr, "options:\n"); |
| 1093 | // fprintf(stderr, " -h, --help show this help message and exit\n"); |
| 1094 | fprintf(stderr, " --train-data FNAME path from which to load training data (default '%s')\n", params->fn_train_data); |
| 1095 | fprintf(stderr, " --checkpoint-in FNAME path from which to load training checkpoint (default '%s')\n", params->fn_checkpoint_in); |
| 1096 | fprintf(stderr, " --checkpoint-out FNAME path to save training checkpoint (default '%s')\n", params->fn_checkpoint_out); |
| 1097 | fprintf(stderr, " --pattern-fn-it STR pattern in output filenames to be replaced by iteration number (default '%s')\n", params->pattern_fn_it); |
| 1098 | fprintf(stderr, " --fn-latest STR string to use instead of iteration number for saving latest output (default '%s')\n", params->fn_latest); |
| 1099 | fprintf(stderr, " --save-every N save checkpoint and lora every N iterations. Disabled when N <= 0. (default '%d')\n", params->save_every); |
| 1100 | fprintf(stderr, " -s SEED, --seed SEED RNG seed (default: -1, use random seed for -1)\n"); |
| 1101 | fprintf(stderr, " -c N, --ctx N Context size used during training (default %d)\n", params->n_ctx); |
| 1102 | fprintf(stderr, " -t N, --threads N Number of threads (default %d)\n", params->n_threads); |
| 1103 | fprintf(stderr, " -b N, --batch N Parallel batch size (default %d)\n", params->n_batch); |
| 1104 | fprintf(stderr, " --grad-acc N Number of gradient accumulation steps (simulates larger batch size of batch*gradacc) (default %d)\n", params->n_gradient_accumulation); |
| 1105 | fprintf(stderr, " --sample-start STR Sets the starting point for samples after the specified pattern. If empty use every token position as sample start. (default '%s')\n", params->sample_start.c_str()); |
| 1106 | fprintf(stderr, " --include-sample-start Include the sample start in the samples. (default off)\n"); |
| 1107 | fprintf(stderr, " --escape process sample start escapes sequences (\\n, \\r, \\t, \\', \\\", \\\\)\n"); |
| 1108 | fprintf(stderr, " --overlapping-samples Samples my overlap, will include sample-start of second and following samples. When off, samples will end at begin of next sample. (default off)\n"); |
| 1109 | fprintf(stderr, " --fill-with-next-samples Samples shorter than context length will be followed by the next (shuffled) samples. (default off)\n"); |
| 1110 | fprintf(stderr, " --separate-with-eos When fill-with-next-samples, insert end-of-sequence token between samples.%s\n", params->separate_with_eos ? " (default)" : ""); |
| 1111 | fprintf(stderr, " --separate-with-bos When fill-with-next-samples, insert begin-of-sequence token between samples.%s\n", params->separate_with_bos ? " (default)" : ""); |
| 1112 | fprintf(stderr, " --no-separate-with-eos When fill-with-next-samples, don't insert end-of-sequence token between samples.%s\n", !params->separate_with_eos ? " (default)" : ""); |
| 1113 | fprintf(stderr, " --no-separate-with-bos When fill-with-next-samples, don't insert begin-of-sequence token between samples.%s\n", !params->separate_with_bos ? " (default)" : ""); |
| 1114 | fprintf(stderr, " --sample-random-offsets Use samples beginning at random offsets. Together with fill-with-next-samples this may help for training endless text generation.%s\n", params->sample_random_offsets ? " (default)" : ""); |
| 1115 | fprintf(stderr, " --force-reshuffle Force a reshuffling of data at program start, otherwise the shuffling of loaded checkpoint is resumed.\n"); |
| 1116 | fprintf(stderr, " --no-flash Don't use flash attention \n"); |
| 1117 | fprintf(stderr, " --use-flash Use flash attention (default)\n"); |
| 1118 | fprintf(stderr, " --no-checkpointing Don't use gradient checkpointing\n"); |
| 1119 | fprintf(stderr, " --use-checkpointing Use gradient checkpointing (default)\n"); |
| 1120 | fprintf(stderr, " --warmup N Only for Adam optimizer. Number of warmup steps (default %d)\n", params->warmup); |
| 1121 | fprintf(stderr, " --cos-decay-steps N Only for Adam optimizer. Number of cosine decay steps (default %d)\n", params->cos_decay_steps); |
| 1122 | fprintf(stderr, " --cos-decay-restart N Only for Adam optimizer. Increase of cosine decay steps after restart (default %f)\n", params->cos_decay_restart); |
| 1123 | fprintf(stderr, " --cos-decay-min N Only for Adam optimizer. Cosine decay minimum (default %f)\n", params->cos_decay_min); |
| 1124 | fprintf(stderr, " --enable-restart N Only for Adam optimizer. Enable restarts of cos-decay %s\n", params->enable_restart ? "(default)" : ""); |
| 1125 | fprintf(stderr, " --disable-restart N Only for Adam optimizer. Disable restarts of cos-decay %s\n", !params->enable_restart ? "(default)" : ""); |
| 1126 | fprintf(stderr, " --opt-past N Number of optimization iterations to track for delta convergence test. Disabled when zero. (default %d)\n", params->opt_past); |
| 1127 | fprintf(stderr, " --opt-delta N Maximum delta for delta convergence test. Disabled when <= zero. (default %f)\n", params->opt_delta); |
| 1128 | fprintf(stderr, " --opt-max-no-improvement N Maximum number of optimization iterations with no improvement. Disabled when <= zero. (default %d)\n", params->opt_max_no_improvement); |
| 1129 | fprintf(stderr, " --epochs N Maximum number epochs to process. (default %d)\n", params->n_epochs); |
| 1130 | fprintf(stderr, " --adam-iter N Maximum number of Adam optimization iterations for each batch (default %d)\n", params->adam_n_iter); |
| 1131 | fprintf(stderr, " --adam-alpha N Adam learning rate alpha (default %f)\n", params->adam_alpha); |
| 1132 | fprintf(stderr, " --adam-min-alpha N Adam minimum learning rate alpha - including warmup phase (default %f)\n", params->adam_min_alpha); |
| 1133 | fprintf(stderr, " --adam-decay N AdamW weight decay. Values greater zero enable AdamW instead of regular Adam. (default %f)\n", params->adam_decay); |
| 1134 | fprintf(stderr, " --adam-decay-min-ndim N Minimum number of tensor dimensions to apply AdamW weight decay. Weight decay is not applied to tensors with less n_dims. (default %d)\n", params->adam_decay_min_ndim); |
| 1135 | fprintf(stderr, " --adam-beta1 N AdamW beta1 in interval [0,1). How much to smooth the first moment of gradients. (default %f)\n", params->adam_beta1); |
| 1136 | fprintf(stderr, " --adam-beta2 N AdamW beta2 in interval [0,1). How much to smooth the second moment of gradients. (default %f)\n", params->adam_beta2); |
| 1137 | fprintf(stderr, " --adam-gclip N AdamW gradient clipping. Disabled when zero. (default %f)\n", params->adam_gclip); |
| 1138 | fprintf(stderr, " --adam-epsf N AdamW epsilon for convergence test. Disabled when <= zero. (default %f)\n", params->adam_eps_f); |
| 1139 | fprintf(stderr, "\n"); |
| 1140 | } |
| 1141 | |
| 1142 | bool consume_common_train_arg( |
| 1143 | int argc, char ** argv, int * idx, struct train_params_common * params, bool * invalid_param |
no test coverage detected