知识卡片
上下文反向训练需看样本是否对称
示例把名为context的张量送入网络、以center作标签,和前文变量说明相反。若训练对包含完全对称的双向配对,总体对分布可仍对应反向同一集合;但有抽样或非对称过滤时不能假定等价,需记录实际目标。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 用词嵌入推理
原书出处 · 1 处
- · 查看原书依据
logits = model(input=context) loss = loss_fn(logits, center) if not sample_num % 10000: # print(center, context) pbar.set_description(f'loss[{sample_num}] = {loss.item()}') epoch_loss += loss.item() loss.backward() optimizer.step() pbar.update(1) epoch_loss /= len(dataloader['train']) running_loss.append(epoch_loss) save_model(model, loss) 6.3.4 Using the gensim.word2vec module If the previous section sounded too complicated, don’t worry. Various companies provide their pretrained word vector models, and popular NLP libraries for different programming languages allow you to use the
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第06章《用词嵌入推理》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-6.html)
- 结论依据:摘录中关于上下文反向训练需看样本是否对称的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:logits = model(input=context) loss = loss_fn(logits, center) if not sample_num % 10000: # print(center, context) pbar.set_description(f'loss[{sample_num}] = {loss.item()}') epoch_loss += loss.item() loss.backward() optimizer.step() pbar.update(1) epoch_loss /= len(dataloader['train']) running_loss.append(epoch_loss) save_model(model, loss) 6.3.4 Using the gensim.word2vec module If the previous section sounded too complicated, don’t worry. Various companies provide their pretrained word vector models, and popular NLP libraries for different programming languages allow you to use the