Text Generation
Transformers
Safetensors
gemma4
emotional-support
companion
on-device
conversational
emotion
doi:10.5281/zenodo.23179311
Eval Results
Instructions to use Lythri/Lythri-7B-A4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lythri/Lythri-7B-A4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lythri/Lythri-7B-A4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("Lythri/Lythri-7B-A4B") model = AutoModelForCausalLM.from_pretrained("Lythri/Lythri-7B-A4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lythri/Lythri-7B-A4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lythri/Lythri-7B-A4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lythri/Lythri-7B-A4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Lythri/Lythri-7B-A4B
- SGLang
How to use Lythri/Lythri-7B-A4B 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 "Lythri/Lythri-7B-A4B" \ --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": "Lythri/Lythri-7B-A4B", "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 "Lythri/Lythri-7B-A4B" \ --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": "Lythri/Lythri-7B-A4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Lythri/Lythri-7B-A4B with Docker Model Runner:
docker model run hf.co/Lythri/Lythri-7B-A4B
chat template: default system prompt + think prefill
Browse files- chat_template.jinja +5 -0
chat_template.jinja
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{#
|
| 2 |
Template: Google Gemma 4 Canonical Chat Template
|
| 3 |
Author: Google Gemma Engineering Team
|
|
@@ -384,3 +388,4 @@
|
|
| 384 |
{{- '<|channel>thought\n' -}}
|
| 385 |
{%- endif -%}
|
| 386 |
{%- endif -%}
|
|
|
|
|
|
| 1 |
+
{#- lythri: think flag v2 -#}{%- set lythri_think = not (enable_thinking is defined and enable_thinking is false) -%}
|
| 2 |
+
{%- if messages | length == 0 or messages[0]['role'] != 'system' -%}
|
| 3 |
+
{%- set messages = [{'role': 'system', 'content': "You are Lythri, an AI assistant developed for emotional support. Reply concisely in the same language as the user. Always consider the user's feelings. Be friendly and warm, and provide concrete help in critical moments."}] + messages -%}
|
| 4 |
+
{%- endif -%}
|
| 5 |
{#
|
| 6 |
Template: Google Gemma 4 Canonical Chat Template
|
| 7 |
Author: Google Gemma Engineering Team
|
|
|
|
| 388 |
{{- '<|channel>thought\n' -}}
|
| 389 |
{%- endif -%}
|
| 390 |
{%- endif -%}
|
| 391 |
+
{#- lythri: think prefill v2 -#}{% if add_generation_prompt %}{%- if lythri_think -%}{{ '<think>\n' }}{%- else -%}{{ '<think>\n\n</think>\n\n' }}{%- endif -%}{% endif %}
|