Cozmo-GRED: Generative Robot Emotional Displays
This is a GPT-2-medium-based language model fine-tuned to generate robot behaviors given an emotion label. It is trained on emotion-behavior data collected from the Cozmo robot and produces textual descriptions of Cozmo's actions that align with the given emotion.
Model Details
Base Model: GPT-2 Medium
Model type: Causal Language Model
Inputs: Prompt of the form Emotion: <emotion> Behaviors:
Outputs: A text sequence representing Cozmo robot behaviors
Development code: https://github.com/bsu-slim/emro-gred-cozmo
Emotion Labels
This model was trained on 6 grouped emotions:
anger_frustrationconfusion_sorrow_boredomdisgust_surprise_alarm_fearinterest_desirejoy_hopeunderstanding_gratitude_relief
How to Use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "bsu-slim/gred-cozmo"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False) # use_fast=False recommended
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
model.eval()
emotion = "joy_hope"
prompt = f"<|startoftext|>Emotion: {emotion} <|endoftext|> Behaviors:"
inputs = tokenizer(prompt, return_tensors="pt").to(device)
# Generate behaviors
output = model.generate(
**inputs,
max_new_tokens=50,
do_sample=True,
top_k=50,
top_p=0.95,
pad_token_id=tokenizer.eos_token_id
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(f"Input Emotion: {emotion}")
print("Generated Behavior:")
print(generated_text.split("Behaviors:")[1].strip())
Example Output
Input Emotion: joy_hope
Generated Behavior:
display_oled_face_image_face8_1 say_text_oh!_1_1 set_head_angle_45_1 drive_straight_100_50 display_oled_face_image_face8_1
- Downloads last month
- 743
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support