瑞克|用GPT-2做个“姥爷”!57行代码给《瑞克和莫蒂》写新剧集( 四 )
{'generated_text': 'The man worked as a waiter in a cafe near'},
{'generated_text': 'The man worked as a chef in a strip mall'}]>>> set_seed(42)
>>> generator("The woman worked as a", max_length=10, num_return_sequences=5)[{'generated_text': 'The woman worked as a waitress at a Japanese restaurant'},
{'generated_text': 'The woman worked as a waitress at a local restaurant'},
{'generated_text': 'The woman worked as a waitress at the local supermarket'},
{'generated_text': 'The woman worked as a nurse in a health center'},
{'generated_text': 'The woman worked as a maid in Daphne'}]
我强烈建议读者谨慎考虑相关模型在现实场景中的应用 。 关于机器学习在伦理道德方面的问题 , 例如EML , AINow等社区还有很多可供参考的内容 。
结论 恭喜!看到这里 , 你的应用已经具备上线能力了 。
借助一些开源的框架 , 我们得以实现GPT2模型的快速调教 , 并制作出有趣的应用原型 , 接着部署使用模型 。 模型生成的故事还能被进一步润色 , 借助其他具有更多高级功能的模型 , 解码方法甚至语言预测构架 , 都能让故事变得更精彩 。
欢迎大家到Github测试和查看关于此项目的更多信息 。
https://github.com/e-tony/Story_Generator
https://share.streamlit.io/e-tony/story_generator/main/app.py
相关参考:
[1]: GPT2(https://github.com/openai/gpt-2)
[2]: The Top 30 Gpt2 Open Source Projects(https://awesomeopensource.com/projects/gpt-2)
[3]: The State of Transfer Learning in NLP(https://ruder.io/state-of-transfer-learning-in-nlp/)
[4]: Top 1,000 domains present in WebText(https://github.com/openai/gpt-2/blob/master/domains.txt)
[5]: A. Radford, Jeffrey Wu, R. Child, David Luan, Dario Amodei, and Ilya Sutskever 2019. Language Models are Unsupervised Multitask Learners.
[6]: Better Language Models and Their Implications(https://openai.com/blog/better-language-models/)
[7]: The Illustrated GPT-2 (Visualizing Transformer Language Models)(http://jalammar.github.io/illustrated-gpt2/)
[8]: Model sharing and uploading(https://huggingface.co/transformers/model_sharing.html)
[9]: How to generate text: using different decoding methods for language generation with Transformers(https://huggingface.co/blog/how-to-generate)
[10]: Deploy an app(https://docs.streamlit.io/en/stable/deploy_streamlit_app.html)
[11]: The Institute for Ethical AI & Machine Learning(https://ethical.institute/)
[12]: AI Now Institute (https://ainowinstitute.org/ )
相关报道:
https://towardsdatascience.com/rick-and-morty-story-generation-with-gpt2-using-transformers-and-streamlit-in-57-lines-of-code-8f81a8f92692
推荐阅读
- 明星八卦|应采儿二胎恢复身材,曾经直言想生女儿,做个“宠女狂魔”
- 周震南|周震南,做个孝子,真的很难吗?
- 来长沙|成毅10月26号录制《快本》!女主袁冰妍缺席,矛盾加剧,姜磊做个人?
- 厨房|参观演员周杰如今的家,厨房做个玻璃吊顶,室内也能享受户外阳光