the AI plant
Weila. I'm Enkk, an Italian dude who does things. I'm a PhD in Computer Science and a streamer on Twitch. But this page is not about me, it's about Sandra.
My plant.
She has a Twitter account and she likes to post her selfies everyday, however, she never knows what to write in her Tweets... but you can help her.
Sandra is my plant. Specifically, she is a Beucarnea Recurvata, originally from Mexico. She is a gift from my brother and I'm taking good care of her, even tho she doesn't need much attention.
Sandra's account is managed by an algorithm that I developed.
Everyday a Raspberry Pi snaps a picture of Sandra and sends it as media attached to a fresh Tweet. This is the easy part: I'm using a camera module attached to the Raspberry which is in turn mounted very firmly to a wood thing I made. This is how it looks:
As you can see, since the Rasp is often exposed to the sun, I added proper ventilation. I'm kidding. After noticing the temperatures where going to almost 80 C°, I improved the setup:
I switched the camera module for a webcam which is easier to position (and provides better quality pictures). I also added proper ventilation.
The short answer is: Sandra tweets a selfie everyday and then she answers to a few of the tweet comments by relying on a GPT-J model, which is able to generate text.
Just reply to the last picture that Sandra posted and hope to be picked. In this section I will provide some more insight on how the whole thing works.
The algorithm has two different behaviours. At a fixed time of the day, Sandra tweets a selfie via Twitter APIs. The algorithm internally keeps track of the elapsed days and everytime a selfie is posted this days-counter is incremented.
Then, during the day, the algorithm runs again a few times in order to let Sandra reply to some of the comments. Specifically, the algorithm crawls all of the comments made to the selfie-Tweet. Only direct comments (no subthreads) are considered. After that, they all get preprocessed (the text is normalized, emojis, hashtags, links and mentions are removed, comments with less than a few words are filtered). If more than one comment per author is present, only the most liked is kept, also, only one comment per author can be replied to each day.
You can find a day-by-day history of Sandra's tweets and replies in the History tab.
After all of this we finally can pick a comment that will serve as prompt for GPT-J. To do so I've developed a function that takes in consideration the number of likes (with some bonuses to the most liked comment) and if the user retweeded the original Tweet (this gives a great boost). In this way I can thank the most supporting users that are engaging with Sandra and at the same time let the public guide the next selection (via likes), while also giving everyone a chance to get picked.
Finally, the good part. I take the prompt and give it to GPT-J. The model has some parameters that can be configured such as:
creativity
: lower number results in more precision while higher in creativitynumber of outputs
: GPT-J offers one to three response schemasrepetition penalty
: lower the value, more concise the output will belength penality
: higher the value, lower the repetition of earlier text top-p
: how much of the unlikely word get excluded from the total sampling pool top-k
: how many likely words are selected as possible continuation maximum chars
: max length of the answerAlso, these GPT-something architectures require the prompt to precisely ask for what do you want in response. Please consult the Examples tab to see some examples of comments.
Its against the TOS of GPT-3 to create a Twitter Bot. Also, because I'm not rich. GPT-3, offered by OpenAI, is very expensive. It is immensly more powerful than GPT-J, which is kinda like GPT-2 but freely accessible.
So, prompting GPT-J is not easy. You can ask anything but you should train the model... and in comments you cannot do it.
I've played a bit with the model and basically what you can do in a comment falls in one of these categories:
To ask a question, just write it as a comment. Try to be brief and clear and use a common vocabulary. Sometimes answers are on topic, other times they do not make sense.
You can ask opinions as questions, like for instance:
However I found much better results if you explicitly start with What is your opinion on:
Just start a sentence and let Sandra finish it. I suggest to use stop your message on something that keeps her talking, such as however, and, but, etc. You can even start a story and provide more context!
Yep, this was a dark one.
You can try to play with it, but don't expect much... I was lucky and she ended this lovely piece of poetry: