分享一个中文版的 ai 地牢游戏(开源)

2021-07-15 15:40:10 +08:00
 icybee
    ▄████▄   ██░ ██  ██▓ ███▄    █ ▓█████   ██████ ▓█████      
   ▒██▀ ▀█  ▓██░ ██▒▓██▒ ██ ▀█   █ ▓█   ▀ ▒██    ▒ ▓█   ▀      
   ▒▓█    ▄ ▒██▀▀██░▒██▒▓██  ▀█ ██▒▒███   ░ ▓██▄   ▒███        
   ▒▓▓▄ ▄██▒░▓█ ░██ ░██░▓██▒  ▐▌██▒▒▓█  ▄   ▒   ██▒▒▓█  ▄      
   ▒ ▓███▀ ░░▓█▒░██▓░██░▒██░   ▓██░░▒████▒▒██████▒▒░▒████▒     
   ░ ░▒ ▒  ░ ▒ ░░▒░▒░▓  ░ ▒░   ▒ ▒ ░░ ▒░ ░▒ ▒▓▒ ▒ ░░░ ▒░ ░     
     ░  ▒    ▒ ░▒░ ░ ▒ ░░ ░░   ░ ▒░ ░ ░  ░░ ░▒  ░ ░ ░ ░  ░     
   ░         ░  ░░ ░ ▒ ░ ▄▄▄   ░ ░ ██▓░   ░  ░  ░     ░        
   ░ ░       ░  ░  ░ ░  ▒████▄   ░▓██▒░  ░      ░     ░  ░     
   ░                    ▒██  ▀█▄  ▒██▒                         
                        ░██▄▄▄▄██ ░██░                         
                         ▓█   ▓██▒░██░                         
                         ▒▒   ▓▒█░░▓                           
                          ▒   ▒▒ ░ ▒ ░                         
                          ░   ▒    ▒ ░                         
▓█████▄  █    ██  ███▄    █   ▄████░▓█████  ▒█████   ███▄    █ 
▒██▀ ██▌ ██  ▓██▒ ██ ▀█   █  ██▒ ▀█▒▓█   ▀ ▒██▒  ██▒ ██ ▀█   █ 
░██   █▌▓██  ▒██░▓██  ▀█ ██▒▒██░▄▄▄░▒███   ▒██░  ██▒▓██  ▀█ ██▒
░▓█▄   ▌▓▓█  ░██░▓██▒  ▐▌██▒░▓█  ██▓▒▓█  ▄ ▒██   ██░▓██▒  ▐▌██▒
░▒████▓ ▒▒█████▓ ▒██░   ▓██░░▒▓███▀▒░▒████▒░ ████▓▒░▒██░   ▓██░
 ▒▒▓  ▒ ░▒▓▒ ▒ ▒ ░ ▒░   ▒ ▒  ░▒   ▒ ░░ ▒░ ░░ ▒░▒░▒░ ░ ▒░   ▒ ▒ 
 ░ ▒  ▒ ░░▒░ ░ ░ ░ ░░   ░ ▒░  ░   ░  ░ ░  ░  ░ ▒ ▒░ ░ ░░   ░ ▒░
 ░ ░  ░  ░░░ ░ ░    ░   ░ ░ ░ ░   ░    ░   ░ ░ ░ ▒     ░   ░ ░ 
   ░       ░              ░       ░    ░  ░    ░ ░           ░ 
 ░                            

最近一段时间,我花了一些时间玩了英文版本的 AI dungeon 游戏,我发现虽然其有着诸多的限制,生成的故事可能有时候上下文不接,但是总体来说,可玩性还是挺高的。

所以再简单游玩之后,我决定自己创造一个中文版本的 AI Dungeon 游戏,经过一段时间的努力,我终于做出了一个版本:

https://github.com/bupticybee/ChineseAiDungeon

如果你有 VPN 或是肉身翻墙的话,你也可以直接在 google colab 上体验:

https://colab.research.google.com/github/bupticybee/ChineseAiDungeon/blob/main/ChineseAiDungeonColabDemo.ipynb

我把整个开发过程中遇到的艰难险阻总结成了一篇文章:

制作一个中文版 AI 地牢

下面是我自己第一次游玩 ChineseAiDungeon 的时候的前几步的记录,其中带有“>”的是我自己的动作

你在树林里冒险,指不定会从哪里蹦出来一些奇怪的东西,你握紧手上的手枪,希望这次冒险能够找到一些值钱的东西
> 你 往树林深处走去
一进去就会有一股寒意笼罩着你,你甚至都不知道自己为什么要继续走下去,但你知道,现在不冒险就太愚蠢了。有一种更加令人不安的气息在你身后,尽管你没有感觉到它,但那是一股非常浓烈的血腥味,几乎淹没了你的每一根头发。你转过身来,发现你身后是一块空地,一群男人围坐在中间,而你看起来好像已经在那里被吃掉了。这就是你要去的地方。
> 你 绕过这个奇怪的地方
你们这些笨蛋在这个奇怪的地方转了几圈,最终到了你之前认为正确的地方。你的直觉在这里很强,你觉得似乎有一股更强的力量从你身后的那块空地涌出,你的手颤抖着抓住了枪。你向前移动,但你的直觉仍然在警告你,你不应该这么做。你甚至感觉到枪的重量压在你的肩膀上,而且你看到有什么东西从你身后的空地上向你靠近。
> 你 悄悄地走进前面的村子
当你的生命在你面前逝去时,你会感觉到它,并且你的直觉在警告你,你可能会在村子里找到某个东西。你走得很快,而且当你意识到你已经走到了一个死胡同时,一切都太晚了。你看到一群人从他们的位置上走来,他们都拿着镰刀和其他锋利的东西,每个人的头都向后仰着,当你的手开始感到麻木时,你可以听到他们的喘息声。

