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 to model(gguf) file #829

Closed
wants to merge 0 commits into from

Conversation

katsu560
Copy link
Contributor

Some app like yolov3-tiny needs additional files to execute such as label(coco.names) and alphabet labels(100_0.png, ...) files. If these files are embedded to a model(gguf) file and the app read them from the model file, the app is more portable.

I added below

  • added new GGUF_TYPE_NAMEDOBJECT with name(file path) and value(file body) for adding files to gguf
  • expanded gguf-py to support NAMEDOBJECT, constants.py, gguf_reader.py, gguf_writer.py
  • added gguf-addfile.py script to add files to gguf file
    • add files as NAMEDOBJECT (general.namedobject.N) or add files as NAMEDOBJECT array (general.namedobject[N] with --array option)
  • expanded ggml to support NAMEDOBJECT, ggml.h ggml.c
  • expanded yolov3-tiny to read coco.names and alphabet labels from gguf file,
    • at first read from gguf, then read from file if failed from gguf

NAMEDOBJECT constructed from name(file path) and value(file body)

    struct gguf_nobj {
        uint64_t nname;  // length of name
        char   * name;   // name in utf8
        uint64_t n;      // length of data in bytes
        char   * data;   // data body (file body)
    };

script usage:

python3 gguf-addfile.py [--array] input-gguf-file output-gguf-file files ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant