cardiffnlp/tweet_eval
Viewer • Updated • 201k • 36.6k • 143
How to use RockyBai/emotion-llama-3.1-8b with Transformers:
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("RockyBai/emotion-llama-3.1-8b", dtype="auto")How to use RockyBai/emotion-llama-3.1-8b with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RockyBai/emotion-llama-3.1-8b to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RockyBai/emotion-llama-3.1-8b to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for RockyBai/emotion-llama-3.1-8b to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="RockyBai/emotion-llama-3.1-8b",
max_seq_length=2048,
)This is a LoRA fine-tuned version of Meta-Llama-3.1-8B-Instruct for emotion classification and mental health support.
from unsloth import FastLanguageModel
# Load the fine-tuned model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="emotion_model_finetuned",
max_seq_length=2048,
dtype=None,
load_in_4bit=True,
)
# Enable inference mode
FastLanguageModel.for_inference(model)
# Use the model
prompt = """<|im_start|>system
You are a compassionate mental health support assistant.<|im_end|>
<|im_start|>user
I'm feeling anxious about tomorrow.<|im_end|>
<|im_start|>assistant
"""
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=128)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
adapter_config.json - LoRA adapter configurationadapter_model.safetensors - Fine-tuned weightstokenizer.json - Tokenizer filestraining_config.json - Training hyperparameters