Instructions to use OwOOwO/g5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OwOOwO/g5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OwOOwO/g5") 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("OwOOwO/g5") model = AutoModelForCausalLM.from_pretrained("OwOOwO/g5", 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 OwOOwO/g5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OwOOwO/g5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OwOOwO/g5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OwOOwO/g5
- SGLang
How to use OwOOwO/g5 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 "OwOOwO/g5" \ --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": "OwOOwO/g5", "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 "OwOOwO/g5" \ --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": "OwOOwO/g5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OwOOwO/g5 with Docker Model Runner:
docker model run hf.co/OwOOwO/g5
Upload tokenizer
Browse files- special_tokens_map.json +3 -3
- tokenizer.json +2 -2
- tokenizer_config.json +7 -19
special_tokens_map.json
CHANGED
|
@@ -4,21 +4,21 @@
|
|
| 4 |
"<end_of_turn>"
|
| 5 |
],
|
| 6 |
"bos_token": {
|
| 7 |
-
"content": "<
|
| 8 |
"lstrip": false,
|
| 9 |
"normalized": false,
|
| 10 |
"rstrip": false,
|
| 11 |
"single_word": false
|
| 12 |
},
|
| 13 |
"eos_token": {
|
| 14 |
-
"content": "<
|
| 15 |
"lstrip": false,
|
| 16 |
"normalized": false,
|
| 17 |
"rstrip": false,
|
| 18 |
"single_word": false
|
| 19 |
},
|
| 20 |
"pad_token": {
|
| 21 |
-
"content": "<
|
| 22 |
"lstrip": false,
|
| 23 |
"normalized": false,
|
| 24 |
"rstrip": false,
|
|
|
|
| 4 |
"<end_of_turn>"
|
| 5 |
],
|
| 6 |
"bos_token": {
|
| 7 |
+
"content": "<bos>",
|
| 8 |
"lstrip": false,
|
| 9 |
"normalized": false,
|
| 10 |
"rstrip": false,
|
| 11 |
"single_word": false
|
| 12 |
},
|
| 13 |
"eos_token": {
|
| 14 |
+
"content": "<eos>",
|
| 15 |
"lstrip": false,
|
| 16 |
"normalized": false,
|
| 17 |
"rstrip": false,
|
| 18 |
"single_word": false
|
| 19 |
},
|
| 20 |
"pad_token": {
|
| 21 |
+
"content": "<eos>",
|
| 22 |
"lstrip": false,
|
| 23 |
"normalized": false,
|
| 24 |
"rstrip": false,
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:05e97791a5e007260de1db7e1692e53150e08cea481e2bf25435553380c147ee
|
| 3 |
+
size 17477929
|
tokenizer_config.json
CHANGED
|
@@ -49,38 +49,26 @@
|
|
| 49 |
"rstrip": false,
|
| 50 |
"single_word": false,
|
| 51 |
"special": true
|
| 52 |
-
},
|
| 53 |
-
"204": {
|
| 54 |
-
"content": "<s>",
|
| 55 |
-
"lstrip": false,
|
| 56 |
-
"normalized": false,
|
| 57 |
-
"rstrip": false,
|
| 58 |
-
"single_word": false,
|
| 59 |
-
"special": true
|
| 60 |
-
},
|
| 61 |
-
"213": {
|
| 62 |
-
"content": "</s>",
|
| 63 |
-
"lstrip": false,
|
| 64 |
-
"normalized": false,
|
| 65 |
-
"rstrip": false,
|
| 66 |
-
"single_word": false,
|
| 67 |
-
"special": true
|
| 68 |
}
|
| 69 |
},
|
| 70 |
"additional_special_tokens": [
|
| 71 |
"<start_of_turn>",
|
| 72 |
"<end_of_turn>"
|
| 73 |
],
|
| 74 |
-
"bos_token": "<
|
| 75 |
"chat_template": "{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '\n' + message['content'] | trim + '<end_of_turn>\n' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model\n'}}{% endif %}",
|
| 76 |
"clean_up_tokenization_spaces": false,
|
| 77 |
-
"eos_token": "<
|
| 78 |
"legacy": null,
|
|
|
|
| 79 |
"model_max_length": 1000000000000000019884624838656,
|
| 80 |
-
"pad_token": "<
|
| 81 |
"sp_model_kwargs": {},
|
| 82 |
"spaces_between_special_tokens": false,
|
|
|
|
| 83 |
"tokenizer_class": "GemmaTokenizer",
|
|
|
|
|
|
|
| 84 |
"unk_token": "<unk>",
|
| 85 |
"use_default_system_prompt": false
|
| 86 |
}
|
|
|
|
| 49 |
"rstrip": false,
|
| 50 |
"single_word": false,
|
| 51 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
}
|
| 53 |
},
|
| 54 |
"additional_special_tokens": [
|
| 55 |
"<start_of_turn>",
|
| 56 |
"<end_of_turn>"
|
| 57 |
],
|
| 58 |
+
"bos_token": "<bos>",
|
| 59 |
"chat_template": "{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '\n' + message['content'] | trim + '<end_of_turn>\n' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model\n'}}{% endif %}",
|
| 60 |
"clean_up_tokenization_spaces": false,
|
| 61 |
+
"eos_token": "<eos>",
|
| 62 |
"legacy": null,
|
| 63 |
+
"max_length": 2048,
|
| 64 |
"model_max_length": 1000000000000000019884624838656,
|
| 65 |
+
"pad_token": "<eos>",
|
| 66 |
"sp_model_kwargs": {},
|
| 67 |
"spaces_between_special_tokens": false,
|
| 68 |
+
"stride": 0,
|
| 69 |
"tokenizer_class": "GemmaTokenizer",
|
| 70 |
+
"truncation_side": "right",
|
| 71 |
+
"truncation_strategy": "longest_first",
|
| 72 |
"unk_token": "<unk>",
|
| 73 |
"use_default_system_prompt": false
|
| 74 |
}
|