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