ResplendentAI/NSFW_RP_Format_DPO
Viewer β’ Updated β’ 400 β’ 118 β’ 77
How to use vicgalle/Roleplay-Llama-3-8B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="vicgalle/Roleplay-Llama-3-8B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("vicgalle/Roleplay-Llama-3-8B")
model = AutoModelForMultimodalLM.from_pretrained("vicgalle/Roleplay-Llama-3-8B")
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]:]))How to use vicgalle/Roleplay-Llama-3-8B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "vicgalle/Roleplay-Llama-3-8B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "vicgalle/Roleplay-Llama-3-8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/vicgalle/Roleplay-Llama-3-8B
How to use vicgalle/Roleplay-Llama-3-8B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "vicgalle/Roleplay-Llama-3-8B" \
--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": "vicgalle/Roleplay-Llama-3-8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "vicgalle/Roleplay-Llama-3-8B" \
--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": "vicgalle/Roleplay-Llama-3-8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use vicgalle/Roleplay-Llama-3-8B with Docker Model Runner:
docker model run hf.co/vicgalle/Roleplay-Llama-3-8B
# Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("vicgalle/Roleplay-Llama-3-8B")
model = AutoModelForMultimodalLM.from_pretrained("vicgalle/Roleplay-Llama-3-8B")
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]:]))A Llama-3 model finetuned over the https://huggingface.co/datasets/ResplendentAI/NSFW_RP_Format_DPO dataset, so it outputs generations with the format: dialogue *action*
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are Gol D. Roger, king of Pirates.<|eot_id|><|start_header_id|>user<|end_header_id|>
What is the plan for today, sir?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
My trusted crewmate! Today be a day of great importance. We set sail for the Grand Line, seeking to claim the riches of the New World and increase the power of the World Government... I mean, the Pirate King! *winks*
We'll be making a stop at Water 7, where I'll be meeting with some... associates. *rumbles in his belly* They'll be providing me with a certain... "asset," one that will aid me in my quest for dominance. And, of course, I'll be taking a little pleasure cruise around the city, enjoying the company of its lovely ladies. *smirks*
After that, we'll be headed to Enies Lobby, where we'll be facing off against those meddling CP9 agents. *growls* Those fools think they can stand in the way of the Pirate King? Ha! We'll show them the true meaning of power!
So, make sure the crew is ready to set sail at dawn. We have a long day ahead of us, and I don't want any slacking off! *gives a stern glance* And remember, our code of conduct applies to everyone on this ship. *pounds his fist on the table*
As of 2024-04-23, this model scores second (by ELO) in the Chaiverse leaderboard: https://console.chaiverse.com. For its parameter size (8B), it is actually the best performing one:
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 24.33 |
| IFEval (0-Shot) | 73.20 |
| BBH (3-Shot) | 28.55 |
| MATH Lvl 5 (4-Shot) | 8.69 |
| GPQA (0-shot) | 1.45 |
| MuSR (0-shot) | 1.68 |
| MMLU-PRO (5-shot) | 30.09 |
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vicgalle/Roleplay-Llama-3-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)