Export one safetensors file to its dummy-meta counterpart.
(input_path: str, output_path: str)
| 57 | |
| 58 | |
| 59 | def export_single_file(input_path: str, output_path: str): |
| 60 | """Export one safetensors file to its dummy-meta counterpart.""" |
| 61 | tensor_meta = read_tensor_metadata(input_path) |
| 62 | write_dummy_meta_safetensors(tensor_meta, output_path, source_filename=os.path.basename(input_path)) |
| 63 | |
| 64 | input_size = os.path.getsize(input_path) |
| 65 | output_size = os.path.getsize(output_path) |
| 66 | print(f" {os.path.basename(input_path)}: {input_size / 1024 / 1024:.1f} MB -> {output_size / 1024:.1f} KB ({len(tensor_meta)} tensors)") |
| 67 | |
| 68 | |
| 69 | def main(): |
no test coverage detected