Text Generation
Transformers
Safetensors
English
kent
ssm
state-space-model
recurrent
linear-time
frequency-domain
dct
mlp
swiglu
custom_code
fp16
base
Instructions to use Vi-LAB/KenT-1B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Vi-LAB/KenT-1B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Vi-LAB/KenT-1B-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Vi-LAB/KenT-1B-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Vi-LAB/KenT-1B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Vi-LAB/KenT-1B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vi-LAB/KenT-1B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Vi-LAB/KenT-1B-Base
- SGLang
How to use Vi-LAB/KenT-1B-Base 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 "Vi-LAB/KenT-1B-Base" \ --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": "Vi-LAB/KenT-1B-Base", "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 "Vi-LAB/KenT-1B-Base" \ --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": "Vi-LAB/KenT-1B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Vi-LAB/KenT-1B-Base with Docker Model Runner:
docker model run hf.co/Vi-LAB/KenT-1B-Base
KenteaKe11 commited on
Commit ·
d8e30ac
1
Parent(s): ebfe05c
fix architecture
Browse files- README.md +3 -3
- config.json +3 -3
- model.py +5 -5
README.md
CHANGED
|
@@ -22,14 +22,14 @@ tags:
|
|
| 22 |
|
| 23 |
# KenT
|
| 24 |
|
| 25 |
-
KenT is a recurrent language model from the SSM family.
|
| 26 |
|
| 27 |
> This repo contains `trust_remote_code` code; weights are stored in **FP16**.
|
| 28 |
|
| 29 |
## Architectural Philosophy
|
| 30 |
|
| 31 |
-
- **
|
| 32 |
-
|
| 33 |
- **Invest in the transformation core.** Capacity is concentrated in the "hidden" part, where features are actually transformed,
|
| 34 |
rather than in the vocabulary table or in repeating the architecture. The width and depth of this core are scaled together to
|
| 35 |
stay balanced, rather than pushing a single dimension.
|
|
|
|
| 22 |
|
| 23 |
# KenT
|
| 24 |
|
| 25 |
+
KenT is a recurrent language model from the SSM family. KenT concentrates its capacity in compact cells built from a short chain of transformation blocks, and keeps temporal memory as simple as possible.
|
| 26 |
|
| 27 |
> This repo contains `trust_remote_code` code; weights are stored in **FP16**.
|
| 28 |
|
| 29 |
## Architectural Philosophy
|
| 30 |
|
| 31 |
+
- **A short chain of compact cells.** KenT stacks a few identical recurrent cells, each containing only two transformation blocks.
|
| 32 |
+
The cells are connected in sequence through the representation stream, and the last cell produces the final output.
|
| 33 |
- **Invest in the transformation core.** Capacity is concentrated in the "hidden" part, where features are actually transformed,
|
| 34 |
rather than in the vocabulary table or in repeating the architecture. The width and depth of this core are scaled together to
|
| 35 |
stay balanced, rather than pushing a single dimension.
|
config.json
CHANGED
|
@@ -10,10 +10,10 @@
|
|
| 10 |
},
|
| 11 |
"vocab_size": 50257,
|
| 12 |
"hidden_size": 512,
|
| 13 |
-
"num_hidden_layers":
|
| 14 |
-
"resolution_size":
|
| 15 |
"feature_dim": 512,
|
| 16 |
-
"num_wnn_blocks":
|
| 17 |
"intermediate_size": 2048,
|
| 18 |
"rms_norm_eps": 1e-05,
|
| 19 |
"use_bias": true,
|
|
|
|
| 10 |
},
|
| 11 |
"vocab_size": 50257,
|
| 12 |
"hidden_size": 512,
|
| 13 |
+
"num_hidden_layers": 5,
|
| 14 |
+
"resolution_size": 8,
|
| 15 |
"feature_dim": 512,
|
| 16 |
+
"num_wnn_blocks": 2,
|
| 17 |
"intermediate_size": 2048,
|
| 18 |
"rms_norm_eps": 1e-05,
|
| 19 |
"use_bias": true,
|
model.py
CHANGED
|
@@ -39,10 +39,10 @@ class KentConfig(PretrainedConfig):
|
|
| 39 |
Args:
|
| 40 |
vocab_size: kích thước từ vựng.
|
| 41 |
hidden_size: số chiều của representation stream X_t (d_x).
|
| 42 |
-
num_hidden_layers: số KenT
|
| 43 |
resolution_size: N, độ dài trục mà DCT-II tác động lên.
|
| 44 |
feature_dim: d_h, số chiều đặc trưng trên mỗi vị trí resolution.
|
| 45 |
-
num_wnn_blocks: L, số WNN Block nối tiếp trong
|
| 46 |
intermediate_size: kích thước hidden của SwiGLU (trên trục d_h).
|
| 47 |
rms_norm_eps: epsilon của RMSNorm.
|
| 48 |
use_bias: dùng bias trong Bilinear / SwiGLU.
|
|
@@ -57,10 +57,10 @@ class KentConfig(PretrainedConfig):
|
|
| 57 |
self,
|
| 58 |
vocab_size: int = 50257,
|
| 59 |
hidden_size: int = 512,
|
| 60 |
-
num_hidden_layers: int =
|
| 61 |
-
resolution_size: int =
|
| 62 |
feature_dim: int = 512,
|
| 63 |
-
num_wnn_blocks: int =
|
| 64 |
intermediate_size: int = 2048,
|
| 65 |
rms_norm_eps: float = 1e-5,
|
| 66 |
use_bias: bool = True,
|
|
|
|
| 39 |
Args:
|
| 40 |
vocab_size: kích thước từ vựng.
|
| 41 |
hidden_size: số chiều của representation stream X_t (d_x).
|
| 42 |
+
num_hidden_layers: số KenT cell nối liền nhau (cell cuối sinh đầu ra cuối).
|
| 43 |
resolution_size: N, độ dài trục mà DCT-II tác động lên.
|
| 44 |
feature_dim: d_h, số chiều đặc trưng trên mỗi vị trí resolution.
|
| 45 |
+
num_wnn_blocks: L, số WNN Block nối tiếp trong MỖI cell.
|
| 46 |
intermediate_size: kích thước hidden của SwiGLU (trên trục d_h).
|
| 47 |
rms_norm_eps: epsilon của RMSNorm.
|
| 48 |
use_bias: dùng bias trong Bilinear / SwiGLU.
|
|
|
|
| 57 |
self,
|
| 58 |
vocab_size: int = 50257,
|
| 59 |
hidden_size: int = 512,
|
| 60 |
+
num_hidden_layers: int = 5,
|
| 61 |
+
resolution_size: int = 8,
|
| 62 |
feature_dim: int = 512,
|
| 63 |
+
num_wnn_blocks: int = 2,
|
| 64 |
intermediate_size: int = 2048,
|
| 65 |
rms_norm_eps: float = 1e-5,
|
| 66 |
use_bias: bool = True,
|