Text Generation
Transformers
Safetensors
English
qwen2
nf4
asset-editor
stealth
prompt-enhancer
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use Veetance/Narrative-Brain-5B-NF4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Veetance/Narrative-Brain-5B-NF4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Veetance/Narrative-Brain-5B-NF4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Veetance/Narrative-Brain-5B-NF4") model = AutoModelForCausalLM.from_pretrained("Veetance/Narrative-Brain-5B-NF4", 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 Veetance/Narrative-Brain-5B-NF4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Veetance/Narrative-Brain-5B-NF4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Veetance/Narrative-Brain-5B-NF4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Veetance/Narrative-Brain-5B-NF4
- SGLang
How to use Veetance/Narrative-Brain-5B-NF4 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 "Veetance/Narrative-Brain-5B-NF4" \ --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": "Veetance/Narrative-Brain-5B-NF4", "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 "Veetance/Narrative-Brain-5B-NF4" \ --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": "Veetance/Narrative-Brain-5B-NF4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Veetance/Narrative-Brain-5B-NF4 with Docker Model Runner:
docker model run hf.co/Veetance/Narrative-Brain-5B-NF4
Download tokenizer_config.json from Veetance/Narrative-Brain-5B-NF4: direct link, hf CLI and curl.
- Browser
- Download file 20.3 kB
-
https://huggingface.co/Veetance/Narrative-Brain-5B-NF4/resolve/main/tokenizer_config.json
- Command line
-
hf download hf://Veetance/Narrative-Brain-5B-NF4/tokenizer_config.json
-
curl -L -o tokenizer_config.json https://huggingface.co/Veetance/Narrative-Brain-5B-NF4/resolve/main/tokenizer_config.json
20.3 kB
| { | |
| "add_bos_token": false, | |
| "add_prefix_space": false, | |
| "added_tokens_decoder": { | |
| "151643": { | |
| "content": "\u003c|endoftext|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151644": { | |
| "content": "\u003c|im_start|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151645": { | |
| "content": "\u003c|im_end|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151646": { | |
| "content": "\u003c|object_ref_start|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151647": { | |
| "content": "\u003c|object_ref_end|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151648": { | |
| "content": "\u003c|box_start|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151649": { | |
| "content": "\u003c|box_end|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151650": { | |
| "content": "\u003c|quad_start|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151651": { | |
| "content": "\u003c|quad_end|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151652": { | |
| "content": "\u003c|vision_start|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151653": { | |
| "content": "\u003c|vision_end|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151654": { | |
| "content": "\u003c|vision_pad|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151655": { | |
| "content": "\u003c|image_pad|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151656": { | |
| "content": "\u003c|video_pad|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "151657": { | |
| "content": "\u003ctool_call\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151658": { | |
| "content": "\u003c/tool_call\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151659": { | |
| "content": "\u003c|fim_prefix|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151660": { | |
| "content": "\u003c|fim_middle|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151661": { | |
| "content": "\u003c|fim_suffix|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151662": { | |
| "content": "\u003c|fim_pad|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151663": { | |
| "content": "\u003c|repo_name|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151664": { | |
| "content": "\u003c|file_sep|\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151665": { | |
| "content": "\u003ctool_response\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151666": { | |
| "content": "\u003c/tool_response\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151667": { | |
| "content": "\u003cthink\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "151668": { | |
| "content": "\u003c/think\u003e", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| } | |
| }, | |
| "additional_special_tokens": [ | |
| "\u003c|im_start|\u003e", | |
| "\u003c|im_end|\u003e", | |
| "\u003c|object_ref_start|\u003e", | |
| "\u003c|object_ref_end|\u003e", | |
| "\u003c|box_start|\u003e", | |
| "\u003c|box_end|\u003e", | |
| "\u003c|quad_start|\u003e", | |
| "\u003c|quad_end|\u003e", | |
| "\u003c|vision_start|\u003e", | |
| "\u003c|vision_end|\u003e", | |
| "\u003c|vision_pad|\u003e", | |
| "\u003c|image_pad|\u003e", | |
| "\u003c|video_pad|\u003e" | |
| ], | |
| "bos_token": null, | |
| "chat_template": "{%- if tools %}\n {{- \u0027\u003c|im_start|\u003esystem\\n\u0027 }}\n {%- if messages[0].role == \u0027system\u0027 %}\n {{- messages[0].content + \u0027\\n\\n\u0027 }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within \u003ctools\u003e\u003c/tools\u003e XML tags:\\n\u003ctools\u003e\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n\u003c/tools\u003e\\n\\nFor each function call, return a json object with function name and arguments within \u003ctool_call\u003e\u003c/tool_call\u003e XML tags:\\n\u003ctool_call\u003e\\n{\\\"name\\\": \u003cfunction-name\u003e, \\\"arguments\\\": \u003cargs-json-object\u003e}\\n\u003c/tool_call\u003e\u003c|im_end|\u003e\\n\" }}\n{%- else %}\n {%- if messages[0].role == \u0027system\u0027 %}\n {{- \u0027\u003c|im_start|\u003esystem\\n\u0027 + messages[0].content + \u0027\u003c|im_end|\u003e\\n\u0027 }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith(\u0027\u003ctool_response\u003e\u0027) and message.content.endswith(\u0027\u003c/tool_response\u003e\u0027)) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = \u0027\u0027 %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- \u0027\u003c|im_start|\u003e\u0027 + message.role + \u0027\\n\u0027 + content + \u0027\u003c|im_end|\u003e\u0027 + \u0027\\n\u0027 }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = \u0027\u0027 %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if \u0027\u003c/think\u003e\u0027 in content %}\n {%- set reasoning_content = content.split(\u0027\u003c/think\u003e\u0027)[0].rstrip(\u0027\\n\u0027).split(\u0027\u003cthink\u003e\u0027)[-1].lstrip(\u0027\\n\u0027) %}\n {%- set content = content.split(\u0027\u003c/think\u003e\u0027)[-1].lstrip(\u0027\\n\u0027) %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 \u003e ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- \u0027\u003c|im_start|\u003e\u0027 + message.role + \u0027\\n\u003cthink\u003e\\n\u0027 + reasoning_content.strip(\u0027\\n\u0027) + \u0027\\n\u003c/think\u003e\\n\\n\u0027 + content.lstrip(\u0027\\n\u0027) }}\n {%- else %}\n {{- \u0027\u003c|im_start|\u003e\u0027 + message.role + \u0027\\n\u0027 + content }}\n {%- endif %}\n {%- else %}\n {{- \u0027\u003c|im_start|\u003e\u0027 + message.role + \u0027\\n\u0027 + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- \u0027\\n\u0027 }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- \u0027\u003ctool_call\u003e\\n{\"name\": \"\u0027 }}\n {{- tool_call.name }}\n {{- \u0027\", \"arguments\": \u0027 }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- \u0027}\\n\u003c/tool_call\u003e\u0027 }}\n {%- endfor %}\n {%- endif %}\n {{- \u0027\u003c|im_end|\u003e\\n\u0027 }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- \u0027\u003c|im_start|\u003euser\u0027 }}\n {%- endif %}\n {{- \u0027\\n\u003ctool_response\u003e\\n\u0027 }}\n {{- content }}\n {{- \u0027\\n\u003c/tool_response\u003e\u0027 }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- \u0027\u003c|im_end|\u003e\\n\u0027 }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- \u0027\u003c|im_start|\u003eassistant\\n\u0027 }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- \u0027\u003cthink\u003e\\n\\n\u003c/think\u003e\\n\\n\u0027 }}\n {%- endif %}\n{%- endif %}", | |
| "clean_up_tokenization_spaces": false, | |
| "eos_token": "\u003c|im_end|\u003e", | |
| "errors": "replace", | |
| "model_max_length": 32768, | |
| "pad_token": "\u003c|endoftext|\u003e", | |
| "split_special_tokens": false, | |
| "tokenizer_class": "Qwen2Tokenizer", | |
| "unk_token": null, | |
| "is_local": true | |
| } | |