graykode / graykode/nlp-tutorial

Problem with BERT batch generation

未关闭
#45 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
14.9k
派生
3.9k
PR 合并指标
30 天内没有已合并 PR

描述

There is a problem with padding on [line 73-75 ](https://github.com/graykode/nlp-tutorial/blob/cb4881ebf6683dc6970c53a2cf50d5fd01edf118/5-2.BERT/BERT-Torch.py#L73). What if the sentence length is larger than [maxlen](https://github.com/graykode/nlp-tutorial/blob/cb4881ebf6683dc6970c53a2cf50d5fd01edf118/5-2.BERT/BERT-Torch.py#L16)? Then we end up with sequences of varying length and [line 214](https://github.com/graykode/nlp-tutorial/blob/cb4881ebf6683dc6970c53a2cf50d5fd01edf118/5-2.BERT/BERT-Torch.py#L214) throws an error.

贡献指南

打开贡献指南

调研方向

从 5-2.BERT/BERT-Torch.py 开始,查看第 16 行的 maxlen、第 73-75 行的 padding 以及第 214 行的批处理操作。使用长于 maxlen 的句子重现该失败,然后确保批量生成能够在不出现所报告错误的情况下产生兼容的序列长度。

由索引模型根据 Issue 内容生成。

评估

技术栈
python, pytorch
领域
machine-learning
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。