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 configuration_nandi.py
Browse files- configuration_nandi.py +3 -31
configuration_nandi.py
CHANGED
|
@@ -1,17 +1,3 @@
|
|
| 1 |
-
# Copyright 2026 RTA AI Labs. All rights reserved.
|
| 2 |
-
#
|
| 3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
-
# you may not use this file except in compliance with the License.
|
| 5 |
-
# You may obtain a copy of the License at
|
| 6 |
-
#
|
| 7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
-
#
|
| 9 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
-
# See the License for the specific language governing permissions and
|
| 13 |
-
# limitations under the License.
|
| 14 |
-
|
| 15 |
from transformers.configuration_utils import PretrainedConfig
|
| 16 |
|
| 17 |
|
|
@@ -97,26 +83,12 @@ class NandiConfig(PretrainedConfig):
|
|
| 97 |
self.factorized_embedding = factorized_embedding
|
| 98 |
self.embedding_rank = embedding_rank
|
| 99 |
self.layer_sharing = layer_sharing
|
| 100 |
-
|
| 101 |
-
# (it does NOT check `layer_sharing`). Preserve the raw value here so
|
| 102 |
-
# the modeling code can honor it; the `layer_sharing` bool is now just
|
| 103 |
-
# metadata describing intent.
|
| 104 |
self.layer_sharing_repeats = max(1, int(layer_sharing_repeats or 1))
|
| 105 |
self.qk_norm = qk_norm
|
| 106 |
-
|
| 107 |
-
# HF model V is recomputed from `k_proj` at runtime (no `v_proj` module
|
| 108 |
-
# is materialised); see `NandiAttention.forward`.
|
| 109 |
self.shared_kv = shared_kv
|
| 110 |
-
|
| 111 |
-
# `shared_kv=True`. Both modes produce identical outputs (numerical
|
| 112 |
-
# round-off only); they trade memory for compute:
|
| 113 |
-
# "shared" -> cache ONLY raw K (single tensor per layer). Each
|
| 114 |
-
# decode step re-applies k_norm + RoPE to the full
|
| 115 |
-
# cached raw K. Halves KV-cache memory.
|
| 116 |
-
# "vanilla" -> cache post-norm post-RoPE K AND raw V (two tensors
|
| 117 |
-
# per layer). k_norm + RoPE are applied only to the
|
| 118 |
-
# current step's tokens. Standard HF behavior.
|
| 119 |
-
# Ignored when `shared_kv=False`. Defaults to "shared".
|
| 120 |
if kv_cache_mode not in ("shared", "vanilla"):
|
| 121 |
raise ValueError(
|
| 122 |
f"`kv_cache_mode` must be 'shared' or 'vanilla', got {kv_cache_mode!r}."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from transformers.configuration_utils import PretrainedConfig
|
| 2 |
|
| 3 |
|
|
|
|
| 83 |
self.factorized_embedding = factorized_embedding
|
| 84 |
self.embedding_rank = embedding_rank
|
| 85 |
self.layer_sharing = layer_sharing
|
| 86 |
+
|
|
|
|
|
|
|
|
|
|
| 87 |
self.layer_sharing_repeats = max(1, int(layer_sharing_repeats or 1))
|
| 88 |
self.qk_norm = qk_norm
|
| 89 |
+
|
|
|
|
|
|
|
| 90 |
self.shared_kv = shared_kv
|
| 91 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
if kv_cache_mode not in ("shared", "vanilla"):
|
| 93 |
raise ValueError(
|
| 94 |
f"`kv_cache_mode` must be 'shared' or 'vanilla', got {kv_cache_mode!r}."
|