yangbh217

1 models • 1 total models in database
Sort by:

SimsChat-Llama-3-8B

This is a conversational model fine-tuned from `meta-llama/Meta-Llama-3-8B` using the yangbh217/SimsChat dataset via Supervised Fine-Tuning (SFT). Base Model: meta-llama/Meta-Llama-3-8B Finetuning Data: yangbh217/SimsChat Language: English (primarily) 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). This model is intended for 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. You will need to install `transformers` (v4.40.0 or higher recommended) and `torch`. ```python import torch from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline ------------------------------------------------------------------- Replace with your model ID (e.g., "yangbh217/SimsChat-Llama-3-8B") ------------------------------------------------------------------- modelid = "your-username/modelname" Load tokenizer and model tokenizer = AutoTokenizer.frompretrained(modelid) model = AutoModelForCausalLM.frompretrained( modelid, torchdtype=torch.bfloat16, # Recommended for VRAM savings devicemap="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.eostokenid, tokenizer.converttokenstoids(" ") ] outputs = pipe( messages, maxnewtokens=256, eostokenid=terminators, dosample=True, temperature=0.7, topp=0.9, ) outputs[0]["generatedtext"] contains the full conversation history We only print the assistant's last response print(outputs[0]["generatedtext"][-1]['content']) --- Method 2: Manually Apply Chat Template --- print("\n--- Manual Template Example ---") Manually apply the Llama-3 chat template addgenerationprompt=True automatically adds assistant \n\n prompt = tokenizer.applychattemplate( messages, tokenize=False, addgenerationprompt=True ) Encode inputs = tokenizer(prompt, returntensors="pt").to(model.device) Generate outputsmanual = model.generate( inputs, maxnewtokens=256, eostokenid=terminators, dosample=True, temperature=0.7, topp=0.9, ) Decode (only the newly generated part) responseids = outputsmanual[0][inputs.inputids.shape[1]:] response = tokenizer.decode(responseids, skipspecialtokens=True) print(response)

NaNK
llama
8
1