ziwang-com / AGM

AGM阿格姆:AI基因图谱模型,从token-weight权重微粒角度,探索AI模型,GPT\LLM大模型的内在运作机制。

Home Page:http://www.m-f.vip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

结构化的自注意句子嵌入

ziwang-com opened this issue · comments

https://github.com/kaushalshetty/Structured-Self-Attention
结构化的自注意句子嵌入
论文A Structured Self-Attentive Sentence Embedding的实现,该论文发表在ICLR 2017:https://arxiv.org/abs/1703.03130 上。

image

用法:
对于 imdb 数据集上的二进制情绪分类,请运行:python classification.py "binary"

对于路透社数据集上的多类分类,请运行:python classification.py "multiclass"

您可以在文件中更改模型参数,例如注意力跳数等。model_params.json fileconfig.json

如果要使用预训练手套嵌入,请将参数设置为 ,默认设置为 False。不要忘记下载并将其放在手套文件夹中。use_embeddings"True"glove.6B.50d.txt

实现:
使用自我注意进行分类
使用弗罗贝尼乌斯范数的正则化
渐变剪切
可视化注意力权重