1. 程式人生 > >DL之RNN:基於TF利用RNN演算法實現~機器為你寫詩~、訓練&測試過程全記錄

DL之RNN:基於TF利用RNN演算法實現~機器為你寫詩~、訓練&測試過程全記錄

DL之RNN:基於TF利用RNN演算法實現~機器為你寫詩~、測試過程全記錄

輸出結果

模型監控

訓練、測試過程全記錄

1、訓練過程

2018-10-13 18:17:33.385001: 
step: 10/10000...  loss: 6.6367...  0.4602 sec/batch
step: 20/10000...  loss: 6.4675...  0.2812 sec/batch
step: 30/10000...  loss: 6.2554...  0.3108 sec/batch
step: 40/10000...  loss: 6.1900...  0.2376 sec/batch
step: 50/10000...  loss: 6.0126...  0.3038 sec/batch
step: 60/10000...  loss: 5.7821...  0.2998 sec/batch
step: 70/10000...  loss: 5.6963...  0.2542 sec/batch
step: 80/10000...  loss: 5.6749...  0.2928 sec/batch
step: 90/10000...  loss: 5.6518...  0.3264 sec/batch
step: 100/10000...  loss: 5.5647...  0.3088 sec/batch
step: 110/10000...  loss: 5.5877...  0.2873 sec/batch
step: 120/10000...  loss: 5.5239...  0.3058 sec/batch
step: 130/10000...  loss: 5.4690...  0.3108 sec/batch
step: 140/10000...  loss: 5.4297...  0.3128 sec/batch
step: 150/10000...  loss: 5.4575...  0.4156 sec/batch
step: 160/10000...  loss: 5.5059...  0.2652 sec/batch
step: 170/10000...  loss: 5.3785...  0.2933 sec/batch
step: 180/10000...  loss: 5.4277...  0.3063 sec/batch

……

step: 880/10000...  loss: 5.1948...  0.2762 sec/batch
step: 890/10000...  loss: 5.1261...  0.2873 sec/batch
step: 900/10000...  loss: 5.1300...  0.2833 sec/batch
step: 910/10000...  loss: 5.0745...  0.2948 sec/batch
step: 920/10000...  loss: 5.1045...  0.3018 sec/batch
step: 930/10000...  loss: 5.2051...  0.2958 sec/batch
step: 940/10000...  loss: 5.1699...  0.2812 sec/batch
step: 950/10000...  loss: 5.1527...  0.2767 sec/batch
step: 960/10000...  loss: 5.0440...  0.2286 sec/batch
step: 970/10000...  loss: 5.0983...  0.2707 sec/batch
step: 980/10000...  loss: 5.0330...  0.2772 sec/batch
step: 990/10000...  loss: 5.0191...  0.2903 sec/batch
step: 1000/10000...  loss: 5.1237...  0.3650 sec/batch

……

step: 1500/10000...  loss: 4.9121...  0.2782 sec/batch
step: 1510/10000...  loss: 5.0529...  0.2858 sec/batch
step: 1520/10000...  loss: 4.9125...  0.3158 sec/batch
step: 1530/10000...  loss: 5.0323...  0.3815 sec/batch
step: 1540/10000...  loss: 4.9778...  0.2998 sec/batch
step: 1550/10000...  loss: 4.9689...  0.2913 sec/batch
step: 1560/10000...  loss: 4.9578...  0.2893 sec/batch
step: 1570/10000...  loss: 4.9978...  0.3484 sec/batch
step: 1580/10000...  loss: 4.9212...  0.3600 sec/batch
step: 1590/10000...  loss: 4.9192...  0.3249 sec/batch
step: 1600/10000...  loss: 4.9894...  0.3840 sec/batch
step: 1610/10000...  loss: 5.0318...  0.2898 sec/batch
step: 1620/10000...  loss: 4.9138...  0.2802 sec/batch
step: 1630/10000...  loss: 4.9118...  0.3399 sec/batch
step: 1640/10000...  loss: 5.0006...  0.3033 sec/batch
step: 1650/10000...  loss: 4.8937...  0.2823 sec/batch
step: 1660/10000...  loss: 5.0560...  0.3314 sec/batch
step: 1670/10000...  loss: 4.9257...  0.2792 sec/batch
step: 1680/10000...  loss: 4.8630...  0.3760 sec/batch
step: 1690/10000...  loss: 4.8199...  0.3173 sec/batch
step: 1700/10000...  loss: 4.8728...  0.2953 sec/batch
step: 1710/10000...  loss: 5.0206...  0.3650 sec/batch
step: 1720/10000...  loss: 4.9802...  0.2787 sec/batch
step: 1730/10000...  loss: 4.8445...  0.2873 sec/batch
step: 1740/10000...  loss: 4.9073...  0.2983 sec/batch
step: 1750/10000...  loss: 4.7376...  0.3439 sec/batch
step: 1760/10000...  loss: 4.8442...  0.4301 sec/batch
step: 1770/10000...  loss: 4.9248...  0.2898 sec/batch
step: 1780/10000...  loss: 4.9375...  0.3379 sec/batch
step: 1790/10000...  loss: 4.8835...  0.4507 sec/batch
step: 1800/10000...  loss: 5.0368...  0.3073 sec/batch
step: 1810/10000...  loss: 4.8238...  0.4407 sec/batch
step: 1820/10000...  loss: 4.8378...  0.3670 sec/batch
step: 1830/10000...  loss: 4.9642...  0.3304 sec/batch
step: 1840/10000...  loss: 4.8679...  0.2968 sec/batch
step: 1850/10000...  loss: 4.8601...  0.4552 sec/batch
step: 1860/10000...  loss: 4.9152...  0.2893 sec/batch
step: 1870/10000...  loss: 4.9601...  0.4116 sec/batch
step: 1880/10000...  loss: 4.9330...  0.3840 sec/batch
step: 1890/10000...  loss: 4.8675...  0.4171 sec/batch
step: 1900/10000...  loss: 4.8727...  0.3880 sec/batch
step: 1910/10000...  loss: 4.9400...  0.3680 sec/batch
step: 1920/10000...  loss: 4.9803...  0.3890 sec/batch
step: 1930/10000...  loss: 4.8836...  0.3128 sec/batch
step: 1940/10000...  loss: 4.9016...  0.3434 sec/batch
step: 1950/10000...  loss: 4.8163...  0.3875 sec/batch
step: 1960/10000...  loss: 4.9120...  0.3364 sec/batch
step: 1970/10000...  loss: 4.7214...  0.3098 sec/batch
step: 1980/10000...  loss: 4.8936...  0.3389 sec/batch
step: 1990/10000...  loss: 4.8005...  0.4021 sec/batch
step: 2000/10000...  loss: 4.8858...  0.3008 sec/batch

