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.

2.9.0 Padding Bug

See original GitHub issue

🐛 Bug

Information

Model I am using (Bert, XLNet …): Roberta with RobertaForSequenceClassification head

Language I am using the model on (English, Chinese …): Polish

The problem arises when using:

  • the official example scripts: (give details below)
  • my own modified scripts: (give details below)

The problem arises when performing a forward pass while training. I assume something is wrong with padding, though with 2.8.0 version it works correctly.

The tasks I am working on is:

  • an official GLUE/SQUaD task: (give the name)
  • my own task or dataset: (give details below)

I’m using pre-trained roBERTa model for classification task. Details can be found in the notebook below.

To reproduce

Steps to reproduce the behavior:

  1. Run https://colab.research.google.com/drive/1w54ScQ3-dh99-cO4OGG6-IdP4JRfki59?usp=sharing

Error message:

     56         # Perform a forward pass
---> 57         loss, logits = model(b_input_ids, token_type_ids=None, attention_mask=b_input_mask, labels=b_labels)

...

   2033     """
   2034     # The series of casts and type-conversions here are carefully balanced to both work with ONNX export and XLA.
-> 2035     mask = input_ids.ne(padding_idx).int()
   2036     incremental_indices = torch.cumsum(mask, dim=1).type_as(mask) * mask
   2037     return incremental_indices.long() + padding_idx

TypeError: ne() received an invalid combination of arguments - got (NoneType), but expected one of:
 * (Tensor other)
      didn't match because some of the arguments have invalid types: (!NoneType!)
 * (Number other)
      didn't match because some of the arguments have invalid types: (!NoneType!)

Expected behavior

It should work without errors. The problem arises after installing 2.9.0 version. With 2.8.0 version it works correctly.

Environment info

  • transformers version: 2.9.0
  • Platform: Google colab
  • Python version: 3.6.9
  • PyTorch version (GPU?): 1.5.0+cu101
  • Tensorflow version (GPU?): 2.2.0rc4
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: n/a

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dsindexcommented, Oct 30, 2020

trouble shooting

position_ids = create_position_ids_from_input_ids(input_ids, self.padding_idx).to(input_ids.device)
mask = input_ids.ne(padding_idx).int()
...
ne() received an invalid combination of arguments - got (NoneType)

just modify ‘pad_token_id: null’ to ‘pad_token_id: 1’ in config.json

0reactions
stale[bot]commented, Aug 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

2.9.0.beta7: Security fix, bug fixes and more - Discourse Meta
Security Updates This beta includes 1 security fix following an advisory on an upstream dependency. For more information, check the security ...
Read more >
Icinga Web 2 Changelog
This update's main focus is to solve the issue that all history views didn't work correctly or showed invalid time and dates. (#4853) ......
Read more >
Releases for Base USWDS - United States Web Design System
Issue #3179547: USWDS 2.9.0 and 2.10.0 Released Issue #3196387: legend not showing up on taxonomy reference field. Issue #3200437: Strings in template files ......
Read more >
4. Release Notes — Buildbot 2.9.0 documentation
Fixed a bug preventing the timeout=None parameter of CopyDirectory step from ... of www-badges to support additional padding configuration (issue # 5079).
Read more >
Log4j – Changes - Apache Logging Services
2.0.2, 2014-08-16, Bug fixes and enhancements ... 2.9.0 -> 2.11.1 - org.apache.maven.plugins:maven-failsafe-plugin .
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