|
8 | 8 | import os |
9 | 9 | import sys |
10 | 10 | from pathlib import Path |
11 | | -#from typing import Any |
12 | | -from typing import Any, Literal, NamedTuple, TypeVar, Union |
| 11 | +from typing import Any |
| 12 | +#from typing import Any, Literal, NamedTuple, TypeVar, Union |
13 | 13 |
|
14 | 14 | import numpy as np |
15 | 15 | import numpy.typing as npt |
@@ -111,15 +111,6 @@ def copy_with_filename(reader: gguf.GGUFReader, writer: gguf.GGUFWriter, new_met |
111 | 111 | shape = np.flipud(tensor.shape) |
112 | 112 | writer.add_tensor_info(tensor.name, shape, tensor.data.dtype, tensor.data.nbytes, tensor.tensor_type) |
113 | 113 |
|
114 | | - offset_next = 0 |
115 | | - len_last = 0 |
116 | | - offset_last = 0 |
117 | | - for n, tensor in enumerate(reader.tensors, 1): |
118 | | - len_last = tensor.n_bytes |
119 | | - offset_last = tensor.data_offset |
120 | | - offset_next = max(offset_next, writer.ggml_pad(offset_last + int(len_last), writer.data_alignment)) |
121 | | - |
122 | | - offs = offset_next |
123 | 114 | # add file info as tensor_info |
124 | 115 | for path in filename: |
125 | 116 | logger.debug(f'Adding {path}') |
@@ -177,7 +168,6 @@ def main() -> None: |
177 | 168 | for path in args.addfiles: |
178 | 169 | filename.append(path) |
179 | 170 | logger.info(f'* Adding: {path}') |
180 | | - #new_metadata[Keys.EMBEDDED_FILES] = path |
181 | 171 | copy_with_filename(reader, writer, new_metadata, filename) |
182 | 172 |
|
183 | 173 |
|
|
0 commit comments