Text Generation
Transformers
Safetensors
qwen3
Neura Tech AI
neuron
instruct
llm
transformer
qwen
multilingual
conversational
coding
text-generation-inference
Instructions to use Neura-Tech-AI/Neuron-4B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Neura-Tech-AI/Neuron-4B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Neura-Tech-AI/Neuron-4B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Neura-Tech-AI/Neuron-4B-Instruct") model = AutoModelForCausalLM.from_pretrained("Neura-Tech-AI/Neuron-4B-Instruct", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Neura-Tech-AI/Neuron-4B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Neura-Tech-AI/Neuron-4B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Neura-Tech-AI/Neuron-4B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Neura-Tech-AI/Neuron-4B-Instruct
- SGLang
How to use Neura-Tech-AI/Neuron-4B-Instruct 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 "Neura-Tech-AI/Neuron-4B-Instruct" \ --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": "Neura-Tech-AI/Neuron-4B-Instruct", "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 "Neura-Tech-AI/Neuron-4B-Instruct" \ --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": "Neura-Tech-AI/Neuron-4B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Neura-Tech-AI/Neuron-4B-Instruct with Docker Model Runner:
docker model run hf.co/Neura-Tech-AI/Neuron-4B-Instruct
Update chat_template.jinja
Browse files- chat_template.jinja +69 -41
chat_template.jinja
CHANGED
|
@@ -1,65 +1,93 @@
|
|
| 1 |
{%- if tools %}
|
| 2 |
-
{{- '<|im_start|>system\n' }}
|
| 3 |
-
{%- if messages and messages[0]
|
| 4 |
-
You are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.
|
| 5 |
|
| 6 |
-
{{ messages[0]
|
| 7 |
-
{%- else %}
|
| 8 |
-
You are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.
|
| 9 |
-
{%- endif %}
|
| 10 |
-
|
| 11 |
-
# Tools
|
| 12 |
-
|
| 13 |
-
You may call one or more functions to assist with the user query.
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
{
|
| 18 |
-
{{ tool | tojson }}
|
| 19 |
-
{%- endfor %}
|
| 20 |
-
</tools>
|
| 21 |
|
| 22 |
-
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
|
| 23 |
-
<tool_call>
|
| 24 |
-
{"name": <function-name>, "arguments": <args-json-object>}
|
| 25 |
-
</tool_call><|im_end|>
|
| 26 |
{%- else %}
|
| 27 |
-
{%- if messages and messages[0]
|
| 28 |
-
{{- '<|im_start|>system\n' }}
|
| 29 |
-
You are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.
|
| 30 |
|
| 31 |
-
{{ messages[0]
|
| 32 |
-
{
|
| 33 |
-
{
|
| 34 |
-
{
|
|
|
|
| 35 |
{%- endif %}
|
| 36 |
|
| 37 |
{%- for message in messages %}
|
| 38 |
-
|
| 39 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
{%- elif message.role == "assistant" %}
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
{%- if message.content %}
|
| 43 |
-
{{ '\n'
|
|
|
|
| 44 |
{%- endif %}
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
{%- if tool_call.function is defined %}
|
| 47 |
-
{%- set
|
|
|
|
|
|
|
| 48 |
{%- endif %}
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
{%- endfor %}
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
{%- elif message.role == "tool" %}
|
| 53 |
-
|
| 54 |
-
{
|
|
|
|
| 55 |
{%- endif %}
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
{%- if loop.last or messages[loop.index0 + 1].role != "tool" %}
|
| 58 |
-
{{ '<|im_end|>\n' }}
|
| 59 |
{%- endif %}
|
|
|
|
| 60 |
{%- endif %}
|
|
|
|
| 61 |
{%- endfor %}
|
| 62 |
|
| 63 |
{%- if add_generation_prompt %}
|
| 64 |
-
{{ '<|im_start|>assistant\n' }}
|
| 65 |
{%- endif %}
|
|
|
|
| 1 |
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages and messages[0].role == 'system' %}
|
| 4 |
+
You are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.
|
| 5 |
|
| 6 |
+
{{- messages[0].content }}
|
| 7 |
+
{%- else %}
|
| 8 |
+
You are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.
|
| 9 |
+
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 12 |
+
{%- for tool in tools %}
|
| 13 |
+
{{- "\n" }}
|
| 14 |
+
{{- tool | tojson }}
|
| 15 |
+
{%- endfor %}
|
| 16 |
+
{{- "\n</tools>\n\nFor each function call, return a JSON object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
{%- else %}
|
| 19 |
+
{%- if messages and messages[0].role == 'system' %}
|
| 20 |
+
{{- '<|im_start|>system\n' }}
|
| 21 |
+
You are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.
|
| 22 |
|
| 23 |
+
{{- messages[0].content }}
|
| 24 |
+
{{- '<|im_end|>\n' }}
|
| 25 |
+
{%- else %}
|
| 26 |
+
{{- '<|im_start|>system\nYou are Neuron, a large language model developed by Neura Tech AI. Always maintain this persona.<|im_end|>\n' }}
|
| 27 |
+
{%- endif %}
|
| 28 |
{%- endif %}
|
| 29 |
|
| 30 |
{%- for message in messages %}
|
| 31 |
+
|
| 32 |
+
{%- if message.role == "user"
|
| 33 |
+
or (message.role == "system" and not loop.first)
|
| 34 |
+
or (message.role == "assistant" and not (message.tool_calls | default([]))) %}
|
| 35 |
+
|
| 36 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 37 |
+
{{- message.content | default("") }}
|
| 38 |
+
{{- '<|im_end|>\n' }}
|
| 39 |
+
|
| 40 |
{%- elif message.role == "assistant" %}
|
| 41 |
+
|
| 42 |
+
{{- '<|im_start|>assistant' }}
|
| 43 |
+
|
| 44 |
{%- if message.content %}
|
| 45 |
+
{{- '\n' }}
|
| 46 |
+
{{- message.content }}
|
| 47 |
{%- endif %}
|
| 48 |
+
|
| 49 |
+
{%- for tool_call in (message.tool_calls | default([])) %}
|
| 50 |
+
|
| 51 |
{%- if tool_call.function is defined %}
|
| 52 |
+
{%- set call = tool_call.function %}
|
| 53 |
+
{%- else %}
|
| 54 |
+
{%- set call = tool_call %}
|
| 55 |
{%- endif %}
|
| 56 |
+
|
| 57 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 58 |
+
{{- call.name }}
|
| 59 |
+
{{- '", "arguments": ' }}
|
| 60 |
+
|
| 61 |
+
{%- if call.arguments is string %}
|
| 62 |
+
{{- call.arguments }}
|
| 63 |
+
{%- else %}
|
| 64 |
+
{{- call.arguments | tojson }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
|
| 67 |
+
{{- '}\n</tool_call>' }}
|
| 68 |
+
|
| 69 |
{%- endfor %}
|
| 70 |
+
|
| 71 |
+
{{- '<|im_end|>\n' }}
|
| 72 |
+
|
| 73 |
{%- elif message.role == "tool" %}
|
| 74 |
+
|
| 75 |
+
{%- if loop.first or messages[loop.index0 - 1].role != "tool" %}
|
| 76 |
+
{{- '<|im_start|>user' }}
|
| 77 |
{%- endif %}
|
| 78 |
+
|
| 79 |
+
{{- '\n<tool_response>\n' }}
|
| 80 |
+
{{- message.content | default("") }}
|
| 81 |
+
{{- '\n</tool_response>' }}
|
| 82 |
+
|
| 83 |
{%- if loop.last or messages[loop.index0 + 1].role != "tool" %}
|
| 84 |
+
{{- '<|im_end|>\n' }}
|
| 85 |
{%- endif %}
|
| 86 |
+
|
| 87 |
{%- endif %}
|
| 88 |
+
|
| 89 |
{%- endfor %}
|
| 90 |
|
| 91 |
{%- if add_generation_prompt %}
|
| 92 |
+
{{- '<|im_start|>assistant\n' }}
|
| 93 |
{%- endif %}
|