……

step: 5900/10000...  loss: 4.6880...  0.5114 sec/batch
step: 5910/10000...  loss: 4.7077...  0.4903 sec/batch
step: 5920/10000...  loss: 4.7587...  0.5836 sec/batch
step: 5930/10000...  loss: 4.6067...  0.4843 sec/batch
step: 5940/10000...  loss: 4.7075...  0.5114 sec/batch
step: 5950/10000...  loss: 4.7513...  0.5144 sec/batch
step: 5960/10000...  loss: 4.6112...  0.4592 sec/batch
step: 5970/10000...  loss: 4.7092...  0.4883 sec/batch
step: 5980/10000...  loss: 4.7447...  0.5936 sec/batch
step: 5990/10000...  loss: 4.6929...  0.5164 sec/batch
step: 6000/10000...  loss: 4.7032...  0.4362 sec/batch

……

step: 7900/10000...  loss: 4.6153...  0.5003 sec/batch
step: 7910/10000...  loss: 4.5710...  0.4592 sec/batch
step: 7920/10000...  loss: 4.6324...  0.4412 sec/batch
step: 7930/10000...  loss: 4.6098...  0.4642 sec/batch
step: 7940/10000...  loss: 4.6398...  0.5053 sec/batch
step: 7950/10000...  loss: 4.5828...  0.4863 sec/batch
step: 7960/10000...  loss: 4.5104...  0.3580 sec/batch
step: 7970/10000...  loss: 4.5820...  0.3148 sec/batch
step: 7980/10000...  loss: 4.6413...  0.4853 sec/batch
step: 7990/10000...  loss: 4.5735...  0.4592 sec/batch
step: 8000/10000...  loss: 4.6919...  0.4311 sec/batch

……

step: 9990/10000...  loss: 4.4604...  0.5084 sec/batch
step: 10000/10000...  loss: 4.5533...  0.3930 sec/batch

2、測試過程

訓練的資料集

1、大量的五言唐詩

寒隨窮律變,春逐鳥聲開。
初風飄帶柳,晚雪間花梅。
碧林青舊竹,綠沼翠新苔。
芝田初雁去,綺樹巧鶯來。
晚霞聊自怡,初晴彌可喜。
日晃百花色,風動千林翠。
池魚躍不同,園鳥聲還異。
寄言博通者,知予物外志。
一朝春夏改,隔夜鳥花遷。
陰陽深淺葉,曉夕重輕煙。
哢鶯猶響殿,橫絲正網天。
珮高蘭影接,綬細草紋連。
碧鱗驚棹側,玄燕舞檐前。
何必汾陽處,始復有山泉。
夏律昨留灰,秋箭今移晷。
峨嵋岫初出,洞庭波漸起。
桂白髮幽巖,菊黃開灞涘。
運流方可嘆,含毫屬微理。
寒驚薊門葉,秋髮小山枝。
鬆陰背日轉,竹影避風移。
提壺菊花岸,高興芙蓉池。
欲知涼氣早,巢空燕不窺。
山亭秋色滿,巖牖涼風度。
疏蘭尚染煙,殘菊猶承露。
古石衣新苔,新巢封古樹。
歷覽情無極,咫尺輪光暮。
慨然撫長劍,濟世豈邀名。
星旗紛電舉,日羽肅天行。
遍野屯萬騎,臨原駐五營。
登山麾武節,背水縱神兵。
在昔戎戈動,今來宇宙平。
翠野駐戎軒,盧龍轉征旆。
遙山麗如綺,長流縈似帶。
海氣百重樓,巖鬆千丈蓋。
茲焉可遊賞,何必襄城外。
玄兔月初明,澄輝照遼碣。
映雲光暫隱,隔樹花如綴。
魄滿桂枝圓,輪虧鏡彩缺。
臨城卻影散,帶暈重圍結。
駐蹕俯九都,停觀妖氛滅。
碧原開霧隰,綺嶺峻霞城。
煙峰高下翠,日浪淺深明。
斑紅妝蕊樹,圓青壓溜荊。
跡巖勞傅想,窺野訪莘情。
巨川何以濟,舟楫佇時英。
春蒐馳駿骨,總轡俯長河。
霞處流縈錦,風前漾卷羅。
水花翻照樹,堤蘭倒插波。
豈必汾陰曲,秋雲發棹歌。
重巒俯渭水,碧嶂插遙天。

……