mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-04-28 11:49:51 +00:00
Some checks failed
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 Fake Tag / publish (push) Has been cancelled
Release to PyPI / Build & publish sglang-kt (push) Has been cancelled
Release to PyPI / Build kt-kernel (Python 3.11) (push) Has been cancelled
Release to PyPI / Build kt-kernel (Python 3.12) (push) Has been cancelled
Release sglang-kt to PyPI / Build sglang-kt wheel (push) Has been cancelled
Release to PyPI / Publish kt-kernel to PyPI (push) Has been cancelled
Release sglang-kt to PyPI / Publish sglang-kt to PyPI (push) Has been cancelled
* [build]: prepare 0.6.1 SFT wheel packaging on main * [build]: finalize py311+ wheel packaging defaults
34 lines
830 B
Python
34 lines
830 B
Python
"""Top-level Python package 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] = {}
|
|
exec((Path(__file__).resolve().parents[1] / 'version.py').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']
|