| 226 | } |
| 227 | |
| 228 | int main(int argc, char ** argv) { |
| 229 | ggml_time_init(); |
| 230 | |
| 231 | quantize_stats_params params; |
| 232 | |
| 233 | // read command line |
| 234 | |
| 235 | int max_thread = 0; |
| 236 | bool invalid_param = false; |
| 237 | std::string arg; |
| 238 | for (int i = 1; i < argc; i++) { |
| 239 | arg = argv[i]; |
| 240 | |
| 241 | if (arg == "-h" || arg == "--help") { |
| 242 | quantize_stats_print_usage(argc, argv); |
| 243 | exit(0); |
| 244 | } else if (arg == "-r" || arg == "--reference") { |
| 245 | params.reference = true; |
| 246 | } else if (arg == "-v") { |
| 247 | params.verbose = true; |
| 248 | } else if (arg == "-p" || arg == "--per-layer-stats") { |
| 249 | params.per_layer_stats = true; |
| 250 | } else if (arg == "--histogram") { |
| 251 | params.print_histogram = true; |
| 252 | } else if (arg == "-m" || arg == "--model") { |
| 253 | if (++i >= argc) { |
| 254 | invalid_param = true; |
| 255 | break; |
| 256 | } |
| 257 | params.model = argv[i]; |
| 258 | } else if (arg == "-l" || arg == "--include-layer") { |
| 259 | if (++i >= argc) { |
| 260 | invalid_param = true; |
| 261 | break; |
| 262 | } |
| 263 | params.include_layers.emplace_back(argv[i]); |
| 264 | } else if (arg == "-L" || arg == "--exclude-layer") { |
| 265 | if (++i >= argc) { |
| 266 | invalid_param = true; |
| 267 | break; |
| 268 | } |
| 269 | params.exclude_layers.emplace_back(argv[i]); |
| 270 | } else if (arg == "-t" || arg == "--type") { |
| 271 | if (++i >= argc) { |
| 272 | invalid_param = true; |
| 273 | break; |
| 274 | } |
| 275 | int j; |
| 276 | for (j = 0; j < GGML_TYPE_COUNT; ++j) { |
| 277 | const auto * name = ggml_type_name((ggml_type) j); |
| 278 | if (name && strcmp(argv[i], name) == 0) break; |
| 279 | } |
| 280 | if (j < GGML_TYPE_COUNT) { |
| 281 | params.include_types.push_back((ggml_type) j); |
| 282 | } else { |
| 283 | fprintf(stderr, "error: %s not in list of types\n", argv[i]); |
| 284 | invalid_param = true; |
| 285 | } |
nothing calls this directly
no test coverage detected