from pathlib import Path
from typing import Any, Callable, Sequence, Mapping, Iterable, Protocol, ClassVar, runtime_checkable
-from sentencepiece import SentencePieceProcessor
+try:
+ from sentencepiece import SentencePieceProcessor
+except ImportError:
+ SentencePieceProcessor = None
import gguf
name = "spm"
def __init__(self, base_path: Path):
+ if SentencePieceProcessor is None:
+ raise RuntimeError("sentencepiece is not installed")
+
added_tokens: dict[str, int] = {}
if (fname_tokenizer := base_path / 'tokenizer.model').exists():
# normal location
[tool.poetry]
name = "gguf"
-version = "0.17.0"
+version = "0.17.1"
description = "Read and write ML models in GGUF for GGML"
authors = ["GGML <ggml@ggml.ai>"]
packages = [
numpy = ">=1.17"
tqdm = ">=4.27"
pyyaml = ">=5.1"
-sentencepiece = ">=0.1.98,<=0.2.0"
+sentencepiece = { version = ">=0.1.98,<=0.2.0", optional = true }
PySide6 = { version = "^6.9", python = ">=3.9,<3.14", optional = true }
[tool.poetry.dev-dependencies]