Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed yolo files #831

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove debug code, unused code
  • Loading branch information
katsu560 committed Jun 23, 2024
commit 695fbaf8ae96069fdd0b8d265bb08e6a99aa903f
14 changes: 2 additions & 12 deletions examples/yolo/gguf-addfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import os
import sys
from pathlib import Path
#from typing import Any
from typing import Any, Literal, NamedTuple, TypeVar, Union
from typing import Any
#from typing import Any, Literal, NamedTuple, TypeVar, Union

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -111,15 +111,6 @@ def copy_with_filename(reader: gguf.GGUFReader, writer: gguf.GGUFWriter, new_met
shape = np.flipud(tensor.shape)
writer.add_tensor_info(tensor.name, shape, tensor.data.dtype, tensor.data.nbytes, tensor.tensor_type)

offset_next = 0
len_last = 0
offset_last = 0
for n, tensor in enumerate(reader.tensors, 1):
len_last = tensor.n_bytes
offset_last = tensor.data_offset
offset_next = max(offset_next, writer.ggml_pad(offset_last + int(len_last), writer.data_alignment))

offs = offset_next
# add file info as tensor_info
for path in filename:
logger.debug(f'Adding {path}')
Expand Down Expand Up @@ -177,7 +168,6 @@ def main() -> None:
for path in args.addfiles:
filename.append(path)
logger.info(f'* Adding: {path}')
#new_metadata[Keys.EMBEDDED_FILES] = path
copy_with_filename(reader, writer, new_metadata, filename)


Expand Down
Loading