AttributeError: 'NoneType' object has no attribute 'start_logit'
Author: rahular
Pull request: no

In the `run_squad2` example notebook, the `write_predictions` method fails because `best_non_null_entry` is `None`

```
Evaluating: 100%|███████████████████████████| 1529/1529 [05:12<00:00,  4.88it/s]
01/18/2019 21:42:28 - INFO - __main__ -   Writing predictions to: ./models/squad2/predictions.json
01/18/2019 21:42:28 - INFO - __main__ -   Writing nbest to: ./models/squad2/nbest_predictions.json
Traceback (most recent call last):
  File "run_squad2.py", line 1075, in <module>
    main()
  File "run_squad2.py", line 1071, in main
    output_nbest_file, output_null_log_odds_file, args.verbose_logging, True, args.null_score_diff_threshold)
  File "run_squad2.py", line 612, in write_predictions
    score_diff = score_null - best_non_null_entry.start_logit - (
AttributeError: 'NoneType' object has no attribute 'start_logit'
```

Comments:
Can you post a self-contained example to reproduce your error ? Which version of python, pytorch and pytorch-pretrained-bert are you using?

Closing since there is no recent activity. Feel free to re-open if needed.

I ran into the same issue. Any pointers on how I could triage this further?

@thomwolf sorry, was busy with something else. Will post a self-sufficient example and possibly a PR with the fix soon.

=============================================================================================================================================================================
Reinstalling:
 subscription-manager-rhsm                          x86_64                          1.20.10-7.el6                          rhel-6-server-rpms                          285 k

Transaction Summary
=============================================================================================================================================================================
Reinstall     1 Package(s)

Total size: 285 k
Installed size: 379 k
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 298, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 227, in main
    return_code = base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 547, in doTransaction
    testcb = RPMTransaction(self, test=True)
  File "/usr/lib/python2.6/site-packages/yum/rpmtrans.py", line 198, in __init__
    self._setupOutputLogging(base.conf.rpmverbosity)
  File "/usr/lib/python2.6/site-packages/yum/rpmtrans.py", line 225, in _setupOutputLogging
    self.base.ts.ts.scriptFd = self._writepipe.fileno()
AttributeError: 'NoneType' object has no attribute 'scriptFd'
Uploading Enabled Repositories Report
Loaded plugins: product-id, rhnplugin, subscription-manager
Loaded plugins: product-id, rhnplugin, subscription-manager
Loaded plugins: product-id, rhnplugin, subscription-manager
Loaded plugins: product-id, rhnplugin, subscription-manager
Loaded plugins: product-id, rhnplugin, subscription-manager


--> Running transaction check
---> Package glibc-headers.x86_64 0:2.12-1.212.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.212.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.212.el6.x86_64
---> Package irqbalance.x86_64 2:1.0.7-9.el6 will be an update
--> Processing Dependency: kernel >= 2.6.32-358.2.1 for package: 2:irqbalance-1.0.7-9.el6.x86_64
--> Finished Dependency Resolution
Error: Package: 2:irqbalance-1.0.7-9.el6.x86_64 (rhel-6-server-rpms)
           Requires: kernel >= 2.6.32-358.2.1
           Installed: kernel-2.6.32-131.0.15.el6.x86_64 (@anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1)
               kernel = 2.6.32-131.0.15.el6
               kernel = 2.6.32-131.0.15.el6
Error: Package: glibc-headers-2.12-1.212.el6.x86_64 (rhel-6-server-rpms)
           Requires: kernel-headers >= 2.2.1
Error: Package: glibc-headers-2.12-1.212.el6.x86_64 (rhel-6-server-rpms)
           Requires: kernel-headers
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
Uploading Enabled Repositories Report