Instructions to use FrontiersMind/Nandi-Mini-600M-Early-Checkpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FrontiersMind/Nandi-Mini-600M-Early-Checkpoint with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FrontiersMind/Nandi-Mini-600M-Early-Checkpoint", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("FrontiersMind/Nandi-Mini-600M-Early-Checkpoint", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use FrontiersMind/Nandi-Mini-600M-Early-Checkpoint with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FrontiersMind/Nandi-Mini-600M-Early-Checkpoint" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FrontiersMind/Nandi-Mini-600M-Early-Checkpoint", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/FrontiersMind/Nandi-Mini-600M-Early-Checkpoint
- SGLang
How to use FrontiersMind/Nandi-Mini-600M-Early-Checkpoint 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 "FrontiersMind/Nandi-Mini-600M-Early-Checkpoint" \ --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": "FrontiersMind/Nandi-Mini-600M-Early-Checkpoint", "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 "FrontiersMind/Nandi-Mini-600M-Early-Checkpoint" \ --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": "FrontiersMind/Nandi-Mini-600M-Early-Checkpoint", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use FrontiersMind/Nandi-Mini-600M-Early-Checkpoint with Docker Model Runner:
docker model run hf.co/FrontiersMind/Nandi-Mini-600M-Early-Checkpoint
Update README.md
Browse files
README.md
CHANGED
|
@@ -72,7 +72,41 @@ Stay tuned!
|
|
| 72 |
|
| 73 |
Nandi-Mini-500M introduces several efficiency-focused architectural optimizations designed for compact yet capable language models.
|
| 74 |
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
Shared KV is one of the core architectural ideas explored in Nandi-Mini. Instead of storing separate Key and Value vectors, both share the same underlying representation, while a lightweight Key normalization step is applied specifically for attention computation.
|
| 78 |
|
|
|
|
| 72 |
|
| 73 |
Nandi-Mini-500M introduces several efficiency-focused architectural optimizations designed for compact yet capable language models.
|
| 74 |
|
| 75 |
+
|
| 76 |
+
### Shared KV KV-Cache Memory Comparison
|
| 77 |
+
|
| 78 |
+
The following comparison illustrates the KV-cache memory reduction enabled by Shared KV mode.
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
import matplotlib.pyplot as plt
|
| 82 |
+
|
| 83 |
+
modes = ["Vanilla KV", "Shared KV"]
|
| 84 |
+
memory = [100, 50]
|
| 85 |
+
|
| 86 |
+
plt.figure(figsize=(5,4))
|
| 87 |
+
bars = plt.bar(modes, memory)
|
| 88 |
+
|
| 89 |
+
plt.ylabel("Relative KV Cache Memory")
|
| 90 |
+
plt.title("KV Cache Memory Usage")
|
| 91 |
+
|
| 92 |
+
for bar, val in zip(bars, memory):
|
| 93 |
+
plt.text(
|
| 94 |
+
bar.get_x() + bar.get_width()/2,
|
| 95 |
+
val + 2,
|
| 96 |
+
f"{val}%",
|
| 97 |
+
ha='center'
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
plt.ylim(0, 120)
|
| 101 |
+
plt.show()
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
Expected result:
|
| 105 |
+
|
| 106 |
+
- Vanilla KV → 100% KV-cache memory
|
| 107 |
+
- Shared KV → ~50% KV-cache memory
|
| 108 |
+
|
| 109 |
+
Shared KV trades a small increase in compute overhead for significantly lower memory usage, since RoPE and Key normalization are applied dynamically during attention computation.
|
| 110 |
|
| 111 |
Shared KV is one of the core architectural ideas explored in Nandi-Mini. Instead of storing separate Key and Value vectors, both share the same underlying representation, while a lightweight Key normalization step is applied specifically for attention computation.
|
| 112 |
|