Views
No views yet
Emotion: <emotion> Behaviors:anger_frustrationinterest_desireconfusion_sorrow_boredomjoy_hopeunderstanding_gratitude_reliefdisgust_surprise_alarm_fear1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_name = "bsu-slim/gred-misty"
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())drive_track_36_0_1 display_face_resources_misty_faces_black_7_1 say_text_wahoo! move_arm_both_85_80 move_arm_both_0_80@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}}