Skip to content

权重参数,可以用这个权重参数跳过预训练阶段

Pre-release
Pre-release
Compare
Choose a tag to compare
@Neutron3529 Neutron3529 released this 21 Jul 16:15
· 14 commits to master since this release
994bcf7

生成样例(v0.0):

于焉悟平等,诚厌泉海
独有青草诗,宁知大鹏

在称不足之,尔惧何由
抚心出杉山,高视网吾

静示天壤俗,真无尧舜
遭放祃似雷,甘为酒中

魑魅临远岫,崒落限远
岧峣驱虎源,诡怯心灌

用法:
可以将def loss(labels, logits):这一行开始到history = model.fit(dataset, epochs=EPOCHS, callbacks=[checkpoint_callback])结束的代码替换成下列代码,之后执行def generate_text以及后面的语句进行文本生成

model = build_model(vocab_size, embedding_dim, rnn_units, batch_size=1)
model.load_weights('PATH_TO_UNZIP\\release-0')
model.build(tf.TensorShape([1, None]))

v0.0与v1.0结构不完全相同,使用相同参数会带来额外风险
另,由于v0.1尝试使用/禁止使用dropout,在模型上会略有差异,当Python提示:

W0723 00:52:43.064463 6828 base.py:273] Inconsistent references when loading the checkpoint into this object graph. Either the Trackable object references in the Python program have changed in an incompatible way, or the checkpoint was generated in an incompatible program.

的时候,并不意味着真正出了问题,模型仍然可以正常运行
v0.2采用了全新的结构,与之前版本的checkpoint并不兼容
Note:v0.2的.py文件传错了,应在release里下载标注v0.2的附件