## gguf
This is a Python package for writing binary files in the [GGUF](https://github.com/ggerganov/ggml/pull/302)
(GGML Universal File) format.
See [convert-llama-hf-to-gguf.py](https://github.com/ggerganov/llama.cpp/blob/master/convert-llama-hf-to-gguf.py)
as an example for its usage.
## Installation
```sh
pip install gguf
```
## API Examples/Simple Tools
[examples/writer.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/examples/writer.py) — Generates `example.gguf` in the current directory to demonstrate generating a GGUF file. Note that this file cannot be used as a model.
[scripts/gguf-dump.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/scripts/gguf-dump.py) — Dumps a GGUF file's metadata to the console.
[scripts/gguf-set-metadata.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/scripts/gguf-set-metadata.py) — Allows changing simple metadata values in a GGUF file by key.
[scripts/gguf-convert-endian.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/scripts/gguf-convert-endian.py) — Allows converting the endianness of GGUF files.
## Development
Maintainers who participate in development of this package are advised to install it in editable mode:
```sh
cd /path/to/llama.cpp/gguf-py
pip install --editable .
```
**Note**: This may require to upgrade your Pip installation, with a message saying that editable installation currently requires `setup.py`.
In this case, upgrade Pip to the latest:
```sh
pip install --upgrade pip
```
## Automatic publishing with CI
There's a GitHub workflow to make a release automatically upon creation of tags in a specified format.
1. Bump the version in `pyproject.toml`.
2. Create a tag named `gguf-vx.x.x` where `x.x.x` is the semantic version number.
```sh
git tag -a gguf-v1.0.0 -m "Version 1.0 release"
```
3. Push the tags.
```sh
git push origin --tags
```
## Manual publishing
If you want to publish the package manually for any reason, you need to have `twine` and `build` installed:
```sh
pip install build twine
```
Then, follow these steps to release a new version:
1. Bump the version in `pyproject.toml`.
2. Build the package:
```sh
python -m build
```
3. Upload the generated distribution archives:
```sh
python -m twine upload dist/*
```
## TODO
- [ ] Add tests
- [ ] Include conversion scripts as command line entry points in this package.
Raw data
{
"_id": null,
"home_page": "https://ggml.ai",
"name": "gguf",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "ggml,gguf,llama.cpp",
"author": "GGML",
"author_email": "ggml@ggml.ai",
"download_url": "https://files.pythonhosted.org/packages/f3/ad/535c8afa732ee70ff4643d34655676db689fcf9b673470adb9faeac36937/gguf-0.6.0.tar.gz",
"platform": null,
"description": "## gguf\n\nThis is a Python package for writing binary files in the [GGUF](https://github.com/ggerganov/ggml/pull/302)\n(GGML Universal File) format.\n\nSee [convert-llama-hf-to-gguf.py](https://github.com/ggerganov/llama.cpp/blob/master/convert-llama-hf-to-gguf.py)\nas an example for its usage.\n\n## Installation\n```sh\npip install gguf\n```\n\n## API Examples/Simple Tools\n\n[examples/writer.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/examples/writer.py) \u2014 Generates `example.gguf` in the current directory to demonstrate generating a GGUF file. Note that this file cannot be used as a model.\n\n[scripts/gguf-dump.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/scripts/gguf-dump.py) \u2014 Dumps a GGUF file's metadata to the console.\n\n[scripts/gguf-set-metadata.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/scripts/gguf-set-metadata.py) \u2014 Allows changing simple metadata values in a GGUF file by key.\n\n[scripts/gguf-convert-endian.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/scripts/gguf-convert-endian.py) \u2014 Allows converting the endianness of GGUF files.\n\n## Development\nMaintainers who participate in development of this package are advised to install it in editable mode:\n\n```sh\ncd /path/to/llama.cpp/gguf-py\n\npip install --editable .\n```\n\n**Note**: This may require to upgrade your Pip installation, with a message saying that editable installation currently requires `setup.py`.\nIn this case, upgrade Pip to the latest:\n\n```sh\npip install --upgrade pip\n```\n\n## Automatic publishing with CI\n\nThere's a GitHub workflow to make a release automatically upon creation of tags in a specified format.\n\n1. Bump the version in `pyproject.toml`.\n2. Create a tag named `gguf-vx.x.x` where `x.x.x` is the semantic version number.\n\n```sh\ngit tag -a gguf-v1.0.0 -m \"Version 1.0 release\"\n```\n\n3. Push the tags.\n\n```sh\ngit push origin --tags\n```\n\n## Manual publishing\nIf you want to publish the package manually for any reason, you need to have `twine` and `build` installed:\n\n```sh\npip install build twine\n```\n\nThen, follow these steps to release a new version:\n\n1. Bump the version in `pyproject.toml`.\n2. Build the package:\n\n```sh\npython -m build\n```\n\n3. Upload the generated distribution archives:\n\n```sh\npython -m twine upload dist/*\n```\n\n## TODO\n- [ ] Add tests\n- [ ] Include conversion scripts as command line entry points in this package.\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Read and write ML models in GGUF for GGML",
"version": "0.6.0",
"project_urls": {
"Homepage": "https://ggml.ai",
"Repository": "https://github.com/ggerganov/llama.cpp"
},
"split_keywords": [
"ggml",
"gguf",
"llama.cpp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "97a483969343abb00fe787de5965c5c1f617aa51b2e2c563d4391c402aba548f",
"md5": "28780b81ae82663ea7a703a4491b9c0d",
"sha256": "7ef6d0cf27b3cc4f11397140be7cf45b5904b751331ea9453839a17004f06762"
},
"downloads": -1,
"filename": "gguf-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28780b81ae82663ea7a703a4491b9c0d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 23922,
"upload_time": "2023-12-12T16:49:52",
"upload_time_iso_8601": "2023-12-12T16:49:52.006314Z",
"url": "https://files.pythonhosted.org/packages/97/a4/83969343abb00fe787de5965c5c1f617aa51b2e2c563d4391c402aba548f/gguf-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f3ad535c8afa732ee70ff4643d34655676db689fcf9b673470adb9faeac36937",
"md5": "ddea40aa9bb5dde01203e0d2addc732d",
"sha256": "b2e22eaba2a106c1ad148186a14ad9f29c429351686fe9d7ce16df39a0607e65"
},
"downloads": -1,
"filename": "gguf-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "ddea40aa9bb5dde01203e0d2addc732d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20049,
"upload_time": "2023-12-12T16:49:53",
"upload_time_iso_8601": "2023-12-12T16:49:53.315611Z",
"url": "https://files.pythonhosted.org/packages/f3/ad/535c8afa732ee70ff4643d34655676db689fcf9b673470adb9faeac36937/gguf-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-12 16:49:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ggerganov",
"github_project": "llama.cpp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"==",
"1.24.4"
]
]
},
{
"name": "sentencepiece",
"specs": [
[
"==",
"0.1.98"
]
]
},
{
"name": "gguf",
"specs": [
[
">=",
"0.1.0"
]
]
}
],
"lcname": "gguf"
}