
Mit GoTool wurde das erforderliche Poesie -Corpus von der Projekt Gutenberg auf der Website von Projekt Gutenberg erstellt, eine massive Online -Datenbank mit über 59000 E -Books.
Emolex ist ein Crowdsourcing -Datensatz von Assoziationen zwischen Wörtern und Emotionen. Es wurde verwendet, um den Poesiekorpus auf der Grundlage der Emotionen der Gedichte zu klassifizieren. Für jede Emotion wurde ein Sprachmodell erstellt, indem Gedichte verwendet wurden, die dieser Emotion entsprechen.
Huggingface ist eine KI -Community, die verschiedene Open -Source -Modelle in der Verarbeitung natürlicher Sprache bietet. Das GPT-2-Modell von OpenAI wurde vom Modell-Hub von Huggingface verwendet, das auf einem großen Poesie-Korpus fein abgestimmt war.
Flask ist ein Micro -Web -Framework in Python. Es wurde verwendet, um eine Web-App zu erstellen, mit der mit den feinen GPT-2-Modellen interagiert werden.
Algorithmie ist ein MLOPS -Tool, das eine einfache und schnellere Möglichkeit bietet, Ihr maschinelles Lernmodell in Produktion einzusetzen. Es wurde verwendet, um eine Web -API zu erstellen, um mit dem Modell zu interagieren. Benutzer können API -Anforderungen an das Modell über die Flask -App stellen.
Heroku ist eine Plattform als Service (PAAS), mit der Entwickler Anwendungen vollständig in der Cloud erstellen, ausführen und betreiben können. Es wurde verwendet, um die Web -App so bereitzustellen, dass Benutzer aus der ganzen Welt 24x7 zugreifen können.
Dieses Projekt wurde mit dem Ziel entwickelt, ein Tool zu erstellen, mit dem die ursprüngliche Poesie automatisch in einem sofortigen Einbettung der erforderlichen Emotionen komponiert werden kann. OpenAIs GPT-2 wurde als Basis-Sprachmodell ausgewählt, da es die Transformatorarchitektur mit maskierten Selbstbekämpfungsköpfen ermöglicht hat, mit generell verwandten Aufgaben außergewöhnlich gut abzuschneiden.
Der Datensatz wurde von der Projektgutenberg -Website erhalten. Das Emolex -Tool wurde verwendet, um das Poesie -Korpus in 8 verschiedene Emotionsklassen zu unterscheiden - anger, anticipation, disgust, fear, joy, sadness, surprise and trust . Die Gedichte, die in keine dieser Kategorien passen, wurden in die neutrale Kategorie hinzugefügt.
Zunächst wurde das GPT-2-Modell auf den neutralen Gedichten trainiert. Dies gab uns das "neutrale" Modell, um ein allgemeines Gedicht zu generieren. Modelle für jede Emotion wurden durch Feinabstimmung dieses „neutralen“ Modells über Gedichte entsprechender Emotionen erzeugt. Der gesamte Aufbau dieser Modelle findet sich in Colab. Diese Modelle können auch im Hubface -Modell -Hub gefunden werden.
Im Folgenden finden Sie die Links zu den Modellen jeder Emotion:
Die Algorithmie wurde verwendet, um eine API zu erstellen, um mit diesen Modellen zu interagieren. Es wurde eine Flask -App erstellt, mit der Benutzer API -Anfragen an Algorithmie senden und die generierten Gedichte empfangen können. Die App wurde mit Heroku eingesetzt und live gemacht.
?AutoCompose
┣ data --> Contains entire poetry corpus as well as poem collections of each emotion stored in json format
┣ models --> Contains language models fine-tuned for each emotion
┃ ┣ anger
┃ ┣ anger2
┃ ┣ anticipation2
┃ ┣ disgust2
┃ ┣ fear
┃ ┣ fear2
┃ ┣ joy
┃ ┣ joy2
┃ ┣ neutral
┃ ┣ sadness2
┃ ┣ surprise2
┃ ┣ trust2
┣ notebooks --> Contains .ipynb files used to work with dataset and train the model
┣ outputs --> Contains 25 poems generated by the model for each emotion
┣ readme-assets --> Contains images and gifs used in readme file
┣ src --> Contains flask app and other supporting python files
┃ ┣ static
┃ ┃ ┗ images
┃ ┣ templates
Wütende Gedanken
I am not jealous; but this does vex
My heart so full of misery that I cannot stop
From angry thoughts. This brings me relief,
And a painful torment; and I
Am content to part from thee alone.
Gott im Geheimnis
Thence down the river to the mountain-side
I travelled with my boats and my oarsmen,
To seek a haven near the southern cape
Where dwelt some mighty god in mystery,
Unknowing I wandered therefrom, so
Unconscious I lay, and rested there.
Gänseblümchen und Dreck
The little pool, by the house-wall,
Is covered with daisies and filth;
The fountains are withered and dim,
And the lizards writhe in rags.
Ich sehe dich in einer anderen Ecke
I see thee in a far corner,
With a stealthy stride, and a trembling soul
I know thou, Dear, who should'st not fear
That I should come near thee!
I know thee.
Sanft-droat
Thy soul has joy, and thy soul is free,
And all the things it loves can live
In thy love for me and thee!
O gentle-throat, why sing so low,
Or do thy music too loudly?
Whence are all thy numbers fit?
If that thy mind is fix'd upon one,
It joys not to hear thee speak.
Mond
He took them home, and soon set them down
In a chest at the door of his room,
And asked them if they knew
What the moon was about.
Liebes Herz
For you, dear heart, so lone and worn and weary,
Hear me, and the silence dies,
That still I think you must come near me,
And not so be blest.
Natur ist eigen
He is a wild magician,
Who takes up the air and vanishes
As though his name were Nature's own,
And that it were Nature's own prompting,
That he should leave school in such a way.
Verkleidungsmädchen
He sees the aged damsels in disguise,
And how the princely damsels are dressed;
The queen of Sariola, as she stands,
Is clad in rich embroidery;
And every thing that she does wear
Is a royal dame in finest form,
And a queen in fairest posture too.