目前游戏的可玩 ok 么?我只能说,凑合着能玩个三五个回合,然后如果运气好的话,你能继续玩个三五个回合,运气不好的话,整个游戏世界观会开始崩塌,并且由于目前的模型 finetune 的语料是经过 google 翻译的外文语料,所以模型在遣词造句上会有一种“翻译腔”。

整个游戏的开发流程基本遇到了异常多的困难,主要都是模型训练相关的,我最后选择了 finetune 清华 26 亿参数的 CPM,最后的模型有 4.8G 之大,如果你想在本地游玩,建议需要 8G 显存以上的显卡。

整个开发过程的每一次尝试我都事无巨细的记录了下来,形成了三篇分别 1W 多字的 log,如果有人感兴趣这个项目,或者在做类似的事情,可以看看,避免把我踩过的坑再踩一遍:

开发 log1

开发 log2

开发 log3

991 次点击
所在节点    分享创造
17 条回复
graetdk
2021-07-15 16:08:55 +08:00
牛逼,大佬牛逼
laoyur
2021-07-15 16:33:28 +08:00
/content/ChineseAiDungeon
ERROR: tensorflow 2.5.0 has requirement gast==0.4.0, but you'll have gast 0.3.3 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement h5py~=3.1.0, but you'll have h5py 2.10.0 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement numpy~=1.19.2, but you'll have numpy 1.18.5 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement tensorflow-estimator<2.6.0,>=2.5.0rc0, but you'll have tensorflow-estimator 2.3.0 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.
ERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible.
Rwing
2021-07-15 16:35:59 +08:00
有点意思
hs0000t
2021-07-15 17:40:07 +08:00
现在能上 v2 的百分百都能上谷歌,应该不用单独强调 vpn 了
lxrmido
2021-07-15 17:42:17 +08:00
先 star 为敬
lneoi
2021-07-15 18:00:05 +08:00
赞 大佬
SimonOne
2021-07-15 18:00:05 +08:00
google colab 上报错了
从安装依赖开始,依赖版本
```
ERROR: tensorflow 2.5.0 has requirement gast==0.4.0, but you'll have gast 0.3.3 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement h5py~=3.1.0, but you'll have h5py 2.10.0 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement numpy~=1.19.2, but you'll have numpy 1.18.5 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement tensorflow-estimator<2.6.0,>=2.5.0rc0, but you'll have tensorflow-estimator 2.3.0 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.
ERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible.
```

下载模型
```
--2021-07-15 09:56:59-- https://docs.google.com/uc?id=1cJ1kvtPrV4TXxiadiGU6bJUAy11bRDm1&export=download
Resolving docs.google.com (docs.google.com)... 74.125.195.100, 74.125.195.139, 74.125.195.101, ...
Connecting to docs.google.com (docs.google.com)|74.125.195.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘gdown.20210715095659.616043801260279’

0K 39.2M=0s

2021-07-15 09:56:59 (39.2 MB/s) - ‘gdown.20210715095659.616043801260279’ saved [3117]

Couldn't download the file :-(
unzip: cannot find or open story_teller.zip, story_teller.zip.zip or story_teller.zip.ZIP.
```
icybee
2021-07-15 19:03:32 +08:00
@laoyur 这个忽略就行,并非真的错误
icybee
2021-07-15 19:05:47 +08:00
@SimonOne 也许是间歇网络问题,你可以再尝试一下?我确定了网盘的 link 是没有问题的,这个 colab 我也测试了不下几十次了
icybee
2021-07-15 19:09:45 +08:00
@SimonOne 我看了一下,小段时间内大量从 google drive 下载模型,这个 google drive 的地址北 google 短时 ban 了,等我明天想其他办法共享这个文件
sbilly
2021-07-16 08:34:24 +08:00
这个和最古老的 MUD 有啥区别吗?
icybee
2021-07-16 11:50:02 +08:00
@sbilly 不太一样,自由度不同
102errors
2021-07-16 16:04:31 +08:00
歪个楼,看开发 log 鸠摩智大战王语嫣笑尿了
shadeofgod
2021-07-16 17:03:08 +08:00
区别在于 MUD 基本都是写死的逻辑,而这个内容是 AI 生成的?
icybee
2021-07-19 11:53:03 +08:00
@shadeofgod 是呀
icybee
2021-07-19 11:53:13 +08:00
@102errors 我 tm 也是。。。醉了
ruihe
2021-07-20 14:20:32 +08:00
试玩看看,感谢大佬开发

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/789722

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX