Si fa un gran parlare (e sparlare…) di ChatGPT e delle potenzialità della sua Intelligenza Artificiale.
Ho visto tanti esempi, buoni e cattivi, allarmati o eccitati, di usare questa potentissima tecnologia. Ma quasi tutti erano solo chiacchierate con ChatGPT, oppure poco più.
Ho voluto provare qualcosa in più: usare le API (Application Programming Interface) di ChatGPT spingendo un po’ più in là il confine dell’esplorazione. Visto che sicuramente la capacità di questo LLM (Large Language Model) è tutta sulla linguistica, mi è parso naturale esplorare la possibilità di fargli scrivere un romanzo in autonomia. E, vista la mia passionaccia per la narrativa, ho scelto di provare a fargli usare come “stile di scrittura” il mio.
Beh, to make a long story short: successo pieno! Se volete vedere il risultato, ecco qui il link al PDF: https://bit.ly/PortaDelTempo
Impressionante no? Vi voglio dettagliare i passaggi.
- Ho creato uno script di una sessantina di linee di codice e gli ho passato in input un unico spunto iniziale: “Il protagonista Jon Doe è un pluriassassino ed è stato condannato ad essere proiettato tre secoli nel futuro. Si risveglia nel futuro ma non ha cognizione del suo stato e dovrà ricostruire la sua identità“.
- Con lo script ho fatto generare una quarantina di passaggi della trama del romanzo con un tecnica di “proponi – riassumi – proponi…” in cui non ho dato nessun contributo umano alla generazione del testo.
- Ho usato l’ultimo riassunto ottenuto per far generare (sempre via API) sia il titolo (“La Porta del Tempo: battaglia contro il Signore dei Sogni“) che l’immagine di copertina (quella che trovate in testa all’articolo) e alcune illustrazioni (qui ho usato la API images/generations cioè quella di DALL-E).
Qui il passaggio più complesso: addestrare un modello al mio stile di scrittura. Ho proceduto così:
- Ho raccolto una buona fetta di mia “produzione letteraria” (circa 150.000 parole, cioè 600.000 caratteri) e ho spezzettato il testo in 300 “chunk” da una pagina circa (by the way: codice Python scritto mediante ChatGPT, tanto per gradire).
- Con un altro script ho dato in pasto i trecento prompt a GPT-3 chiedendo di estrarne una sintesi minimale. Ho impacchettato il tutto usando le sintesi come “prompt” e i testi originali come “completion” e ho addestrato in fine-tuning un nuovo modello di GPT-3 (per i curiosi si chiama “davinci:ft-andrea-bonvicini:stileab-2023-01-15-14-50-14“)
- Ho preso il primo spunto del romanzo suggerito da GPT-3 al passo 2 e gli ho fatto generare la prima pagina del romanzo, intitolata “La stanza era vuota“. Beh, vi posso giurare che lo stile collima con il mio in maniera davvero impressionante…
Al termine dell’elaborazione (nota da ricordare: l’unico input umano sono poche righe di testo per lo spunto iniziale) ho tutto direttamente in un documento Word generato in automatico e quel che mi basta è formattarlo con qualche click, impaginare le immagini… et voilà! (ecco qui di nuovo il link al PDF: https://bit.ly/PortaDelTempo)
A questo punto avrei potuto continuare il loop e fargli generare le altre pagine ma mi è bastato, anche perché usare le API di GPT-3 ha un costo. Già, il costo: meno di 35 dollari… di cui la gran fetta (32-33$ dollari circa) per addestrare il modello linguistico.
In buona sostanza, una volta addestrato il modello con il mio personale stile di scrittura, potrei generare romanzi “a manetta” al costo di un paio di dollari l’uno…
Lesson learned, ora:
- la potenza degli strumenti è davvero impressionante;
- per sfruttarla ChatGPT è una bella interfaccia semplice e intuitiva, ma le API possono dare ottime soddisfazioni in termini di automazione e di settaggio fine del risultato;
- se vuoi ottenere testi consistenti è necessario il fine-tuning di un modello;
- fare il fine-tuning è piuttosto semplice (GPT-3 mette a disposizione una serie di strumenti CLI che velocizzano il tutto e non è male l’idea di coinvolgere sempre GPT-3 nel processo di definizione prompt-completion);
- bastano (e probabilmente avanzano) 300 coppie prompt-completion per addestrare il modello.
Ringraziamenti
Spunti di programmazione li ho trovati in due esperti, uno italiano e uno statunitense:
- Alessio Pomaro: https://www.alessiopomaro.it/ https://www.linkedin.com/in/alessiopomaro/
- Dave Shapiro: https://www.davidkshapiro.com/ https://www.linkedin.com/in/dshap-automator/
A loro i miei più sentiti ringraziamenti!
Everything is very open with a precise explanation of the
challenges. It was truly informative. Your website is useful.
Thank you for sharing!
My blog post: vpn special code
Я очень доволен, что прочитал эту статью. Она не только предоставила мне интересные факты, но и вызвала новые мысли и идеи. Очень вдохновляющая работа, которая оставляет след в моей памяти!
I was suggested this web site by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my trouble.
You’re incredible! Thanks!
Also visit my web blog … vpn coupon 2024
wow, amazing
Я рад, что наткнулся на эту статью. Она содержит уникальные идеи и интересные точки зрения, которые позволяют глубже понять рассматриваемую тему. Очень познавательно и вдохновляюще!
Hello I am so grateful I found your web site, I really found you by mistake, while I was researching on Bing for something else, Anyhow I am here now and would just like to say thanks a lot for a remarkable post and a all round exciting blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the fantastic jo.
Howdy are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you need any html coding knowledge to make your own blog? Any help would be really appreciated!
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Автор представляет сложные понятия в понятной и доступной форме, что помогает читателю лучше понять тему.
Доброго!
От местных инициатив до городских праздников: top10.kr.ua охватывает все стороны жизни Кропивницкого.
Посетите https://top10.kr.ua/category/news-ukraine/
[url=https://top10.kr.ua/category/kropivnickiy-novosti/]Новости Кропивницкого видео[/url]
спортивные новости за день
главные новости Украины
новости спорта
Удачи и хороших новостей!
Статья предлагает глубокий анализ проблемы, рассматривая ее со всех сторон.
If you wish for to obtain a great deal from this article then you have
to apply such strategies to your won blog.
Feel free to visit my blog post: vpn special code
You actually make it appear really easy together with your
presentation however I to find this matter to be really something that I think
I’d by no means understand. It sort of feels too complicated
and very huge for me. I am taking a look forward for your
next post, I will attempt to get the grasp of it!
Check out my page – vpn coupon code 2024
Your article helped me a lot, is there any more related content? Thanks!
Rattling instructive and superb body structure of content, now that’s user pleasant (:.
This is really interesting, You�re a very skilled blogger. I�ve joined your feed and look forward to seeking more of your magnificent post. Also, I�ve shared your site in my social networks!
naturally like your web site however you need to take a look at the spelling on several of your posts. A number of them are rife with spelling problems and I find it very bothersome to tell the truth on the other hand I will surely come again again.
I very delighted to find this internet site on bing, just what I was searching for as well saved to fav
You�re so awesome! I don�t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
I�m often to blogging and i really appreciate your content. The article has actually peaks my interest. I�m going to bookmark your web site and maintain checking for brand spanking new information.
Это способствует более глубокому пониманию и анализу представленных фактов.
Статья содержит полезные факты и аргументы, которые помогают разобраться в сложной теме.
Everything is very open and very clear explanation of issues. was truly information.活婴儿色情片
Thank you for great information. Hello Administ . 国产线播放免费人成视频播放
cialis 20mg prices cialis dose maximale tadalafil cost openair
I simply couldn’t depart your website prior to suggesting that
I actually enjoyed the usual information an individual supply on your visitors?
Is going to be again steadily in order to check out new posts
Also visit my blog post – vpn coupon code 2024
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
I need to to thank you for this fantastic read!!
I definitely loved every bit of it. I have got you saved as a favorite
to check out new things you post…
My blog post … vpn special code
I was curious if you ever thought of changing the structure of
your site? Its very well written; I love what youve got to say.
But maybe you could a little more in the way of content so people could connect with it better.
Youve got an awful lot of text for only having one or two images.
Maybe you could space it out better?
my homepage :: vpn coupon 2024
This is my first time pay a quick visit at here and i am really happy to read everthing at one place
Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
This was beautiful Admin. Thank you for your reflections.
I do not even understand how I ended up here, but I assumed this publish used to be great
I just like the helpful information you provide in your articles
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Great beat ! I wish to apprentice whilst you amend your website, how could i subscribe for a blog web site?
The account helped me a acceptable deal. I had been tiny bit familiar
of this your broadcast offered vivid transparent concept
Here is my web-site vpn coupon code 2024
My family all the time say that I am wasting my time here at net, but I
know I am getting know-how everyday by reading thes good content.
Check out my webpage: vpn 2024
I’m not sure exactly why but this weblog is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I’ll check back later and see if the problem still exists.
I very delighted to find this internet site on bing, just what I was searching for as well saved to fav
Very soon this site will be famous among all blogging viewers, due to it’s pleasant content
Here is my page … vpn code 2024
This was beautiful Admin. Thank you for your reflections.
You�re so awesome! I don�t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
nice content!nice history!! boba 😀
I�m often to blogging and i really appreciate your content. The article has actually peaks my interest. I�m going to bookmark your web site and maintain checking for brand spanking new information.
Hi there to all, for the reason that I am genuinely keen of reading this website�s post to be updated on a regular basis. It carries pleasant stuff.