Text Generation
Transformers
Safetensors
ngen4ow_10t
experimental
custom-code
mixture-of-experts
ngen4ow-10t
custom_code
Instructions to use TNSA-LM-Storage/NGen-4OW-10T-Expiremental with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TNSA-LM-Storage/NGen-4OW-10T-Expiremental with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TNSA-LM-Storage/NGen-4OW-10T-Expiremental", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TNSA-LM-Storage/NGen-4OW-10T-Expiremental", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TNSA-LM-Storage/NGen-4OW-10T-Expiremental with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TNSA-LM-Storage/NGen-4OW-10T-Expiremental" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TNSA-LM-Storage/NGen-4OW-10T-Expiremental", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TNSA-LM-Storage/NGen-4OW-10T-Expiremental
- SGLang
How to use TNSA-LM-Storage/NGen-4OW-10T-Expiremental 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 "TNSA-LM-Storage/NGen-4OW-10T-Expiremental" \ --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": "TNSA-LM-Storage/NGen-4OW-10T-Expiremental", "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 "TNSA-LM-Storage/NGen-4OW-10T-Expiremental" \ --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": "TNSA-LM-Storage/NGen-4OW-10T-Expiremental", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TNSA-LM-Storage/NGen-4OW-10T-Expiremental with Docker Model Runner:
docker model run hf.co/TNSA-LM-Storage/NGen-4OW-10T-Expiremental
Upload configuration_ngen4ow_10t.py
Browse files- configuration_ngen4ow_10t.py +36 -0
configuration_ngen4ow_10t.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class NGen4OW10TConfig(PretrainedConfig):
|
| 5 |
+
model_type = "ngen4ow_10t"
|
| 6 |
+
|
| 7 |
+
def __init__(
|
| 8 |
+
self,
|
| 9 |
+
base_model_name_or_path="moonshotai/Kimi-K2.6",
|
| 10 |
+
base_config=None,
|
| 11 |
+
num_model_experts=10,
|
| 12 |
+
active_model_experts=1,
|
| 13 |
+
logical_total_params="10T",
|
| 14 |
+
active_params="32B",
|
| 15 |
+
route_strategy="hash",
|
| 16 |
+
default_expert=0,
|
| 17 |
+
expert_weight_prefix="experts",
|
| 18 |
+
**kwargs,
|
| 19 |
+
):
|
| 20 |
+
super().__init__(**kwargs)
|
| 21 |
+
self.base_model_name_or_path = base_model_name_or_path
|
| 22 |
+
self.base_config = base_config or {}
|
| 23 |
+
self.num_model_experts = num_model_experts
|
| 24 |
+
self.active_model_experts = active_model_experts
|
| 25 |
+
self.logical_total_params = logical_total_params
|
| 26 |
+
self.active_params = active_params
|
| 27 |
+
self.route_strategy = route_strategy
|
| 28 |
+
self.default_expert = default_expert
|
| 29 |
+
self.expert_weight_prefix = expert_weight_prefix
|
| 30 |
+
self.architectures = ["NGen4OW10TForCausalLM"]
|
| 31 |
+
self.auto_map = {
|
| 32 |
+
"AutoConfig": "configuration_ngen4ow_10t.NGen4OW10TConfig",
|
| 33 |
+
"AutoModel": "modeling_ngen4ow_10t.NGen4OW10TModel",
|
| 34 |
+
"AutoModelForCausalLM": "modeling_ngen4ow_10t.NGen4OW10TForCausalLM",
|
| 35 |
+
}
|
| 36 |
+
|