Text Generation
Transformers
Safetensors
gemma2
mergekit
Merge
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use djuna/G2-GSHT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use djuna/G2-GSHT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="djuna/G2-GSHT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("djuna/G2-GSHT") model = AutoModelForCausalLM.from_pretrained("djuna/G2-GSHT") 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 djuna/G2-GSHT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "djuna/G2-GSHT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "djuna/G2-GSHT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/djuna/G2-GSHT
- SGLang
How to use djuna/G2-GSHT 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 "djuna/G2-GSHT" \ --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": "djuna/G2-GSHT", "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 "djuna/G2-GSHT" \ --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": "djuna/G2-GSHT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use djuna/G2-GSHT with Docker Model Runner:
docker model run hf.co/djuna/G2-GSHT
Allow system prompt
Browse files- tokenizer_config.json +2 -2
tokenizer_config.json
CHANGED
|
@@ -1744,10 +1744,10 @@
|
|
| 1744 |
"<end_of_turn>"
|
| 1745 |
],
|
| 1746 |
"bos_token": "<bos>",
|
| 1747 |
-
"chat_template": "{{ bos_token }}{%
|
| 1748 |
"clean_up_tokenization_spaces": false,
|
| 1749 |
"eos_token": "<eos>",
|
| 1750 |
-
"model_max_length":
|
| 1751 |
"pad_token": "<pad>",
|
| 1752 |
"sp_model_kwargs": {},
|
| 1753 |
"spaces_between_special_tokens": false,
|
|
|
|
| 1744 |
"<end_of_turn>"
|
| 1745 |
],
|
| 1746 |
"bos_token": "<bos>",
|
| 1747 |
+
"chat_template": "{{ bos_token }}{% for message in messages %}{% set system_adjust = 0 if loop.index0 == 0 and message['role'] != 'system' else 0 %}{% if loop.index0 == 0 and message['role'] == 'system' %}{{ '<start_of_turn>user\n'+message['content'] | trim +'\n'}}{% if messages | length > 1 and messages[1]['role'] == 'user' %}{{ messages[1]['content'] | trim }}{% elif messages | length > 1 %}{{ raise_exception('Error: Expected user role after system role.') }}{% endif %}{{ '<end_of_turn>\n' }}{% elif loop.index0 == 1 and message['role'] == 'user' and messages[0]['role'] == 'system' %}{% else %}{% set role = 'model' if message['role'] == 'assistant' else message['role'] %}{% if loop.index0 <= 1 or messages[loop.index0 - 1]['role'] != role %}{{ '<start_of_turn>' }}{{ role }}{{ '\n'+message['content'] | trim }}{{ '<end_of_turn>'+'\n' }}{% elif loop.index0 > 1 %}{{ raise_exception('Error: Consecutive messages with the same role are not allowed.') }}{% endif %}{% endif %}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model'}}{% endif %}",
|
| 1748 |
"clean_up_tokenization_spaces": false,
|
| 1749 |
"eos_token": "<eos>",
|
| 1750 |
+
"model_max_length": 1048576,
|
| 1751 |
"pad_token": "<pad>",
|
| 1752 |
"sp_model_kwargs": {},
|
| 1753 |
"spaces_between_special_tokens": false,
|