Text Generation
Transformers
Safetensors
PyTorch
English
neollm
causal-lm
research
bf16
attention
normalization
conversational
custom_code
Instructions to use KitsuVp/NeoLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KitsuVp/NeoLLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KitsuVp/NeoLLM", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("KitsuVp/NeoLLM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KitsuVp/NeoLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KitsuVp/NeoLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KitsuVp/NeoLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KitsuVp/NeoLLM
- SGLang
How to use KitsuVp/NeoLLM 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 "KitsuVp/NeoLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KitsuVp/NeoLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "KitsuVp/NeoLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KitsuVp/NeoLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KitsuVp/NeoLLM with Docker Model Runner:
docker model run hf.co/KitsuVp/NeoLLM
Update modeling_neollm.py
Browse files- modeling_neollm.py +12 -3
modeling_neollm.py
CHANGED
|
@@ -5200,10 +5200,15 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 5200 |
self.use_jtokm = config.use_jtokm
|
| 5201 |
# Controls only the first pre-attention normalisation applied directly
|
| 5202 |
# to the embedding stream. Defaults to True for checkpoint/config
|
| 5203 |
-
# backward compatibility.
|
|
|
|
|
|
|
| 5204 |
self.use_embedding_input_norm = bool(
|
| 5205 |
getattr(config, "use_embedding_input_norm", True)
|
| 5206 |
)
|
|
|
|
|
|
|
|
|
|
| 5207 |
|
| 5208 |
self.self_attn = NeoLLMAttention(config, layer_idx)
|
| 5209 |
self.mlp = (
|
|
@@ -5212,7 +5217,11 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 5212 |
else NeoLLMMLP(config)
|
| 5213 |
)
|
| 5214 |
self.use_versatile_ffn = getattr(config, "use_versatile_ffn", False)
|
| 5215 |
-
self.input_layernorm =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5216 |
self.post_attention_layernorm = SeeDNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 5217 |
self.lns_attn = LNS(layer_idx)
|
| 5218 |
self.lns_mlp = LNS(layer_idx)
|
|
@@ -5506,7 +5515,7 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 5506 |
# embedding magnitudes to attention.
|
| 5507 |
# layer_idx > 0: keep the standard pre-norm Transformer flow exactly
|
| 5508 |
# as before.
|
| 5509 |
-
if self.
|
| 5510 |
h_normed = h_attn
|
| 5511 |
if sn_pre is not None:
|
| 5512 |
# Analysis compatibility: mark the bypass as the observed
|
|
|
|
| 5200 |
self.use_jtokm = config.use_jtokm
|
| 5201 |
# Controls only the first pre-attention normalisation applied directly
|
| 5202 |
# to the embedding stream. Defaults to True for checkpoint/config
|
| 5203 |
+
# backward compatibility. When False, layer 0 does not instantiate
|
| 5204 |
+
# input_layernorm at all, so the flag removes the corresponding
|
| 5205 |
+
# SeeDNorm parameters instead of merely bypassing them in forward.
|
| 5206 |
self.use_embedding_input_norm = bool(
|
| 5207 |
getattr(config, "use_embedding_input_norm", True)
|
| 5208 |
)
|
| 5209 |
+
self.has_input_layernorm = not (
|
| 5210 |
+
self.layer_idx == 0 and not self.use_embedding_input_norm
|
| 5211 |
+
)
|
| 5212 |
|
| 5213 |
self.self_attn = NeoLLMAttention(config, layer_idx)
|
| 5214 |
self.mlp = (
|
|
|
|
| 5217 |
else NeoLLMMLP(config)
|
| 5218 |
)
|
| 5219 |
self.use_versatile_ffn = getattr(config, "use_versatile_ffn", False)
|
| 5220 |
+
self.input_layernorm = (
|
| 5221 |
+
SeeDNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 5222 |
+
if self.has_input_layernorm
|
| 5223 |
+
else None
|
| 5224 |
+
)
|
| 5225 |
self.post_attention_layernorm = SeeDNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 5226 |
self.lns_attn = LNS(layer_idx)
|
| 5227 |
self.lns_mlp = LNS(layer_idx)
|
|
|
|
| 5515 |
# embedding magnitudes to attention.
|
| 5516 |
# layer_idx > 0: keep the standard pre-norm Transformer flow exactly
|
| 5517 |
# as before.
|
| 5518 |
+
if self.input_layernorm is None:
|
| 5519 |
h_normed = h_attn
|
| 5520 |
if sn_pre is not None:
|
| 5521 |
# Analysis compatibility: mark the bypass as the observed
|