Git Product home page Git Product logo

transformer-notes's People

Contributors

hedwigi avatar

Stargazers

 avatar  avatar  avatar

transformer-notes's Issues

问题: Index is supposed to be a vector

你好呀~

我最近也在学习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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.