SimsChat
This is a conversational model fine-tuned from meta-llama/Meta-Llama-3-8B using the yangbh217/SimsChat dataset via Supervised Fine-Tuning (SFT).
Model Details
- Base Model: meta-llama/Meta-Llama-3-8B
- Finetuning Data: yangbh217/SimsChat
- Language: English (primarily)
Model Description
This model leverages the Llama 3 and fine-tunes it on SimsChat, a high-quality, simulated role-playing dialogue dataset. The goal is to create a chat model that excels at daily conversation, emotional expression, and role-playing.
The SimsConv dataset is designed according to "The Sims 4" game, containing a large volume of simulated daily conversation scenarios. As a result, this fine-tuned model may perform better in:
- Colloquial & Natural Language: Dialogue style is closer to everyday speech rather than formal written language.
- Emotional Awareness: The training data includes emotional labels, making the model more sensitive to emotional context.
- Role-playing: The model is better suited to simulate specific characters or personas (similar to "Sims" in the game).
Uses
Intended Uses
This model is intended for Chinese conversational scenarios, including:
- Chatbot: A general-purpose chatbot for fluent, everyday conversation.
- Role-playing: Simulating specific characters (especially Sims-like personas) for interaction.
- Creative Writing: Assisting in generating dialogue scripts or stories.
How to Use
You will need to install transformers (v4.40.0 or higher recommended) and torch.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
# -------------------------------------------------------------------
# Replace with your model ID (e.g., "yangbh217/SimsChat-Llama-3-8B")
# -------------------------------------------------------------------
model_id = "your-username/model_name"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16, # Recommended for VRAM savings
device_map="auto", # Automatically maps to GPU
)
# --- Method 1: Use Transformers Pipeline (Recommended) ---
print("--- Pipeline Example ---")
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
)
# Dialogue format required by Llama-3 chat template
messages = [
{"role": "system", "content": "You are an AI assistant, role-playing as a character from 'The Sims'."},
{"role": "user", "content": "Hi! How are you feeling today?"},
]
# Specific terminators for Llama-3
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipe(
messages,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
# outputs[0]["generated_text"] contains the full conversation history
# We only print the assistant's last response
print(outputs[0]["generated_text"][-1]['content'])
# --- Method 2: Manually Apply Chat Template ---
print("\n--- Manual Template Example ---")
# Manually apply the Llama-3 chat template
# add_generation_prompt=True automatically adds <|start_header_id|>assistant<|end_header_id|>\n\n
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Encode
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate
outputs_manual = model.generate(
**inputs,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
# Decode (only the newly generated part)
response_ids = outputs_manual[0][inputs.input_ids.shape[1]:]
response = tokenizer.decode(response_ids, skip_special_tokens=True)
print(response)
- Downloads last month
- 13