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
File size: 2,260 Bytes
80c3430 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | from __future__ import annotations
import torch
import torch.nn.functional as F
from torch import Tensor, nn
__all__ = [
"RMSNorm",
"SwiGLU",
]
class RMSNorm(nn.RMSNorm):
def __init__(
self,
hidden_size: int,
eps: float = 1e-5,
*,
device: torch.device | str | None = None,
dtype: torch.dtype | None = None,
) -> None:
if hidden_size <= 0:
raise ValueError(f"hidden_size must be positive, got {hidden_size}")
if eps <= 0.0:
raise ValueError(f"eps must be positive, got {eps}")
super().__init__(
normalized_shape=hidden_size,
eps=eps,
elementwise_affine=True,
device=device,
dtype=dtype,
)
self.hidden_size = hidden_size
class SwiGLU(nn.Module):
def __init__(
self,
hidden_size: int,
intermediate_size: int,
*,
device: torch.device | str | None = None,
dtype: torch.dtype | None = None,
) -> None:
super().__init__()
if hidden_size <= 0:
raise ValueError(f"hidden_size must be positive, got {hidden_size}")
if intermediate_size <= 0:
raise ValueError(
f"intermediate_size must be positive, got {intermediate_size}"
)
self.hidden_size = hidden_size
self.intermediate_size = intermediate_size
self.gate_up_proj = nn.Linear(
in_features=hidden_size,
out_features=2 * intermediate_size,
bias=False,
device=device,
dtype=dtype,
)
self.down_proj = nn.Linear(
in_features=intermediate_size,
out_features=hidden_size,
bias=False,
device=device,
dtype=dtype,
)
def forward(self, hidden_states: Tensor) -> Tensor:
gate, up = self.gate_up_proj(hidden_states).chunk(2, dim=-1)
hidden_states = F.silu(gate) * up
return self.down_proj(hidden_states)
def extra_repr(self) -> str:
return (
f"hidden_size={self.hidden_size}, "
f"intermediate_size={self.intermediate_size}, "
"bias=False"
)
|