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!
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Everything is very open and very clear explanation of issues. was truly information.Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Thank you great posting about essential oil. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader.Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thank you great posting about essential oil. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Good info. Lucky me I reach on your website by accident, I bookmarked it. Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Everything is very open and very clear explanation of issues. was truly information.Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
I really love to read such an excellent article. Helpful article. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Thank you for great information. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
sildenafil at tesco viagra namen sildenafil dose caes
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?
Мы рекомендуем посетить веб-сайт https://kaizen-tmz.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://kaizen-tmz.ru/]https://kaizen-tmz.ru/[/url]
Good info. Lucky me I reach on your website by accident, I bookmarked it. Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Мы рекомендуем посетить веб-сайт https://ipodtouch3g.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://ipodtouch3g.ru/]https://ipodtouch3g.ru/[/url]
I really love to read such an excellent article. Helpful article. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Thank you great posting about essential oil. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Мы рекомендуем посетить веб-сайт https://adventime.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://adventime.ru/]https://adventime.ru/[/url]
Thank you for great content. Hello Administ. Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Great post thank you. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
Thank you great post. Hello Administ .Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader.Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
cialis mexico cost cialis dosage strengths cialis schedule drug
Мы рекомендуем посетить веб-сайт https://my-caffe.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://my-caffe.ru/]https://my-caffe.ru/[/url]
Мы рекомендуем посетить веб-сайт https://lostfiilmtv.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://lostfiilmtv.ru/]https://lostfiilmtv.ru/[/url]
Your article helped me a lot, is there any more related content? Thanks!
Доброго!
С нашими новостями вы всегда будете в курсе последних событий в мире и Украине. Мы предлагаем вам объективную информацию, которая поможет вам лучше понять происходящее вокруг.
Погрузитесь в захватывающий мир событий с нашими новостями из Украины и мира. Мы предлагаем вам всесторонний обзор самых важных событий, которые влияют на нашу жизнь и будущее.
Все самое лучшее на сайте https://kompromis.info/video/
[url=https://kompromis.info/tehno/]новости науки[/url]
новости технологий
спорт новости
новости авто
Удачи!
Мы рекомендуем посетить веб-сайт https://remonttermexov.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://remonttermexov.ru/]https://remonttermexov.ru/[/url]
Мы рекомендуем посетить веб-сайт http://voenoboz.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=http://voenoboz.ru/]http://voenoboz.ru/[/url]
I like the efforts you have put in this, regards for all the great content.
After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.
enhancing viagra viagra women dosage benefits of sildenafil
Мы рекомендуем посетить веб-сайт https://burger-kings.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://burger-kings.ru/]https://burger-kings.ru/[/url]
Мы рекомендуем посетить веб-сайт https://telegra.ph/Internet-magazin-Rybachok-vash-nadezhnyj-partner-v-mire-rybnoj-lovli-04-15.
Кроме того, не забудьте добавить сайт в закладки: [url=https://telegra.ph/Internet-magazin-Rybachok-vash-nadezhnyj-partner-v-mire-rybnoj-lovli-04-15]https://telegra.ph/Internet-magazin-Rybachok-vash-nadezhnyj-partner-v-mire-rybnoj-lovli-04-15[/url]
Мы рекомендуем посетить веб-сайт https://telegra.ph/Internet-magazin-Rybachok-vash-put-k-uspeshnoj-rybalke-04-15-2.
Кроме того, не забудьте добавить сайт в закладки: [url=https://telegra.ph/Internet-magazin-Rybachok-vash-put-k-uspeshnoj-rybalke-04-15-2]https://telegra.ph/Internet-magazin-Rybachok-vash-put-k-uspeshnoj-rybalke-04-15-2[/url]
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
cialis for bodybuilding tadalafil farmacias guadalajara tadalafil tablets tadedplg
Мы рекомендуем посетить веб-сайт https://telegra.ph/O-magazine-Rybachok-04-15.
Кроме того, не забудьте добавить сайт в закладки: [url=https://telegra.ph/O-magazine-Rybachok-04-15]https://telegra.ph/O-magazine-Rybachok-04-15[/url]
Мы рекомендуем посетить веб-сайт https://telegra.ph/Internet-magazin-Rybachok-vash-put-k-udachnoj-rybalke-04-15.
Кроме того, не забудьте добавить сайт в закладки: [url=https://telegra.ph/Internet-magazin-Rybachok-vash-put-k-udachnoj-rybalke-04-15]https://telegra.ph/Internet-magazin-Rybachok-vash-put-k-udachnoj-rybalke-04-15[/url]
Мы рекомендуем посетить веб-сайт https://telegra.ph/Internet-magazin-Rybachok-vash-vybor-dlya-uspeshnoj-rybalki-04-15-2.
Кроме того, не забудьте добавить сайт в закладки: [url=https://telegra.ph/Internet-magazin-Rybachok-vash-vybor-dlya-uspeshnoj-rybalki-04-15-2]https://telegra.ph/Internet-magazin-Rybachok-vash-vybor-dlya-uspeshnoj-rybalki-04-15-2[/url]
Мы рекомендуем посетить веб-сайт https://telegra.ph/Internet-magazin-Rybachok-vash-nadezhnyj-partner-v-mire-rybalki-04-15-2.
Кроме того, не забудьте добавить сайт в закладки: [url=https://telegra.ph/Internet-magazin-Rybachok-vash-nadezhnyj-partner-v-mire-rybalki-04-15-2]https://telegra.ph/Internet-magazin-Rybachok-vash-nadezhnyj-partner-v-mire-rybalki-04-15-2[/url]
I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.