Text Generation
Transformers
Safetensors
Hindi
English
qwen3
indic
small-language-model
tool-calling
function-calling
banking
conversational
text-generation-inference
Instructions to use somasekhar-dev/NextToken-model-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use somasekhar-dev/NextToken-model-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="somasekhar-dev/NextToken-model-2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("somasekhar-dev/NextToken-model-2") model = AutoModelForCausalLM.from_pretrained("somasekhar-dev/NextToken-model-2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use somasekhar-dev/NextToken-model-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "somasekhar-dev/NextToken-model-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "somasekhar-dev/NextToken-model-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/somasekhar-dev/NextToken-model-2
- SGLang
How to use somasekhar-dev/NextToken-model-2 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 "somasekhar-dev/NextToken-model-2" \ --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": "somasekhar-dev/NextToken-model-2", "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 "somasekhar-dev/NextToken-model-2" \ --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": "somasekhar-dev/NextToken-model-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use somasekhar-dev/NextToken-model-2 with Docker Model Runner:
docker model run hf.co/somasekhar-dev/NextToken-model-2
Upload folder using huggingface_hub
Browse files- chat_template.jinja +22 -0
- config.json +52 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +16 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}
|
| 2 |
+
{% for message in loop_messages %}
|
| 3 |
+
{% if message['role'] not in ['user', 'assistant', 'tool_calls'] %}
|
| 4 |
+
{{ raise_exception('Invalid role: ' + message['role'] + '. Must be user, assistant, or tool_calls.') }}
|
| 5 |
+
{% endif %}
|
| 6 |
+
{% if loop.index0 == 0 and system_message != false %}
|
| 7 |
+
{% set content = '<<SYS>>
|
| 8 |
+
' + system_message + '
|
| 9 |
+
<</SYS>>
|
| 10 |
+
|
| 11 |
+
' + message['content'] %}
|
| 12 |
+
{% else %}
|
| 13 |
+
{% set content = message['content'] %}
|
| 14 |
+
{% endif %}
|
| 15 |
+
{% if message['role'] == 'user' %}
|
| 16 |
+
{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}
|
| 17 |
+
{% elif message['role'] == 'assistant' %}
|
| 18 |
+
{{ ' ' + content.strip() + ' ' + eos_token }}
|
| 19 |
+
{% elif message['role'] == 'tool_calls' %}
|
| 20 |
+
{{ ' [TOOL_CALLS] ' + content.strip() + ' [/TOOL_CALLS] ' }}
|
| 21 |
+
{% endif %}
|
| 22 |
+
{% endfor %}
|
config.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": null,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 1024,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 3277,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention"
|
| 32 |
+
],
|
| 33 |
+
"max_position_embeddings": 2048,
|
| 34 |
+
"max_window_layers": 28,
|
| 35 |
+
"mlp_bias": false,
|
| 36 |
+
"model_type": "qwen3",
|
| 37 |
+
"num_attention_heads": 16,
|
| 38 |
+
"num_hidden_layers": 16,
|
| 39 |
+
"num_key_value_heads": 4,
|
| 40 |
+
"pad_token_id": null,
|
| 41 |
+
"rms_norm_eps": 1e-05,
|
| 42 |
+
"rope_parameters": {
|
| 43 |
+
"rope_theta": 10000.0,
|
| 44 |
+
"rope_type": "default"
|
| 45 |
+
},
|
| 46 |
+
"sliding_window": null,
|
| 47 |
+
"tie_word_embeddings": true,
|
| 48 |
+
"transformers_version": "5.16.1",
|
| 49 |
+
"use_cache": true,
|
| 50 |
+
"use_sliding_window": false,
|
| 51 |
+
"vocab_size": 68096
|
| 52 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"eos_token_id": 2,
|
| 4 |
+
"output_attentions": false,
|
| 5 |
+
"output_hidden_states": false,
|
| 6 |
+
"pad_token_id": 2,
|
| 7 |
+
"transformers_version": "5.16.1",
|
| 8 |
+
"use_cache": true
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a4a3dd177a032821882cabca340c2c174e102e442f0ac29605105b9103f76a9
|
| 3 |
+
size 1091141072
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 10 |
+
"pad_token": "</s>",
|
| 11 |
+
"sp_model_kwargs": {},
|
| 12 |
+
"spaces_between_special_tokens": false,
|
| 13 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 14 |
+
"unk_token": "<unk>",
|
| 15 |
+
"use_default_system_prompt": false
|
| 16 |
+
}
|