Text Generation
Transformers
Safetensors
Uzbek
English
Russian
neuron_lm
uzbek
o'zbek
chat
instruction-tuned
conversational
custom_code
Instructions to use NeuronUz/MustaqiLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NeuronUz/MustaqiLLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NeuronUz/MustaqiLLM", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("NeuronUz/MustaqiLLM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NeuronUz/MustaqiLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NeuronUz/MustaqiLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NeuronUz/MustaqiLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NeuronUz/MustaqiLLM
- SGLang
How to use NeuronUz/MustaqiLLM 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 "NeuronUz/MustaqiLLM" \ --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": "NeuronUz/MustaqiLLM", "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 "NeuronUz/MustaqiLLM" \ --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": "NeuronUz/MustaqiLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use NeuronUz/MustaqiLLM with Docker Model Runner:
docker model run hf.co/NeuronUz/MustaqiLLM
Generation settings: replace guessed defaults with swept, measured recommendations
Browse files
README.md
CHANGED
|
@@ -68,7 +68,8 @@ with torch.no_grad():
|
|
| 68 |
out = model.generate(
|
| 69 |
**inputs,
|
| 70 |
max_new_tokens=256,
|
| 71 |
-
do_sample=False, # greedy
|
|
|
|
| 72 |
eos_token_id=5, # <|im_end|> -- also the repo default
|
| 73 |
pad_token_id=3, # <pad>
|
| 74 |
)
|
|
@@ -93,16 +94,61 @@ The model uses ChatML. `tokenizer.apply_chat_template` applies it for you; the r
|
|
| 93 |
{assistant}<|im_end|>
|
| 94 |
```
|
| 95 |
|
| 96 |
-
A system turn is optional
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
### Generation settings
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
| setting | value | why |
|
| 102 |
|---|---|---|
|
| 103 |
-
| `
|
| 104 |
-
| `do_sample`
|
| 105 |
-
| `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
Memory: the checkpoint is 11.0 GB on disk (embeddings and `lm_head` are stored fp32); loading with
|
| 108 |
`dtype=torch.bfloat16` as above casts them down to ~10.3 GB of weights, so a single 16 GB GPU is
|
|
|
|
| 68 |
out = model.generate(
|
| 69 |
**inputs,
|
| 70 |
max_new_tokens=256,
|
| 71 |
+
do_sample=False, # greedy is fine for a short answer like this;
|
| 72 |
+
# for open chat use the sampling settings below
|
| 73 |
eos_token_id=5, # <|im_end|> -- also the repo default
|
| 74 |
pad_token_id=3, # <pad>
|
| 75 |
)
|
|
|
|
| 94 |
{assistant}<|im_end|>
|
| 95 |
```
|
| 96 |
|
| 97 |
+
A system turn is optional, and for general chat you should leave it out — a generic
|
| 98 |
+
system prompt measurably increases repetition (see Generation settings). Task-specific
|
| 99 |
+
system prompts, in Uzbek, work well.
|
| 100 |
|
| 101 |
### Generation settings
|
| 102 |
|
| 103 |
+
These are measured, not guessed: 24 Uzbek chat prompts across 11 categories, 2–3 seeds
|
| 104 |
+
per configuration, scored automatically for verbatim sentence repetition, failure to
|
| 105 |
+
emit `<|im_end|>` within the token budget, and script leakage.
|
| 106 |
+
|
| 107 |
+
**Recommended for open chat:**
|
| 108 |
+
|
| 109 |
+
```python
|
| 110 |
+
out = model.generate(
|
| 111 |
+
**inputs,
|
| 112 |
+
max_new_tokens=512,
|
| 113 |
+
do_sample=True,
|
| 114 |
+
temperature=0.7,
|
| 115 |
+
top_p=0.9,
|
| 116 |
+
repetition_penalty=1.10, # not optional -- see below
|
| 117 |
+
use_cache=True,
|
| 118 |
+
)
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
| setting | value | why |
|
| 122 |
|---|---|---|
|
| 123 |
+
| `repetition_penalty` | **1.05–1.10** for chat | The single most important setting. Without it the model restates whole sentences verbatim. Measured duplicate-sentence rate at temperature 0.7: **4.7% at `1.00`, 2.1% at `1.02`, 0.0% at `1.05` and above.** |
|
| 124 |
+
| `do_sample` / `temperature` / `top_p` | `True`, `0.7`, `0.9` for chat; `False` (greedy) for classification, extraction and short answers | `generation_config.json` ships `do_sample: true` with **no** `temperature` or `top_p`, so the unconfigured default is temperature 1.0 / top_p 1.0 — pass these explicitly. Terse tasks showed a 0% repetition rate under every configuration tested, so greedy is safe there. |
|
| 125 |
+
| `eos_token_id` | **5** (`<\|im_end\|>`) | The turn terminator, already the default in `config.json` / `generation_config.json` — you do not need to pass it. Do **not** override it with the pretraining EOS (`</s>`), which never appears in chat data: generation would then run to `max_new_tokens`. |
|
| 126 |
+
| system prompt | **omit it** for general chat | A generic system turn measurably degrades output. Duplicate-sentence rate over the same prompts: **0.0% with no system prompt, 1.9% with a generic Uzbek one, 5.2% with a generic English one** (at temperature 0.7, `repetition_penalty` 1.05); without a repetition penalty the same comparison is 11.2% / 23.7% / 14.9%. Task-specific system prompts (a required format, a persona) are fine — it is the generic "you are a helpful assistant" turn that hurts. |
|
| 127 |
+
| `dtype` | `torch.bfloat16` | Trained in bf16. `float16` is also safe — no overflow, and output quality is indistinguishable — so pre-Ampere GPUs are supported. `float32` doubles memory for **half** the throughput (205 vs 412 tok/s) and changes nothing. |
|
| 128 |
+
|
| 129 |
+
**Greedy decoding degrades as the output gets longer**, which is why it is recommended
|
| 130 |
+
above only for short outputs. On chat and long-form prompts with a 768-token budget:
|
| 131 |
+
|
| 132 |
+
| configuration | never emits `<\|im_end\|>` | duplicate sentences | worst case |
|
| 133 |
+
|---|---:|---:|---:|
|
| 134 |
+
| greedy | 23.1% | 27.3% | one sentence repeated **9.8×** |
|
| 135 |
+
| `t=0.7, top_p=0.9` | 15.4% | 8.0% | 2.2× |
|
| 136 |
+
| `t=0.7, top_p=0.9, rp=1.05` | 11.5% | 3.0% | 1.7× |
|
| 137 |
+
| **`t=0.7, top_p=0.9, rp=1.10`** | **0.0%** | **0.8%** | **1.1×** |
|
| 138 |
+
|
| 139 |
+
Lowering the temperature makes this worse, not better: temperature 0.3 was the worst
|
| 140 |
+
configuration measured (19.1% duplicate sentences), because sharpening the distribution
|
| 141 |
+
locks the model into the repeat loop. Determinism is genuinely in tension with quality
|
| 142 |
+
here: greedy plus `repetition_penalty=1.10` still leaves 7.9% duplicate sentences —
|
| 143 |
+
better than greedy alone, but far short of sampling. If you need reproducible output,
|
| 144 |
+
sample with a fixed seed rather than decoding greedily.
|
| 145 |
+
|
| 146 |
+
Uzbek Cyrillic prompting is the weakest case — the highest truncation and repetition
|
| 147 |
+
rates of any category — so raise `max_new_tokens` and keep the repetition penalty on.
|
| 148 |
+
|
| 149 |
+
Batch size changes greedy output: identical prompts decoded at batch 1 and batch 12
|
| 150 |
+
matched in only 24 of 32 cases, because left-padding shifts the numerics. Fix the batch
|
| 151 |
+
size when comparing runs.
|
| 152 |
|
| 153 |
Memory: the checkpoint is 11.0 GB on disk (embeddings and `lm_head` are stored fp32); loading with
|
| 154 |
`dtype=torch.bfloat16` as above casts them down to ~10.3 GB of weights, so a single 16 GB GPU is
|