Instructions to use inference-optimization/Kimi-K3-0.40B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inference-optimization/Kimi-K3-0.40B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="inference-optimization/Kimi-K3-0.40B", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("inference-optimization/Kimi-K3-0.40B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
get error when served by sglang
error 1:
File "/sgl-workspace/sglang/python/sglang/srt/managers/multimodal_processor.py", line 67, in get_mm_processor
return processor_cls(
^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/multimodal/processors/kimi_k3.py", line 313, in init
media_proc_cfg = _processor.media_processor.media_proc_cfg
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/tokenization_utils_base.py", line 1316, in getattr
raise AttributeError(f"{self.class.name} has no attribute {key}")
AttributeError: TikTokenTokenizer has no attribute media_processor
error 2:
File "/sgl-workspace/sglang/python/sglang/srt/models/kimi_k3.py", line 1702, in forward
core_attn_out = self.attn(
^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1779, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1790, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/radix_linear_attention.py", line 115, in forward
return get_attn_backend().forward(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py", line 1086, in forward
return self.forward_decode(
^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py", line 1021, in forward_decode
return self.linear_attn_backend.forward_decode(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/attention/linear/kda_backend.py", line 507, in forward_decode
core_attn_out = self.kernel_dispatcher.packed_decode(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/attention/linear/kda_backend.py", line 189, in packed_decode
return self.decode_kernel.packed_decode(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/attention/linear/kernels/kda_triton.py", line 103, in packed_decode
fused_recurrent_kda_packed_decode(
File "/sgl-workspace/sglang/python/sglang/kernels/ops/attention/fla/fused_recurrent.py", line 635, in fused_recurrent_kda_packed_decode
raise ValueError(
ValueError: out must have shape (96, 1, 8, 32) (got out.shape=(96, 1, 8, 64)).