Instructions to use MinimaLabs/KLM-1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MinimaLabs/KLM-1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MinimaLabs/KLM-1.5", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MinimaLabs/KLM-1.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MinimaLabs/KLM-1.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MinimaLabs/KLM-1.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinimaLabs/KLM-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MinimaLabs/KLM-1.5
- SGLang
How to use MinimaLabs/KLM-1.5 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MinimaLabs/KLM-1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinimaLabs/KLM-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MinimaLabs/KLM-1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinimaLabs/KLM-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MinimaLabs/KLM-1.5 with Docker Model Runner:
docker model run hf.co/MinimaLabs/KLM-1.5
Why not Loop transformer?
i see how you built your model like kimi-k3. You used GDN-2 instead of KDA. plus you added n-gram. But why didn't you use looped transformer? It's pretty easy and simple way to get better performance. is it because of compute time?('more layer/more loop=more compute time' as far as i know) or something else?
btw you added n-gram like longcat right? not like deepseek(U know, 'engram' and 'n-gram')
& im also making and own SLM from scratch. Any tips?
hey, thanks!
its not really based on kimi-k3 tbh the 3:1 linear/full attention hybrid is pretty standard now so it isnt like a one model thing. we went with GDN-2 because it's basically a generalization of KDA (tie its gates and you get KDA), and it did better in their paper. the bit we actually took from kimi is block attention residuals (replacing the full attention residuals that we were originally gonna do)
for looping yeah, compute is pretty much the reason. Due to attention residuals the model was already quite compute heavy and adding loops would make it more. Although if you are interested in looped model then you can check out our min spark series, they are <10m models and use loops. and the n-grams yes are closer to longcat. it's at the input next to the token embeddings not inside the layers like engram.
and for SLMs at this scale data matters way more than architecture at this size also a small vocab with tied embeddings saves a ton of params so you should use that, and run a couple of seeds/ablations before you trust any small improvement lol (otherwise youd be noise maxing). good luck with yours!
thanks for the reply!
two more thing. when you built your models how much does it cost? and time(designing arch+testing+training)?
well, if you are not comfortable sharing that's ok.