| 1474 | |
| 1475 | |
| 1476 | def default_outfile(model_paths: list[Path], file_type: GGMLFileType) -> Path: |
| 1477 | namestr = { |
| 1478 | GGMLFileType.AllF32: "f32", |
| 1479 | GGMLFileType.MostlyF16: "f16", |
| 1480 | GGMLFileType.MostlyQ8_0:"q8_0", |
| 1481 | GGMLFileType.MostlyI2: "i2", |
| 1482 | }[file_type] |
| 1483 | ret = model_paths[0].parent / f"ggml-model-{namestr}.gguf" |
| 1484 | if ret in model_paths: |
| 1485 | logger.error( |
| 1486 | f"Error: Default output path ({ret}) would overwrite the input. " |
| 1487 | "Please explicitly specify a path using --outfile.") |
| 1488 | sys.exit(1) |
| 1489 | return ret |
| 1490 | |
| 1491 | |
| 1492 | def do_dump_model(model_plus: ModelPlus) -> None: |