Git Product home page Git Product logo

Comments (2)

1180300910 avatar 1180300910 commented on May 24, 2024

估计是BERT的版本不匹配
我刚刚也遇到了这个问题,试了下sequence_output = x[0]就可以了。
猜测原因如下:
bert的输出包括last_hidden_state,pooler_output,hidden_states,attentions,默认只输出前两项,想要输出后两项需要像你说的那样修改output_hidden_states = True和output_attentions = True
代码中需要取的是last_hidden_state即最后一层的隐状态,而该版本似乎将其作为x的一个属性。而我的版本将x处理成了一个元组,故取了x的第一个元素。

from nlp-notebook.

orangejuice1007 avatar orangejuice1007 commented on May 24, 2024

估计是BERT的版本不匹配 我刚刚也遇到了这个问题,试了下sequence_output = x[0]就可以了。 猜测原因如下: bert的输出包括last_hidden_state,pooler_output,hidden_states,attentions,默认只输出前两项,想要输出后两项需要像你说的那样修改output_hidden_states = True和output_attentions = True 代码中需要取的是last_hidden_state即最后一层的隐状态,而该版本似乎将其作为x的一个属性。而我的版本将x处理成了一个元组,故取了x的第一个元素。

谢谢!我目前可以成功训练出模型,但是不知道为什么运行demo_eval.py预测的实体全部为空……

from nlp-notebook.

Related Issues (10)

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.