Comments (2)
估计是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.
估计是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)
- 环境问题 HOT 5
- https://pan.baidu.com/s/1O3GXE3E7-qn9TrdKq1-5cw 提取码:h6vt
- RuntimeError: _th_ceil_out not supported on CUDAType for Long HOT 1
- Lattice-LSTM HOT 1
- Bug HOT 2
- 4.1Seq2Seq HOT 3
- 请问可以加入基于transformer的关键词提取和生成吗?
- AttributeError : 'tuple' has no attribute 'to' HOT 1
- 请问bert中文预训练做4-5的时候的运行时显存要求是多少 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlp-notebook.