QwEmotion-RP is an emotion classification model trained to determine a character emotion base on a single input message.
The model is trained on all 28 emotions that are compatible with SillyTaverns Character Expressions sprites.
The goal is to create a dedicated model for determining emotions that can be loaded purely in RAM and utilizing only the CPU.
To use the model as it was intended, it is recommended to run llamacpp with the arg --device none for pure CPU inference.
Disclaimer: SillyTavern's Character Expressions extension does not yet accept embedding models. For now this is just a demo that can be played around with.
Usage
Prompting Directions:
Queries:
Typically you want your quries to be a single bot chat message: the one you need the character sprite decided for.
Documents:
You want the documents to each be a single word, all of which are names of emotions.
The following is the list of emotions this model was trained to classify, sorted in alphabetical order:
1from sentence_transformers import SentenceTransformer
23# Download from the 🤗 Hub4model = SentenceTransformer("sentence_transformers_model_id")5# Run inference6sentences =[7'Jerald\'s chains rattled as he twisted toward the barred window, throwing off questing hands like a dog shaking water. His glare could have cut steel. The women\'s whimpers died against the concrete walls.\n\n"Had enough." The words cracked like a whip. "Your pet died in that alley outside Huntsville, buried him myself. These girls you\'ve hollowed out? Not my problem."\n\nHe surged forward, chains biting into his wrists. The closest girl stumbled back, eyes wide. Good. Let them see.\n\n"You want leverage?" His laugh came harsh, tasting of blood. "Try again. I watched men die screaming on my table, begging for mothers who weren\'t coming. You think this performance scares me?" He spat at the window. "Find a new trick."',8'disapproval',9'excitement',10]11embeddings = model.encode(sentences)12print(embeddings.shape)13# [3, 1024]1415# Get the similarity scores for the embeddings16similarities = model.similarity(embeddings, embeddings)17print(similarities)18# tensor([[1.0000, 0.4001, 0.1208],19# [0.4001, 1.0000, 0.0439],20# [0.1208, 0.0439, 1.0000]])
Out-of-Scope Use
The model is trained specifically on emotion classification, and is unlikely to offer any sort of improvement on other tasks.
Bias, Risks and Limitations
Bots that play as more than one character are likely to confuse the model.
It is recommended to use a dedicated narrator bot rather than having main characters also play the role of any side charcters.
Approximate statistics based on the first 100 samples:
anchor
positive
type
string
string
modality
text
text
details
min: 11 tokens
mean: 110.47 tokens
max: 630 tokens
min: 6 tokens
mean: 7.07 tokens
max: 9 tokens
Samples:
anchor
positive
[object Object] Who might this person be, Mr. Svidrigailov? And what is the nature of the danger they face?
fear
[object Object] I can't say I've ever seen anything quite like this before. What brings you to such an extraordinary place?
curiosity
Her breath hitched traitorously as he slicked against her, pleasure blooming where it shouldn't. God. The slow press, deliberate and obscene, had her nails digging half-moons into her own palms.[object Object][object Object]She went still beneath him. Waiting. Pretending she wasn't counting heartbeats until they synchronized. He probably wanted gratitude, or tears, or some theatrical performance of female surrender.[object Object][object Object]"I suppose," she said, voice soft as dust. Not venom. The venom was reserved for Deborah Listing, CDC agent, who'd walked into this trap alone like some rookie with an anthropology degree and hero fantasies. Backup existed. She'd chosen not to use it. Always about the story, wasn't it? The great investigator who needed no partner.[object Object][object Object]The anger tasted metallic, like pennies against her tongue.
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}
MultipleNegativesRankingLoss
bibtex
1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}