Instructions to use Nared45/part4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nared45/part4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nared45/part4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nared45/part4") model = AutoModelForCausalLM.from_pretrained("Nared45/part4") 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
- vLLM
How to use Nared45/part4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nared45/part4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nared45/part4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nared45/part4
- SGLang
How to use Nared45/part4 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 "Nared45/part4" \ --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": "Nared45/part4", "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 "Nared45/part4" \ --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": "Nared45/part4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nared45/part4 with Docker Model Runner:
docker model run hf.co/Nared45/part4
Upload tokenizer
Browse files- special_tokens_map.json +3 -3
- tokenizer.json +3 -12
- tokenizer_config.json +5 -11
special_tokens_map.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
"bos_token": {
|
| 3 |
"content": "<s>",
|
| 4 |
"lstrip": false,
|
| 5 |
-
"normalized":
|
| 6 |
"rstrip": false,
|
| 7 |
"single_word": false
|
| 8 |
},
|
| 9 |
"eos_token": {
|
| 10 |
"content": "</s>",
|
| 11 |
"lstrip": false,
|
| 12 |
-
"normalized":
|
| 13 |
"rstrip": false,
|
| 14 |
"single_word": false
|
| 15 |
},
|
|
@@ -17,7 +17,7 @@
|
|
| 17 |
"unk_token": {
|
| 18 |
"content": "<unk>",
|
| 19 |
"lstrip": false,
|
| 20 |
-
"normalized":
|
| 21 |
"rstrip": false,
|
| 22 |
"single_word": false
|
| 23 |
}
|
|
|
|
| 2 |
"bos_token": {
|
| 3 |
"content": "<s>",
|
| 4 |
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
"rstrip": false,
|
| 7 |
"single_word": false
|
| 8 |
},
|
| 9 |
"eos_token": {
|
| 10 |
"content": "</s>",
|
| 11 |
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
"rstrip": false,
|
| 14 |
"single_word": false
|
| 15 |
},
|
|
|
|
| 17 |
"unk_token": {
|
| 18 |
"content": "<unk>",
|
| 19 |
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
"rstrip": false,
|
| 22 |
"single_word": false
|
| 23 |
}
|
tokenizer.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
"single_word": false,
|
| 10 |
"lstrip": false,
|
| 11 |
"rstrip": false,
|
| 12 |
-
"normalized":
|
| 13 |
"special": true
|
| 14 |
},
|
| 15 |
{
|
|
@@ -18,7 +18,7 @@
|
|
| 18 |
"single_word": false,
|
| 19 |
"lstrip": false,
|
| 20 |
"rstrip": false,
|
| 21 |
-
"normalized":
|
| 22 |
"special": true
|
| 23 |
},
|
| 24 |
{
|
|
@@ -27,20 +27,11 @@
|
|
| 27 |
"single_word": false,
|
| 28 |
"lstrip": false,
|
| 29 |
"rstrip": false,
|
| 30 |
-
"normalized":
|
| 31 |
"special": true
|
| 32 |
},
|
| 33 |
{
|
| 34 |
"id": 32000,
|
| 35 |
-
"content": "<pad>",
|
| 36 |
-
"single_word": false,
|
| 37 |
-
"lstrip": false,
|
| 38 |
-
"rstrip": false,
|
| 39 |
-
"normalized": true,
|
| 40 |
-
"special": false
|
| 41 |
-
},
|
| 42 |
-
{
|
| 43 |
-
"id": 32001,
|
| 44 |
"content": "[PAD]",
|
| 45 |
"single_word": false,
|
| 46 |
"lstrip": false,
|
|
|
|
| 9 |
"single_word": false,
|
| 10 |
"lstrip": false,
|
| 11 |
"rstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
"special": true
|
| 14 |
},
|
| 15 |
{
|
|
|
|
| 18 |
"single_word": false,
|
| 19 |
"lstrip": false,
|
| 20 |
"rstrip": false,
|
| 21 |
+
"normalized": false,
|
| 22 |
"special": true
|
| 23 |
},
|
| 24 |
{
|
|
|
|
| 27 |
"single_word": false,
|
| 28 |
"lstrip": false,
|
| 29 |
"rstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
"special": true
|
| 32 |
},
|
| 33 |
{
|
| 34 |
"id": 32000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
"content": "[PAD]",
|
| 36 |
"single_word": false,
|
| 37 |
"lstrip": false,
|
tokenizer_config.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
"0": {
|
| 7 |
"content": "<unk>",
|
| 8 |
"lstrip": false,
|
| 9 |
-
"normalized":
|
| 10 |
"rstrip": false,
|
| 11 |
"single_word": false,
|
| 12 |
"special": true
|
|
@@ -14,7 +14,7 @@
|
|
| 14 |
"1": {
|
| 15 |
"content": "<s>",
|
| 16 |
"lstrip": false,
|
| 17 |
-
"normalized":
|
| 18 |
"rstrip": false,
|
| 19 |
"single_word": false,
|
| 20 |
"special": true
|
|
@@ -22,20 +22,12 @@
|
|
| 22 |
"2": {
|
| 23 |
"content": "</s>",
|
| 24 |
"lstrip": false,
|
| 25 |
-
"normalized":
|
| 26 |
"rstrip": false,
|
| 27 |
"single_word": false,
|
| 28 |
"special": true
|
| 29 |
},
|
| 30 |
"32000": {
|
| 31 |
-
"content": "<pad>",
|
| 32 |
-
"lstrip": false,
|
| 33 |
-
"normalized": true,
|
| 34 |
-
"rstrip": false,
|
| 35 |
-
"single_word": false,
|
| 36 |
-
"special": false
|
| 37 |
-
},
|
| 38 |
-
"32001": {
|
| 39 |
"content": "[PAD]",
|
| 40 |
"lstrip": false,
|
| 41 |
"normalized": false,
|
|
@@ -45,11 +37,13 @@
|
|
| 45 |
}
|
| 46 |
},
|
| 47 |
"bos_token": "<s>",
|
|
|
|
| 48 |
"clean_up_tokenization_spaces": false,
|
| 49 |
"eos_token": "</s>",
|
| 50 |
"legacy": false,
|
| 51 |
"model_max_length": 1000000000000000019884624838656,
|
| 52 |
"pad_token": "</s>",
|
|
|
|
| 53 |
"sp_model_kwargs": {},
|
| 54 |
"tokenizer_class": "LlamaTokenizer",
|
| 55 |
"unk_token": "<unk>",
|
|
|
|
| 6 |
"0": {
|
| 7 |
"content": "<unk>",
|
| 8 |
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
"rstrip": false,
|
| 11 |
"single_word": false,
|
| 12 |
"special": true
|
|
|
|
| 14 |
"1": {
|
| 15 |
"content": "<s>",
|
| 16 |
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
"rstrip": false,
|
| 19 |
"single_word": false,
|
| 20 |
"special": true
|
|
|
|
| 22 |
"2": {
|
| 23 |
"content": "</s>",
|
| 24 |
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
"rstrip": false,
|
| 27 |
"single_word": false,
|
| 28 |
"special": true
|
| 29 |
},
|
| 30 |
"32000": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"content": "[PAD]",
|
| 32 |
"lstrip": false,
|
| 33 |
"normalized": false,
|
|
|
|
| 37 |
}
|
| 38 |
},
|
| 39 |
"bos_token": "<s>",
|
| 40 |
+
"chat_template": "{% 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 %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\\n' + system_message + '\\n<</SYS>>\\n\\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}",
|
| 41 |
"clean_up_tokenization_spaces": false,
|
| 42 |
"eos_token": "</s>",
|
| 43 |
"legacy": false,
|
| 44 |
"model_max_length": 1000000000000000019884624838656,
|
| 45 |
"pad_token": "</s>",
|
| 46 |
+
"padding_side": "right",
|
| 47 |
"sp_model_kwargs": {},
|
| 48 |
"tokenizer_class": "LlamaTokenizer",
|
| 49 |
"unk_token": "<unk>",
|