Comments (7)
你好,我把data文件夹中的数据换成自己的数据,为什么会报这样的错误呀?应该如何解决呀?谢谢分享
There are some parameters that need to be changed based on your data set. Based on my own data set, for example:
def get_labels(self): return ["O", "B-OBJ", "I-OBJ", "X", "[CLS]", "[SEP]"]
logits = tf.reshape(logits, [-1, FLAGS.max_seq_length, 7])
precision = tf_metrics.precision(label_ids, predictions, 7, [2, 3], average="macro") recall = tf_metrics.recall(label_ids, predictions, 7, [2, 3], average="macro") f = tf_metrics.f1(label_ids, predictions, 7, [2, 3], average="macro")
After do this, remember to clean up the contents of the directory 'output/results_dir'
I hope I can help you.
from bert-chinese-ner.
logits = tf.reshape(logits, [-1, FLAGS.max_seq_length, 11]) 这句应该改成:
logits = tf.reshape(logits, [-1, FLAGS.max_seq_length, num_labels])
因为每个人的labels不一样,如果直接写11的话就会报错了
from bert-chinese-ner.
thanks very much !it works for me ! but there is another problem when i run again.
InvalidArgumentError (see above for traceback): assertion failed: [
labels
out of bound] [Condition x < y did not hold element-wise:] [x (confusion_matrix_1/control_dependency:0) = ] [13 1 1...] [y (ToInt64_5:0) = ] [11]
[[{{node confusion_matrix_1/assert_less/Assert/AssertGuard/Assert}} = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT64, DT_STRING, DT_INT64], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/Switch/_1299, confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/data_0, confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/data_1, confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/data_2, confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/Switch_1/_1301, confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/data_4, confusion_matrix_1/assert_less/Assert/AssertGuard/Assert/Switch_2/_1303)]]How can I solve it ? thanks!
from bert-chinese-ner.
ValueError: Dimension size must be evenly divisible by 5500 but is 112000 for 'loss/Reshape_1' (op: 'Reshape') with input shapes: [16000,7], [3] and with input tensors computed as partial shapes: input[1] = [?,500,11].
我用自己的数据的时候,也报了这样的错。
from bert-chinese-ner.
额,我改成7就好了。logits = tf.reshape(logits, [-1, FLAGS.max_seq_length, 7])
from bert-chinese-ner.
我执行原代码,数据也是data文件夹中的,但是还是会报错,改成logits = tf.reshape(logits, [-1, FLAGS.max_seq_length, 7])也不行
ValueError: Dimension size must be evenly divisible by 896 but is 40960 for 'loss/Reshape_1' (op: 'Reshape') with input shapes: [4096,10], [3] and with inp
ut tensors computed as partial shapes: input[1] = [?,128,7].
from bert-chinese-ner.
具体关于shape方面的报错,我把下面代码中的11修改为10就好了
logits = tf.reshape(logits, [-1, FLAGS.max_seq_length, 10])
precision = tf_metrics.precision(label_ids,predictions,10,[2,3,4,5,6,7],average="macro")
recall = tf_metrics.recall(label_ids,predictions,10,[2,3,4,5,6,7],average="macro")
f = tf_metrics.f1(label_ids,predictions,10,[2,3,4,5,6,7],average="macro")
from bert-chinese-ner.
Related Issues (20)
- 你好,在测试集上的结果(精确率,召回率,F1值)没有输出吗 HOT 2
- No such file or directory: './output/label2id.pkl'怎么解决 HOT 1
- 可不可以添加一个license? HOT 1
- killed问题 HOT 1
- 结果全为O问题 HOT 10
- 全局步长未增长,正常吗?
- 请问一下您的环境是py2吗? HOT 5
- 数据集 HOT 2
- tensorflow.python.framework.errors_impl.FailedPreconditionError: output/result_dir/train.tf_record; Is a directory HOT 1
- How to save the model with the best f1 score in verification when training in multiple rounds? HOT 3
- The label_map starts from 1 not 0. How do you avoid getting predicted label == 0 HOT 1
- FileNotFoundError: [Errno 2] No such file or directory: './output/label2id.pkl' HOT 1
- How to get word vector by the fine-tuned Bert? HOT 1
- Hello, I would like to ask, how to use the model to predict the new input data HOT 1
- 如何输出每一类的precision,recall和f1呢? HOT 1
- _read_data 读出来是个空,这段有问题吧??? HOT 1
- 请问,如何使用tenorflow-serving 进行相应的部署呢。您有相关资料或代码吗? HOT 2
- 为什么label_test.txt文件比token_test.txt文件多出许多行呢? HOT 2
- 关于结果
- 训练过程一直持续不停止 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 bert-chinese-ner.