facebook/empathetic_dialogues
Updated • 5.25k • 130
How to use Lixeeone/Emoloom-2B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Lixeeone/Emoloom-2B") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("Lixeeone/Emoloom-2B", dtype="auto")How to use Lixeeone/Emoloom-2B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Lixeeone/Emoloom-2B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Lixeeone/Emoloom-2B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Lixeeone/Emoloom-2B
How to use Lixeeone/Emoloom-2B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Lixeeone/Emoloom-2B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Lixeeone/Emoloom-2B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Lixeeone/Emoloom-2B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Lixeeone/Emoloom-2B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Lixeeone/Emoloom-2B with Docker Model Runner:
docker model run hf.co/Lixeeone/Emoloom-2B
Emoloom-2B is a ~2B-parameter emotion understanding model that outputs multi-label emotion categories and continuous VAD (Valence, Arousal, Dominance) for dialogue utterances. It is fine-tuned from Qwen/Qwen1.5-1.8B-Chat with SFT on a curated mix of GoEmotions and Empathetic Dialogues, plus consistency constraints to keep JSON outputs robust and parsing-friendly.
Output format (single line JSON):
{"labels": ["sad","anxious"], "vad": {"v": 0.42, "a": 0.31, "d": 0.28}, "rationale": "short evidence"}
| Exp | Macro-F1 | Macro-P | Macro-R | VAD(1-RMSE) | ParseOK | n(dev) |
|---|---|---|---|---|---|---|
sft_qwen_mix2080 |
0.3500 | 0.5000 | 0.2693 | 0.9417 | 1.000 | 3663 |
sft_qwen_mix5050 |
0.3470 | 0.5000 | 0.2657 | 0.9337 | 1.000 | 3309 |
sft_qwen_mix8020 |
0.3341 | 0.5000 | 0.2509 | 0.9135 | 1.000 | 2068 |
sft_qwen_mix2080_dd_quick (DailyDialog, quick) |
0.3071 | 0.5000 | 0.2136 | 0.8066 | 0.976 | 6261 |
Notes:
ParseOK = fraction of generations that are valid, one-line JSON.Qwen/Qwen1.5-1.8B-Chat{labels, vad:{v,a,d}, rationale} with two-decimal VAD.use_cache=False at train/evalfrom transformers import AutoTokenizer, AutoModelForCausalLM
import json, torch
name = "Lixeeone/Emoloom-2B"
tok = AutoTokenizer.from_pretrained(name, trust_remote_code=True, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(name, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
if tok.pad_token_id is None:
tok.pad_token = tok.eos_token
model.config.use_cache = False # keep output format stable
context = "We argued last night but made up this morning."
utterance = "I’m still a bit shaken though."
sys = ("You are an empathetic assistant. Identify emotion labels (multi-label) "
"and estimate VAD (Valence, Arousal, Dominance in [0,1]). Respond with STRICT one-line JSON only.")
usr = (
"Task: Read the text and provide emotion labels and VAD with two decimals, plus a brief rationale (<=30 words).\n"
"Return JSON ONLY, single line:\n"
'{{"labels": [...], "vad": {{"v": 0.00, "a": 0.00, "d": 0.00}}, "rationale": "..."}}\n'
f"Context: {context}\n"
f'Text: "{utterance}"'
)
msgs = [{"role":"system","content":sys},{"role":"user","content":usr}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
inp = tok(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(**inp, max_new_tokens=128, do_sample=False, use_cache=False)
gen = tok.decode(out[0][inp["input_ids"].shape[1]:], skip_special_tokens=True)
pred = json.loads(gen) # {"labels":[...], "vad":{"v":..,"a":..,"d":..}, "rationale": "..."}
print(pred)
Base model
Qwen/Qwen1.5-1.8B-Chat