#include "../../cache/cache.hpp" #include "infinicore/tensor.hpp" #include #include namespace py = pybind11; namespace infinilm::cache { inline void bind_cache(py::module &m) { py::class_>(m, "CacheConfig") .def("__repr__", [](const infinilm::cache::CacheConfig &) { return ""; }); py::class_>(m, "StaticKVCacheConfig") .def( py::init(), py::arg("max_batch_size") = 1, py::arg("max_cache_len") = std::numeric_limits::max()) .def( "max_batch_size", &infinilm::cache::StaticKVCacheConfig::max_batch_size) .def( "max_cache_len", &infinilm::cache::StaticKVCacheConfig::max_cache_len) .def("__repr__", [](const infinilm::cache::StaticKVCacheConfig &) { return ""; }); py::class_>(m, "PagedKVCacheConfig") .def( py::init(), py::arg("num_blocks"), py::arg("block_size") = 16) .def( "num_blocks", &infinilm::cache::PagedKVCacheConfig::num_blocks) .def( "block_size", &infinilm::cache::PagedKVCacheConfig::block_size) .def("__repr__", [](const infinilm::cache::PagedKVCacheConfig &) { return ""; }); } } // namespace infinilm::cache