Views
No views yet
Emotion: <emotion> Behaviors:anger_frustrationconfusion_sorrow_boredomdisgust_surprise_alarm_fearinterest_desirejoy_hopeunderstanding_gratitude_relief1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_name = "bsu-slim/gred-cozmo"
5
6model = AutoModelForCausalLM.from_pretrained(model_name)
7tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False) # use_fast=False recommended
8
9device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
10model.to(device)
11model.eval()
12
13emotion = "joy_hope"
14prompt = f"<|startoftext|>Emotion: {emotion} <|endoftext|> Behaviors:"
15inputs = tokenizer(prompt, return_tensors="pt").to(device)
16
17# Generate behaviors
18output = model.generate(
19 **inputs,
20 max_new_tokens=50,
21 do_sample=True,
22 top_k=50,
23 top_p=0.95,
24 pad_token_id=tokenizer.eos_token_id
25)
26
27generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
28print(f"Input Emotion: {emotion}")
29print("Generated Behavior:")
30print(generated_text.split("Behaviors:")[1].strip())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@INPROCEEDINGS{11246523,
author={Baral, Rista and Grenz, Bethany and Kennington, Casey},
booktitle={2025 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
title={Recognizing and Generating Novel Emotional Behaviors on Two Robotic Platforms},
year={2025},
volume={},
number={},
pages={21503-21510},
keywords={Training;Emotion recognition;Behavioral sciences;Robots;Intelligent robots},
doi={10.1109/IROS60139.2025.11246523}}