QA Documentation: I got error just copy and pasting documentation
See original GitHub issueEnvironment 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
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:
- Go to the documentation: https://huggingface.co/transformers/custom_datasets.html at Squad training section
- Copy and paste the code as you can see from my pastebin: https://pastebin.com/hZvq7Zs7
- 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
- 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:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @joeddav the posted code works perfectly.
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