Skip to content

Commit dcd868f

Browse files
VJHackNeoZhangJianyu
authored andcommitted
gguf-py: fixed local detection of gguf package (ggml-org#11180)
* updated path to gguf package for non-installed setups * added reader.py to readme * Bumped gguf version to 0.15.0
1 parent 4181a5f commit dcd868f

File tree

7 files changed

+13
-11
lines changed

7 files changed

+13
-11
lines changed

gguf-py/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pip install gguf
1515

1616
[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.
1717

18+
[examples/reader.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/examples/reader.py) — Extracts and displays key-value pairs and tensor details from a GGUF file in a readable format.
19+
1820
[gguf/scripts/gguf_dump.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/gguf/scripts/gguf_dump.py) — Dumps a GGUF file's metadata to the console.
1921

2022
[gguf/scripts/gguf_set_metadata.py](https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/gguf/scripts/gguf_set_metadata.py) — Allows changing simple metadata values in a GGUF file by key.

gguf-py/gguf/scripts/gguf_convert_endian.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import numpy as np
1212

1313
# Necessary to load the local gguf package
14-
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent / 'gguf-py').exists():
15-
sys.path.insert(0, str(Path(__file__).parent.parent))
14+
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent.parent / 'gguf-py').exists():
15+
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
1616

1717
import gguf
1818

gguf-py/gguf/scripts/gguf_dump.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import numpy as np
1313

1414
# Necessary to load the local gguf package
15-
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent / 'gguf-py').exists():
16-
sys.path.insert(0, str(Path(__file__).parent.parent))
15+
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent.parent / 'gguf-py').exists():
16+
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
1717

1818
from gguf import GGUFReader, GGUFValueType, ReaderTensor # noqa: E402
1919

gguf-py/gguf/scripts/gguf_hash.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from tqdm import tqdm
1414

1515
# Necessary to load the local gguf package
16-
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent / 'gguf-py').exists():
17-
sys.path.insert(0, str(Path(__file__).parent.parent))
16+
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent.parent / 'gguf-py').exists():
17+
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
1818

1919
from gguf import GGUFReader # noqa: E402
2020

gguf-py/gguf/scripts/gguf_new_metadata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from typing import Any, Sequence, NamedTuple
1414

1515
# Necessary to load the local gguf package
16-
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent / 'gguf-py').exists():
17-
sys.path.insert(0, str(Path(__file__).parent.parent))
16+
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent.parent / 'gguf-py').exists():
17+
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
1818

1919
import gguf
2020

gguf-py/gguf/scripts/gguf_set_metadata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from pathlib import Path
77

88
# Necessary to load the local gguf package
9-
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent / 'gguf-py').exists():
10-
sys.path.insert(0, str(Path(__file__).parent.parent))
9+
if "NO_LOCAL_GGUF" not in os.environ and (Path(__file__).parent.parent.parent.parent / 'gguf-py').exists():
10+
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
1111

1212
from gguf import GGUFReader # noqa: E402
1313

gguf-py/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gguf"
3-
version = "0.14.0"
3+
version = "0.15.0"
44
description = "Read and write ML models in GGUF for GGML"
55
authors = ["GGML <ggml@ggml.ai>"]
66
packages = [

0 commit comments

Comments
 (0)