question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidArgument `labels` contains negative values

See original GitHub issue

What can be the problem? Did anyone have something like this?

Saving checkpoints for 0 into results/model/model.ckpt.

Traceback (most recent call last): . . . .

InvalidArgumentError (see above for traceback): assertion failed: [`labels` contains negative values] [Condition x >= 0 did not hold element-wise:] [x (Reshape_5:0) = ] [8 12 -1...]
	 [[{{node confusion_matrix/assert_non_negative/assert_less_equal/Assert/AssertGuard/Assert}} = Assert[T=[DT_STRING, DT_STRING, DT_STRING, DT_INT64], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](confusion_matrix/assert_non_negative/assert_less_equal/Assert/AssertGuard/Assert/Switch, confusion_matrix/assert_non_negative/assert_less_equal/Assert/AssertGuard/Assert/data_0, confusion_matrix/assert_non_negative/assert_less_equal/Assert/AssertGuard/Assert/data_1, confusion_matrix/assert_non_negative/assert_less_equal/Assert/AssertGuard/Assert/data_2, confusion_matrix/assert_non_negative/assert_less_equal/Assert/AssertGuard/Assert/Switch_1)]]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dhgoratelacommented, Jun 18, 2020

Hi @rashibudati , To share an update on this issue, I am using this solution to do something other than NER. I found that this issue comes because of line 45 of main.py. For padding tokens to match uneven length samples, @guillaumegenthial is using the label “O”. This means padded tokens are being tagged as “Others”. If your data does not have an “O” tag, then build_vocab.py script will not populate “O” in vocab.tags.txt. Hence during execution, it will find “O” tags that were used in padding as the foreign tags. This mismatch generates the error. The author’s answer about missing tags is correct. To fix this, you need to manually add a capital “O” tag in a new line of your vocab.tags.txt after running build_vocab.py

0reactions
wentinghomecommented, Oct 11, 2020

Hi @rashibudati , To share an update on this issue, I am using this solution to do something other than NER. I found that this issue comes because of line 45 of main.py. For padding tokens to match uneven length samples, @guillaumegenthial is using the label “O”. This means padded tokens are being tagged as “Others”. If your data does not have an “O” tag, then build_vocab.py script will not populate “O” in vocab.tags.txt. Hence during execution, it will find “O” tags that were used in padding as the foreign tags. This mismatch generates the error. The author’s answer about missing tags is correct. To fix this, you need to manually add a capital “O” tag in a new line of your vocab.tags.txt after running build_vocab.py

Solved my problem, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensorflow: Invalid argument: assertion failed: [`predictions ...
My labels were valid, no negative values and values in range(0, nclasses). The problem was that the learning_rate was too big. – Claudia...
Read more >
tensorflow - 1] [Condition x <= y did not hold element-wise:]
Looking at the error message it seems you are using the same number of labels as you have classes, whereas the number of...
Read more >
Metrics related [predictions must be <= 1] error
Hello,. I have the below error with TensorFlow 2.7. Same error happens with 2.6 but stack trace is different.
Read more >
Error Responses - Amazon Simple Storage Service
Error Code Description HTTP Status Code AccessControlListNotSupported The bucket does not allow ACLs. 400 Bad Request AccessDenied Access Denied 403 Forbidden BucketAlreadyOwnedByYou 409 Conflict (in all...
Read more >
PowerPoint.Shape class - Office Add-ins | Microsoft Learn
Throws an InvalidArgument exception when set with a negative value. ... tags. Returns a collection of tags in the shape. textFrame.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found