hedwigi / transformer-notes Goto Github PK
View Code? Open in Web Editor NEW根据The Annotated Transformer整理的代码
根据The Annotated Transformer整理的代码
你好呀~
我最近也在学习transformer和pytorch,正在阅读哈佛的教程,非常感谢你整理的代码,十分明了,对于学习很有帮助。
但是在运行代码的时候,出现Index is supposed to be a vector这样的问题,请问你遇到过吗?
再你的环境中可以跑通吗?
谢谢~
Traceback (most recent call last):
File "/home/zhangmy/srl/transformer/pytorch03forharvard/main.py", line 137, in <module>
SimpleLossCompute(model.output_layer, criterion, model_opt))
File "/home/zhangmy/srl/transformer/pytorch03forharvard/main.py", line 69, in run_epoch
loss = loss_compute(out, batch.trg_y, batch.ntokens)
File "/home/zhangmy/srl/transformer/pytorch03forharvard/train_helper/SimpleLossCompute.py", line 12, in __call__
y.contiguous().view(-1)) / norm
File "/home/zhangmy/.conda/envs/basecopy/lib/python3.5/site-packages/torch/nn/modules/module.py", line 491, in __call__
result = self.forward(*input, **kwargs)
File "/home/zhangmy/srl/transformer/pytorch03forharvard/model/regularization/LabelSmoothing.py", line 26, in forward
true_dist.index_fill_(0, mask.squeeze(), 0.0)
RuntimeError: invalid argument 3: Index is supposed to be a vector at /pytorch/aten/src/TH/generic/THTensorMath.c:553
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.