Text Generation
Transformers
Safetensors
Korean
English
keural
Mixture of Experts
korean
bilingual
causal-lm
dpo
instruction-tuned
chat
preference-optimized
conversational
custom_code
Instructions to use mkd-dev/Keural-MoE-14B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mkd-dev/Keural-MoE-14B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mkd-dev/Keural-MoE-14B", 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("mkd-dev/Keural-MoE-14B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mkd-dev/Keural-MoE-14B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mkd-dev/Keural-MoE-14B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mkd-dev/Keural-MoE-14B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mkd-dev/Keural-MoE-14B
- SGLang
How to use mkd-dev/Keural-MoE-14B 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 "mkd-dev/Keural-MoE-14B" \ --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": "mkd-dev/Keural-MoE-14B", "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 "mkd-dev/Keural-MoE-14B" \ --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": "mkd-dev/Keural-MoE-14B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mkd-dev/Keural-MoE-14B with Docker Model Runner:
docker model run hf.co/mkd-dev/Keural-MoE-14B
Download modeling_keural.py from mkd-dev/Keural-MoE-14B: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/mkd-dev/Keural-MoE-14B/resolve/main/modeling_keural.py
- Command line
-
hf download hf://mkd-dev/Keural-MoE-14B/modeling_keural.py
-
curl -L -o modeling_keural.py https://huggingface.co/mkd-dev/Keural-MoE-14B/resolve/main/modeling_keural.py
1.33 kB
| """ | |
| KeuralMoECausalLM — Keural Mixture-of-Experts Causal Language Model. | |
| Bilingual Korean-English MoE LLM trained entirely from scratch. | |
| Developed by MKD Corp AI Research, Republic of Korea. | |
| Architecture: | |
| - 14.83B total parameters (~7.42B active per token) | |
| - 24 layers, hidden=4096, GQA 32/8 heads | |
| - 8 experts per layer, top-2 routing | |
| - Sliding window attention (512, alternating layers) | |
| - RoPE theta=500,000, context length=4096 | |
| - Vocabulary: 131,074 tokens (131,072 SPM + <|im_start|> + <|im_end|>) | |
| Load with trust_remote_code=True: | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained( | |
| "mkd-hossain/keural-sft3-final", | |
| torch_dtype="bfloat16", | |
| device_map="auto", | |
| trust_remote_code=True, | |
| ) | |
| """ | |
| from transformers import MixtralForCausalLM | |
| from transformers.utils import logging | |
| try: | |
| from configuration_keural import KeuralConfig | |
| except ImportError: | |
| from .configuration_keural import KeuralConfig | |
| logger = logging.get_logger(__name__) | |
| class KeuralMoECausalLM(MixtralForCausalLM): | |
| """ | |
| Keural MoE Causal Language Model. | |
| Bilingual Korean-English 14.83B MoE LLM trained from scratch by MKD Corp AI Research. | |
| """ | |
| config_class = KeuralConfig | |
| _keys_to_ignore_on_load_missing = ["lm_head.weight"] | |