GAN生成古诗词:拙劣但是高效的模仿

  1. 背景

    人工智能在提出之时,人们就希望计算机能像人一样看(计算机视觉)、像人一样听(语音识别)、像人一样说(语言合成)、像人一样写(自然语言生成)。如果一个人无法区分计算机生成的语言、人类写的语言,那么就说明计算机已经具备人类一样的思维能力了。

    而在早期,古诗词的生成模型包括:(1)随机生成模型:词语进行随机组合和堆砌,这样生成的古诗词往往不符合语法要求;(2)基于模板和模式的方法,这种方法生成的古诗词质量较高,但是可扩展性、灵活性很差;(3)基于遗传算法、摘要生成、统计机器翻译的算法。最近的古诗词生成算法主要是基于神经网络模型。从简单的RNN到层次化、添加Attention、基于规划、迭代求精的复杂神经网络,再到基于GAN的古诗词生成模型。基于神经网络的模型利用了神经网络强大的建模能力,生成的古诗词流畅性很好。

    代码:这里

  2. 模型

    2.1 普通的最大似然模型

    简单的MLE模型[1],核心部件在于RNN(可以是LSTM、GRU等),根据内部的状态向量、以及上一次输出的字符,来更新状态,并且产生输出。即

        \[h_j = RNN(h_{i-1}, Ey_{i-1})\]

        \[p=softmax(h_i)\]

        \[y_i =sample(p)\]

    而hi则是状态,这边的E表示字符的embedding,将每个字符都映射到一个向量。yi则是输出的字符,使用一个softmax计算字典中的字符作为输出的概率,并从中采样得到输出的字符。这样不断迭代产生每个字符。我们使用一个特殊字符作为古诗的开始,使用一个字符来表示古诗的结束。

    训练的时候,通过最大化训练样本的似然值来得到。即:

        \[L = \sum_{d\in D}\sum_{w_i\in d} \log (p(w_i))\]

    2.2 GAN模型

    GAN模型[2]使用不同的一个目标函数。它拥有一个生成器、一个判别器。判别器尽量从所有的古诗词中识别出真实的古诗词,而生成器尽量生成能够骗过判别器的古诗词。两者通过玩一个min-max的游戏,不断提高生成古诗词的质量。详细原理参见:

    http://www.hackcha.cn/?p=190

  3. 结果

    有部分研究使用了BLEU对生成结果进行评价。但是BLEU这个指标本身并不能反映生成古诗词的质量。因此我们直接看生成的古诗词。

    最大似然模型生成的结果:

    乱岸危牛顶上收,曲桥流处又从畴。早秋醉著鸬鹚侣,信酒非闲语让钱。

    夜枕溪帆来入寺,茫茫拍水近湖山。正向无如鞭织客,何人骤雨洒春时。

    知公虽此物,千载与谁施。子食耄迟少,恩功石上开。神渊阴不喻,故帅转沧波。艰事纷足虑,吾徒不可遑。

    舟上朝阳一易程,流波不动更登一。由来有俗怀人稳,唤得槐滩具柄长。

    江水明头向层树,柴亭春日幽情。几从未审去年,世外如何九万钱。

    说实话,这些诗词看上去有些不明觉厉。有意思的是,这个模型并没有强制要求押韵,但是计算机却从数据中自动学会了押韵。

    预训练的GAN模型生成的古诗词样本:

    一声拍知罗,对此心如影,照。落水声杳,拍手。
    三五斗门扃,艾檀助仙风。
    默闻今然水两耳,困来网步未惊起。画手见,相忘在天,至今合在沧海。
    物情虚寂自明遥,先过纱窗不作文。
    临边升月,空汉用追。著维去藏,无鉤。欲昏君在,天下葵龙归。

    训练好的GAN模型生成的古诗词样本:

    云微无踪。家家出苍天。红林酒,不著工书钓手经。弄著头头颇足。醉归舍市。
    微回数叶青苔遍,无佛书。火星万重黄金。殃投。邪家绝。吾耶江后。而今活。踏雪千回万里。天人方背语。万机
    草木垂垂空殷通。诗坛下与有谈诗。花仙字然称更敏。我书今望何名尝。
    朝阳,挥丝尘上几回旋。元无诗,须烦子正雨撞。驴。勿言方别。
    悠悠亭亭何翅分。二分鼓声创。予行苦未息。巢断。正念松声。正须诗坛老更良。
    诗坛近公车引得。火暖。空休相照自珍。也无款段日明晚居,可以酌君风味。

    可以看出GAN模型生成的结果反而不如MLE模型,可能是因为判别器使用的是CNN模型,很难捕捉句子的连贯性。另外GAN模型的不稳定性也可能是原因。我们将继续调试这个GAN模型。

  4. 总结

    很多人批评计算机生成的古诗词虽然像模像样,但是缺少一丝灵动。但是计算机生成古诗词的模型训练速度十分快,大约几十分钟就能写出像模像样的古诗,而人类要学习几年时间,这是十分可怕的。而且人类往往需要灵感才能写出一首诗,而计算机利用随机数就可以产生古诗词,它不需要什么灵感。计算机不像人类,随着年龄增长会衰老、精力能力与才华会下降、还会死亡,一个程序、一个模型可以长久不变的存在,而且可以迅速的传播与复制。就像工业化革命刚开始的时候,由机器制作的产品可能没有手工制作的精细,但是在机器强大生产力、快速的更新速度面前,手工业的市场只能被无情的侵蚀。

    可以说很难找到一个评价指标来方便的评价生成的古诗词质量,而如果还要考虑艺术性的话,就更加难了。这也是古诗词生成模型发展中的一个阻碍。

  5. 参考文献

    [1] http://m.blog.csdn.net/longji/article/details/75194990 (代码:https://github.com/5455945/tensorflow_demo

    [2] Yu, Lantao, et al. “SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient.”?AAAI. 2017. (代码: https://github.com/LantaoYu/SeqGAN)

    [3] 更多模型:http://www.sohu.com/a/125440908_500659

1,040 评论

  1. Pingback: Nike Outlet
  2. Pingback: Nike Shoes
  3. Pingback: Yeezy
  4. Pingback: Nike Outlet Store
  5. Pingback: Yeezy Shoes
  6. Pingback: Travis Scott jordan 1
  7. Pingback: Yeezy 350
  8. Pingback: tenis adidas top ten
  9. Pingback: Yeezy
  10. Pingback: Yeezy 350
  11. Pingback: Cheap NFL Jerseys
  12. Pingback: trustedmdstorefy.com
  13. Pingback: bofilm ???èà?
  14. Pingback: bofilm
  15. Pingback: 1 seriya
  16. Pingback: Yeezy Boost 350
  17. Pingback: topedstoreusa.com
  18. Pingback: viagramdtrustser.com
  19. Pingback: lindamedic.com
  20. Pingback: 4serial.com
  21. Pingback: See-Season-1
  22. Pingback: Evil-Season-1
  23. Pingback: Evil-Season-2
  24. Pingback: Evil-Season-3
  25. Pingback: Evil-Season-4
  26. Pingback: Dollface-Season-1
  27. Pingback: Yeezy Boost 380
  28. Pingback: Nike Outlet
  29. Pingback: Nike Outlet
  30. Pingback: Yeezy
  31. Pingback: serial 2020
  32. Pingback: Dailymotion
  33. Pingback: Watch+movies+2020
  34. Pingback: kids size 7
  35. Pingback: Human Race Shoes
  36. Pingback: serial
  37. Pingback: Yeezy
  38. Pingback: tvrv.ru
  39. Pingback: 1plus1serial.site
  40. Pingback: #1plus1
  41. Pingback: 1plus1
  42. Pingback: 2020
  43. Pingback: UGGS Official
  44. Pingback: rack a verre a vin
  45. Pingback: Watch Movies Online
  46. Pingback: Film
  47. Pingback: Film 2020
  48. Pingback: Film 2021
  49. Pingback: watch online TV LIVE
  50. Pingback: Human Races
  51. Pingback: nike mercurial grigie
  52. Pingback: air max release
  53. Pingback: Yeezy
  54. Pingback: human design
  55. Pingback: dizajn cheloveka
  56. Pingback: Yeezy Boost 350
  57. Pingback: fila jake 2 jacket
  58. Pingback: koma 2020
  59. Pingback: The-Gentlemen
  60. Pingback: led-2
  61. Pingback: pod-vodoi
  62. Pingback: jubileumjaar 10 jaar
  63. Pingback: vk 2020
  64. Pingback: calecon homme lacoste
  65. Pingback: parazity-oskar-2020
  66. Pingback: NBA Jerseys
  67. Pingback: bryllupskjoler
  68. Pingback: Nike Shoes
  69. Pingback: NBA Jerseys
  70. Pingback: Pandora Outlet Online
  71. Pingback: Pandora Canada
  72. Pingback: NBA Jerseys
  73. Pingback: Yeezy 700
  74. Pingback: Yeezy 380
  75. Pingback: Pandora
  76. Pingback: Pandora Jewelry
  77. Pingback: DSmlka
  78. Pingback: viagra
  79. Pingback: viagra online
  80. Pingback: +
  81. Pingback: MLB Jerseys
  82. Pingback: 拧kornji do kolena
  83. Pingback: ?jak Son?k
  84. Pingback: astrolog
  85. Pingback: MLB Jerseys
  86. Pingback: the 膷erven茅 bunda
  87. Pingback: steve madden skechers
  88. Pingback: scarpe vans rosse
  89. Pingback: watch online
  90. Pingback: air max mens uk
  91. Pingback: maxi jumper vestito
  92. Pingback: Pandora Charms
  93. Pingback: islender genser herre
  94. Pingback: cars camion mack
  95. Pingback: ulvang genser dame
  96. Pingback: pobachennya u vegas
  97. Pingback: Proshanie so Stalinym
  98. Pingback: funda huawei ale l21
  99. Pingback: bolso deportivo rosa
  100. Pingback: puma ugly sneakers
  101. Pingback: patike hoops vs mid
  102. Pingback: Adidas Yeezy
  103. Pingback: dernier kenzo femme
  104. Pingback: strelcov 2020
  105. Pingback: film t-34
  106. Pingback: canadian pharmacy
  107. Pingback: Nike Air Max 270
  108. Pingback: Kobe Bryant Jerseys
  109. Pingback: Nike Air Force 1
  110. Pingback: Yeezy Shoes
  111. Pingback: rozsdamentes b枚gre
  112. Pingback: Air Force 1
  113. Pingback: Beograd film 2020
  114. Pingback: nike blazer girls
  115. Pingback: cmp skijacke wei脽
  116. Pingback: psiholog
  117. Pingback: psixolog
  118. Pingback: diesel horloge dz4180
  119. Pingback: puma tsugi apex
  120. Pingback: scholl claquette
  121. Pingback: harden be 2 blanca
  122. Pingback: nike sb gucci low
  123. Pingback: hugo boss sandals
  124. Pingback: PSYCHOSOCIAL
  125. Pingback: rock and roll shirts
  126. Pingback: turiviaje
  127. Pingback: sitesvtt
  128. Pingback: murziez
  129. Pingback: rtnplus
  130. Pingback: pravolib
  131. Pingback: fbcont
  132. Pingback: bermaee
  133. Pingback: caribhash
  134. Pingback: tiawards
  135. Pingback: radiusm
  136. Pingback: kiuhoki
  137. Pingback: tlazohtla
  138. Pingback: ufcfree
  139. Pingback: moviezpk
  140. Pingback: bmrocks
  141. Pingback: urtubei
  142. Pingback: Cherekasi
  143. Pingback: feqahat
  144. Pingback: laviafla
  145. Pingback: boncareusa
  146. Pingback: brucelaval
  147. Pingback: pacombat
  148. Pingback: trinauinc
  149. Pingback: madisllc
  150. Pingback: sqsmgs
  151. Pingback: mpishere
  152. Pingback: scribchats
  153. Pingback: evapter
  154. Pingback: sorrowline
  155. Pingback: solerbe
  156. Pingback: coreydc
  157. Pingback: deisida
  158. Pingback: detikwin
  159. Pingback: depoindo
  160. Pingback: romanoilo
  161. Pingback: norcalsba
  162. Pingback: ecmsracin
  163. Pingback: ediquid
  164. Pingback: simetube
  165. Pingback: bgbonus
  166. Pingback: mcsnetzone
  167. Pingback: flaflooga
  168. Pingback: bsfturf
  169. Pingback: sanbilizi
  170. Pingback: film djoker
  171. Pingback: chicloca
  172. Pingback: fanilista
  173. Pingback: tatilcitur
  174. Pingback: djenga
  175. Pingback: magista rosse
  176. Pingback: fsweny
  177. Pingback: viagra 100mg
  178. Pingback: glogon
  179. Pingback: bowiet
  180. Pingback: buty marco tozzi 2013
  181. Pingback: hokimerah
  182. Pingback: swdhaka
  183. Pingback: tbconnor
  184. Pingback: cpacurrie
  185. Pingback: natiasud
  186. Pingback: hopcoz
  187. Pingback: mrchiizu
  188. Pingback: stcglaw
  189. Pingback: nissancl
  190. Pingback: bordalba
  191. Pingback: cowesfc
  192. Pingback: wish cover iphone 7
  193. Pingback: battlebrik
  194. Pingback: taylorsifts
  195. Pingback: monsterants
  196. Pingback: sksiberians
  197. Pingback: nautsat
  198. Pingback: cazoletos
  199. Pingback: bliss orologi
  200. Pingback: nlmkorea
  201. Pingback: Air Max 270
  202. Pingback: hotlimon
  203. Pingback: sehrinet
  204. Pingback: hultcos
  205. Pingback: duetosa
  206. Pingback: hilbahis
  207. Pingback: sericorse
  208. Pingback: baotinhoc
  209. Pingback: farsmizban
  210. Pingback: soanuncios
  211. Pingback: nlmczech
  212. Pingback: magista obra 1
  213. Pingback: kmcases
  214. Pingback: yossi harari manteaux
  215. Pingback: nsihorwitz
  216. Pingback: Hanging Bird House
  217. Pingback: eshwrites
  218. Pingback: sumafood
  219. Pingback: kaewwern
  220. Pingback: limoind
  221. Pingback: kreshme
  222. Pingback: Soldes Pandora 2020
  223. Pingback: hondaview
  224. Pingback: maeblooms
  225. Pingback: wizdomav
  226. Pingback: kamillesk
  227. Pingback: flaresco
  228. Pingback: ferrisstore
  229. Pingback: Nike Shoes
  230. Pingback: romeo gigli pigiami
  231. Pingback: nike zoom shoe
  232. Pingback: virusloft
  233. Pingback: petite xxs dresses
  234. Pingback: dkebabs
  235. Pingback: generic viagra
  236. Pingback: buy viagra online
  237. Pingback: faithask
  238. Pingback: dominiclb
  239. Pingback: Nike Air Max 97
  240. Pingback: enkuri
  241. Pingback: zonagg
  242. Pingback: federe gabel
  243. Pingback: vesissb
  244. Pingback: rsbengg
  245. Pingback: cellardoves
  246. Pingback: muroumido
  247. Pingback: hrat hry online
  248. Pingback: webmanisa
  249. Pingback: rinajordi
  250. Pingback: darzarzis
  251. Pingback: foto carta di credito
  252. Pingback: brandiali
  253. Pingback: monobrot
  254. Pingback: casse db attive
  255. Pingback: croncas
  256. Pingback: copper bend
  257. Pingback: busbar line
  258. Pingback: cnc punching machine
  259. Pingback: Busway System machine
  260. Pingback: punching machine
  261. Pingback: busbar punching
  262. Pingback: cnc punch machine
  263. Pingback: busbar machine
  264. Pingback: busway machine
  265. Pingback: copper busbar machine
  266. Pingback: Bus Bar Punching Tool
  267. Pingback: panel bending machine
  268. Pingback: bus bar shear
  269. Pingback: bus bar line
  270. Pingback: cnc busbar cut
  271. Pingback: cnc busbar machines
  272. Pingback: bus bar machine
  273. Pingback: cnc punching machines
  274. Pingback: Busway machine
  275. Pingback: auto bender machine
  276. Pingback: copper pipe bender
  277. Pingback: gliclub
  278. Pingback: Soldes Pandora 2020
  279. Pingback: visitfame
  280. Pingback: directscl
  281. Pingback: bezvabeh
  282. Pingback: norcodrene
  283. Pingback: scriptmask
  284. Pingback: Kobe Jersey
  285. Pingback: ratutoto
  286. Pingback: uzmanpet
  287. Pingback: natovka
  288. Pingback: vnuwill
  289. Pingback: luisagaton
  290. Pingback: bluzka polo m臋ska
  291. Pingback: wernerskl
  292. Pingback: fitraves
  293. Pingback: florisha
  294. Pingback: mazdakism
  295. Pingback: vizcake
  296. Pingback: hanoibnb
  297. Pingback: nasirahoori
  298. Pingback: ehsonh
  299. Pingback: baankru
  300. Pingback: mundeinc
  301. Pingback: mersinmasoz
  302. Pingback: sasosauces
  303. Pingback: boncarry
  304. Pingback: swccpa
  305. Pingback: martinraes
  306. Pingback: simtivo
  307. Pingback: design jalkalamput
  308. Pingback: dorisburke
  309. Pingback: pull moche noel gemo
  310. Pingback: tomecko
  311. Pingback: cgahio
  312. Pingback: envifoam
  313. Pingback: 煤prava vzduchu
  314. Pingback: matuteo
  315. Pingback: ciruscg
  316. Pingback: ?í?àéí ??è?????
  317. Pingback: tesco pink raincoat
  318. Pingback: lussaro
  319. Pingback: nlmluo
  320. Pingback: siselup
  321. Pingback: svbola
  322. Pingback: thinkeet
  323. Pingback: vekiltv
  324. Pingback: tufcards
  325. Pingback: fire fighting suit
  326. Pingback: twaitor
  327. Pingback: ewgaar
  328. Pingback: jalkapallo tokmanni
  329. Pingback: hariharagro
  330. Pingback: balzacmall
  331. Pingback: songkolo
  332. Pingback: about us lilly lashes
  333. Pingback: daarolelm
  334. Pingback: basket lacoste 2019
  335. Pingback: ductails
  336. Pingback: limooh
  337. Pingback: lastpil
  338. Pingback: tostseks
  339. Pingback: m and co fashion
  340. Pingback: viagra coupons
  341. Pingback: produtos promo莽茫o
  342. Pingback: viagra generic
  343. Pingback: viagra pill
  344. Pingback: otc viagra
  345. Pingback: cariobat
  346. Pingback: ersions
  347. Pingback: jersey holgado
  348. Pingback: extension nails
  349. Pingback: tetlanews
  350. Pingback: lalki do kupienia
  351. Pingback: kabreeta
  352. Pingback: 啪ehli膷ky na vlasy
  353. Pingback: gold bathroom faucet
  354. Pingback: siti di macchine
  355. Pingback: stcoso
  356. Pingback: flindey
  357. Pingback: bras and girdles pics
  358. Pingback: elhosh
  359. Pingback: celiatys
  360. Pingback: antenn till bil
  361. Pingback: vapaat ajat
  362. Pingback: rowenta r03753
  363. Pingback: samsung vyrobky
  364. Pingback: linterna para camping
  365. Pingback: kombinezon w paski
  366. Pingback: completo da corsa
  367. Pingback: mey badehose
  368. Pingback: bitly.com
  369. Pingback: botines boho flecos
  370. Pingback: kombinalt gaztuzhely
  371. Pingback: gucci soho tote bags
  372. Pingback: bl氓 safir sten
  373. Pingback: 煤sz谩s wikip茅dia
  374. Pingback: w mini bailey bow ii
  375. Pingback: skechers boys sandals
  376. Pingback: Earthlings 2005
  377. Pingback: obaly na notebook
  378. Pingback: online pharmacy
  379. Pingback: klopbali
  380. Pingback: wtmiradio
  381. Pingback: sertce
  382. Pingback: turkrotts
  383. Pingback: eleandrah
  384. Pingback: pulsastar
  385. Pingback: ureditor
  386. Pingback: limademi
  387. Pingback: meduzapw
  388. Pingback: dictatorcms
  389. Pingback: mobehowto
  390. Pingback: viettoi
  391. Pingback: braporno
  392. Pingback: ezperdeim
  393. Pingback: loserdad
  394. Pingback: tmfeatures
  395. Pingback: miuidy
  396. Pingback: lroseinc
  397. Pingback: snapcre
  398. Pingback: mimirobic
  399. Pingback: mealspeal
  400. Pingback: susanavello
  401. Pingback: elainewlane
  402. Pingback: valizze
  403. Pingback: lewilou
  404. Pingback: buildemo
  405. Pingback: flamepm
  406. Pingback: baileysms
  407. Pingback: viasalta
  408. Pingback: zeubros
  409. Pingback: selltcr
  410. Pingback: vindefruit
  411. Pingback: flowkati
  412. Pingback: gparmc
  413. Pingback: bilabeela
  414. Pingback: larmovie
  415. Pingback: smilepronto
  416. Pingback: bafuinn
  417. Pingback: betasahm
  418. Pingback: tazenin
  419. Pingback: qmcdot
  420. Pingback: gusmeasu.com
  421. Pingback: Dom 2
  422. Pingback: brennanoil
  423. Pingback: evrofinans
  424. Pingback: Cherkassy
  425. Pingback: batmanapollo.ru
  426. Pingback: sillypea
  427. Pingback: sockcop
  428. Pingback: itcolate
  429. Pingback: sarangbang
  430. Pingback: siames
  431. Pingback: civasclinic
  432. Pingback: nashekafe
  433. Pingback: cuenco
  434. Pingback: buzzages
  435. Pingback: cullmannaz
  436. Pingback: esitelecom
  437. Pingback: koduvein
  438. Pingback: conzones
  439. Pingback: viaishere
  440. Pingback: dmmllaw
  441. Pingback: entkalker
  442. Pingback: glennraps
  443. Pingback: mandrait
  444. Pingback: daaelite
  445. Pingback: marganza
  446. Pingback: visvita
  447. Pingback: cotmanip
  448. Pingback: fullonrad
  449. Pingback: discnerd
  450. Pingback: zombess
  451. Pingback: horntees
  452. Pingback: hscuae
  453. Pingback: neteuros
  454. Pingback: alberco
  455. Pingback: haresmoor
  456. Pingback: samisuka
  457. Pingback: csmfirm
  458. Pingback: cowsunite
  459. Pingback: cosuisse
  460. Pingback: hurlabs
  461. Pingback: calusseau
  462. Pingback: dom2 ru
  463. Pingback: seesjobs
  464. Pingback: wilbanksel
  465. Pingback: motalefeh
  466. Pingback: sfllaw
  467. Pingback: mdroster
  468. Pingback: Tenet Online
  469. Pingback: eduworlds
  470. Pingback: napscorp
  471. Pingback: urbanhit
  472. Pingback: opensats
  473. Pingback: torrentmr
  474. Pingback: haloresi
  475. Pingback: meetpukie
  476. Pingback: langlerol
  477. Pingback: eduzhituo
  478. Pingback: proelbra
  479. Pingback: mimsstores
  480. Pingback: sueflowers
  481. Pingback: codingmedia
  482. Pingback: netlinebr
  483. Pingback: leanlaw
  484. Pingback: boredgourd
  485. Pingback: sibelicious
  486. Pingback: eastoverfc
  487. Pingback: dfmfit
  488. Pingback: mersinulus
  489. Pingback: fromeaparty
  490. Pingback: gizmoart
  491. Pingback: napelinos
  492. Pingback: sakshotel
  493. Pingback: borinsel
  494. Pingback: marineclean
  495. Pingback: psy psy psy psy
  496. Pingback: freimap
  497. Pingback: radiocci
  498. Pingback: madspo
  499. Pingback: leomedicus

发表评论