mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-04-26 10:50:59 +00:00
Some checks are pending
Book-CI / test (push) Waiting to run
Book-CI / test-1 (push) Waiting to run
Book-CI / test-2 (push) Waiting to run
Deploy / deploy (macos-latest) (push) Waiting to run
Deploy / deploy (ubuntu-latest) (push) Waiting to run
Deploy / deploy (windows-latest) (push) Waiting to run
Release sglang-kt to PyPI / Build sglang-kt wheel (push) Waiting to run
Release sglang-kt to PyPI / Publish sglang-kt to PyPI (push) Blocked by required conditions
35 lines
857 B
Python
35 lines
857 B
Python
"""Top-level Python module for KTransformers.
|
|
|
|
The runtime kernels live in kt-kernel. Optional SFT support is activated
|
|
via pip install "ktransformers[sft]" which adds transformers-kt and
|
|
accelerate-kt to the environment.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from importlib.metadata import PackageNotFoundError, version
|
|
from pathlib import Path
|
|
|
|
|
|
def _read_repo_version() -> str:
|
|
ns: dict[str, str] = {}
|
|
version_file = Path(__file__).resolve().with_name("version.py")
|
|
exec(version_file.read_text(), ns)
|
|
return ns["__version__"]
|
|
|
|
|
|
try:
|
|
__version__ = version("ktransformers")
|
|
except PackageNotFoundError:
|
|
__version__ = _read_repo_version()
|
|
|
|
|
|
def has_sft_support() -> bool:
|
|
try:
|
|
import kt_kernel.sft # noqa: F401
|
|
except Exception:
|
|
return False
|
|
return True
|
|
|
|
|
|
__all__ = ["__version__", "has_sft_support"]
|