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!
casibom casibom Casibom casibom casibom
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.
unterschied cialis tadalafil tadalafil best price tadalafil generika wiki
Мы рекомендуем посетить веб-сайт https://tione.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://tione.ru/]https://tione.ru/[/url]
Мы рекомендуем посетить веб-сайт https://svetnadegda.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://svetnadegda.ru/]https://svetnadegda.ru/[/url]
Мы рекомендуем посетить веб-сайт https://imgtube.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://imgtube.ru/]https://imgtube.ru/[/url]
Thank you for great article. Hello Administ .国产线播放免费人成视频播放
Мы рекомендуем посетить веб-сайт https://yarus-kkt.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://yarus-kkt.ru/]https://yarus-kkt.ru/[/url]
Мы рекомендуем посетить веб-сайт https://upsskirt.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://upsskirt.ru/]https://upsskirt.ru/[/url]
Your article helped me a lot, is there any more related content? Thanks!
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.国产线播放免费人成视频播放
Good info. Lucky me I reach on your website by accident, I bookmarked it. 現場兒童色情片
Thank you for content. Area rugs and online home decor store. Hello Administ . 国产线播放免费人成视频播放
Thank you for great information. Hello Administ . 国产线播放免费人成视频播放
Nice article inspiring thanks. Hello Administ . 国产线播放免费人成视频播放
Thank you for content. Area rugs and online home decor store. Hello Administ . 国产线播放免费人成视频播放
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.
I urge you to avoid this site. My personal experience with it was purely frustration and suspicion of deceptive behavior. Be extremely cautious, or better yet, look for an honest service to meet your needs.
I strongly recommend steer clear of this platform. The experience I had with it was nothing but frustration as well as doubts about scamming practices. Be extremely cautious, or even better, find a trustworthy site for your needs.
I strongly recommend steer clear of this site. My personal experience with it has been nothing but dismay and suspicion of fraudulent activities. Proceed with extreme caution, or better yet, find an honest service to meet your needs.
medicamento cialis generico tadalafil preisvergleich tadalafil nhs guidelines
Great post thank you. Hello Administ . 国产线播放免费人成视频播放
Your article helped me a lot, is there any more related content? Thanks!
I urge you to avoid this platform. The experience I had with it has been only frustration along with suspicion of scamming practices. Be extremely cautious, or alternatively, seek out an honest service for your needs.
Мы рекомендуем посетить веб-сайт https://urkarl.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://urkarl.ru/]https://urkarl.ru/[/url]
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.国产线播放免费人成视频播放
Thank you great post. Hello Administ .国产线播放免费人成视频播放
Thank you for great content. Hello Administ. 国产线播放免费人成视频播放
Everything is very open and very clear explanation of issues. was truly information.活婴儿色情片
Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I cant believe youre not more popular because you definitely have the gift.
This blog is definitely rather handy since I’m at the moment creating an internet floral website – although I am only starting out therefore it’s really fairly small, nothing like this site. Can link to a few of the posts here as they are quite. Thanks much. Zoey Olsen
Мы рекомендуем посетить веб-сайт https://core-rpg.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://core-rpg.ru/]https://core-rpg.ru/[/url]
I urge you steer clear of this site. The experience I had with it has been only disappointment as well as doubts about scamming practices. Proceed with extreme caution, or better yet, look for a trustworthy platform to fulfill your requirements.
Мы рекомендуем посетить веб-сайт http://vanillarp.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=http://vanillarp.ru/]http://vanillarp.ru/[/url]
I am continually invstigating online for articles that can help me. Thank you!
Мы рекомендуем посетить веб-сайт https://cultureinthecity.ru/.
Кроме того, не забудьте добавить сайт в закладки: [url=https://cultureinthecity.ru/]https://cultureinthecity.ru/[/url]
I am not real superb with English but I come up this really easy to translate.
Thank you great post. Hello Administ .国产线播放免费人成视频播放
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?
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me.兒童色情