Comments (7)
训练结束后predict.py脚本获取不到标签问题 知乎上也有很多人说predict.py脚本获取到的标签为空,其实不是训练数据有问题或者轮次不够,作者的get_label 函数逻辑有一些小小的问题,我这里简单修改了一下,可以成功获取到标签,新的predict.py 的get_label 函数如下:
def get_label(sentence): """ Prediction of the sentence's label. """ feature = get_feature_test(sentence) fd = {MODEL.albert.input_ids: [feature[0]], MODEL.albert.input_masks: [feature[1]], MODEL.albert.segment_ids:[feature[2]], } prediction = MODEL.sess.run(MODEL.albert.predictions, feed_dict=fd)[0] print(prediction) r=[] for i in range(len(prediction)): if prediction[i]!=0.0: r.append(id2label(i)) return r #return [id2label(l) for l in np.where(prediction==1)[0] if l!=0]
您好,按照您的修改之后我的输出都是第一个标签了...我看了下任何句子的prediction几乎相等,这是什么原因呢...
from classifier-multi-label.
建议打印prediction看看
from classifier-multi-label.
请问你这个问题解决了吗?我也遇到了,prediction结果都是[]。
from classifier-multi-label.
我的第一个标签是空标签"|",所以会不一样
from classifier-multi-label.
大家有用起来么?要不要加个QQ好友交流一下?qq:1840658279
from classifier-multi-label.
prediction打印出来全是0......
from classifier-multi-label.
是正常的,说明预测结果为空
from classifier-multi-label.
Related Issues (11)
- ImportError:cannot import name 'model_fn' from 'tensorflow_estimator.python.estimator' HOT 2
- Accuracy在train.py里没有啊
- looking forward to Pytorch version
- Failed to find any matching files for /root/autodl-tmp/classifier_multi_label/albert_small_zh_google/albert_model.ckpt
- 可以分享一下样本集制作过程吗?一直显示‘|’无法将string转成float。样本集格式已经和test_onehot.csv HOT 1
- 佬在mi哪个部门呢,技术委还是ailab?
- The passed save_path is not a valid checkpoin HOT 3
- 大佬问一下tensor2,怎么解决contrib_tpu的问题 HOT 1
- classifier_multi_label_textcnn 报错 HOT 2
- tf2使用textcnn网络问题
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 classifier-multi-label.