![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
keras
文章平均质量分 89
Meloneating
这个作者很懒,什么都没留下…
展开
-
keras中加入self-attention模块
代码演示废话不多说,直接上代码class Self_Attention(Layer): def __init__(self, output_dim, **kwargs): self.output_dim = output_dim super(Self_Attention, self).__init__(**kwargs) def build(self, input_shape): # 为该层创建一个可训练的权重 # inputs.shape = (batch_size, time原创 2021-06-19 18:40:31 · 2492 阅读 · 2 评论 -
代码解析
Slot-Gated Modeling for Joint Slot Filling and Intent Prediction代码解析预处理主函数建立模型意图识别模型槽位填充模型训练模型预处理def createVocabulary(input_path, output_path, no_pad=False): if not isinstance(input_path, str): raise TypeError('input_path should be string')原创 2021-05-11 19:33:40 · 1451 阅读 · 1 评论 -
keras的模型保存与加载
keras的模型保存与加载keras的模型保存h5类型ckpt类型保存模型和加载模型参考链接keras保存模型中的save()和save_weights().keras的模型保存保存 模型时可以配合回调函数(callback)的方法,在每一次batch(应该是batch)中,保留最佳的模型参数,常见的模型类型有两种,一种是ckpt,另一种是h5。h5类型 bast_model_filepath = './checkpoint/best_bilstm_crf_model.h5' ch原创 2021-05-10 13:12:25 · 1159 阅读 · 0 评论