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.

QA Documentation: I got error just copy and pasting documentation

See original GitHub issue

Environment info

  • transformers version: 4.3.1
  • Platform:Manjaro Linux
  • Python version: 1.5.1
  • PyTorch version (GPU?): Yes
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Who can help

@sgugger

Information

I am trying the to train a QA model following the huggingface documentation, I just copied and pasted the code in my machine (and in Colab) but I was not able to proceed in the training phase because I got None value.

To reproduce

Steps to reproduce the behavior:

  1. Go to the documentation: https://huggingface.co/transformers/custom_datasets.html at Squad training section
  2. Copy and paste the code as you can see from my pastebin: https://pastebin.com/hZvq7Zs7
  3. And you got the following error File "/home/andrea/PycharmProjects/qa-srl/test.py", line 78, in __getitem__ return {key: torch.tensor(val[idx]) for key, val in self.encodings.items()} RuntimeError: Could not infer dtype of NoneType
  4. My naive solution was modifying the getitem method from the SquadDataset class in order to avoid to serve the val[idx] == None

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
andreabac3commented, Feb 17, 2021

Thank you @joeddav the posted code works perfectly.

0reactions
andreabac3commented, Feb 24, 2021

Sorry for bothering you @joeddav again, I have a question related to the code posted by you here. I am still getting None with the dataset built by myself using this code. My dataset works perfectly with the run_squad original script. In this snipped posted by you I encounter None in the vector of end_positions and I don’t know how fix it. I saw the condition in which there’s a None the start_positions but what I have to do in the case the None is only in the end_positions vector?

Kind regards, Andrea

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is copying and pasting in the EHR such a problem?
Several papers have been published documenting and quantifying the copy-and-paste problem by analyzing progress notes for redundancy.
Read more >
Copying and Pasting Patient Treatment Notes | Journal of Ethics
A fully functional computerized physician order-entry (CPOE) system should be able to prevent “copy and paste” medication errors from harming patients.
Read more >
Is it OK being in documentation websites all the time ... - Quora
Yes, reading documentation is always good. Better than to have to read source code. You are lucky if the documentation is complete and...
Read more >
EHR Issues: Documentation Risks, Record Requests and ...
“False documentation of care is not just bad patient care; it's illegal.” ... note that has been copied / pasted into a medical...
Read more >
The Dangers of Copy and Paste - GrammaTech Blog
In this post, I'm going to show examples of GrammaTech's CodeSonar detecting tricky copy-paste errors and how this is useful for improving ...
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