ruotianluo / ImageCaptioning.pytorch

I decide to sync up this repo and self-critical.pytorch. (The old master is in old master branch for archive)
MIT License
1.43k stars 409 forks source link

词嵌入问题 #197

Open Githubdzp opened 3 months ago

Githubdzp commented 3 months ago

您好,请问您使用的是one-hot编码还是GloVe词嵌入,怎么修改这一部分,本人小白

ruotianluo commented 3 months ago

One hot. 如果要glove的话就先对每个词提取好glove festure,然后变成一个tensor,然后在定义embedding layer之后直接把embedding layer的weight assign城glove Ruotian LuoOn Mar 28, 2024, at 8:14 AM, Githubdzp @.***> wrote: 您好,请问您使用的是one-hot编码还是GloVe词嵌入,怎么修改这一部分,本人小白

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

Githubdzp commented 3 months ago

我现在看到一篇论文的源码是用您的改的,用的glove,就是一个npy文件,但是不知道怎么改成one hot做消融,也是一个npy文件吗?

---- 回复的原邮件 ---- | 发件人 | Ruotian(RT) @.> | | 日期 | 2024年03月29日 03:17 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [ruotianluo/ImageCaptioning.pytorch] 词嵌入问题 (Issue #197) |

One hot. 如果要glove的话就先对每个词提取好glove festure,然后变成一个tensor,然后在定义embedding layer之后直接把embedding layer的weight assign城glove Ruotian LuoOn Mar 28, 2024, at 8:14 AM, Githubdzp @.***> wrote: 您好,请问您使用的是one-hot编码还是GloVe词嵌入,怎么修改这一部分,本人小白

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ruotianluo commented 3 months ago

你看这里不是有一个embedding layer: https://github.com/ruotianluo/ImageCaptioning.pytorch/blob/master/captioning/models/AttModel.py#L74 你就把他的weight改掉。但是要确保vocab是一样的才行

Githubdzp commented 3 months ago

好的,我尝试一下,谢谢您

在 2024-03-31 15:21:18,"Ruotian(RT) Luo" @.***> 写道:

你看这里不是有一个embedding layer: https://github.com/ruotianluo/ImageCaptioning.pytorch/blob/master/captioning/models/AttModel.py#L74 你就把他的weight改掉。但是要确保vocab是一样的才行

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Githubdzp commented 3 months ago

不好意思,又来麻烦您了,这个训练是交叉熵训练30个epoch,然后scst强化学习训练30个epoch,但是我把epoch改成1之后,交叉熵训练1次,强化学习已经超过一次了,而且强化学习训练一个epoch大概三个小时

---- 回复的原邮件 ---- | 发件人 | Ruotian(RT) @.> | | 日期 | 2024年03月31日 15:21 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [ruotianluo/ImageCaptioning.pytorch] 词嵌入问题 (Issue #197) |

你看这里不是有一个embedding layer: https://github.com/ruotianluo/ImageCaptioning.pytorch/blob/master/captioning/models/AttModel.py#L74 你就把他的weight改掉。但是要确保vocab是一样的才行

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>