Model type in convert_tf_checkpoint_to_pytorch and 'squad' mapping
Author: mhardalov
Pull request: yes
Labels: name: wontfix

Issue #438 still exists if you choose to use something else rather then BertForTokenClassification. Furthermore, you still need to edit the code before running the convertor. Lastly,  BertForTokenClassification is not the same as BertForQuestionAnswering, since the latter omits the dropout before the output layer.

Maybe it's better to add more options like 'classification' which uses BertForTokenClassification.

Tested the changes on fine-tuned BERT model on SQuAD 1.1 with Google's original Tensorflow script run_squad.py initialized with multi_cased_L-12_H-768_A-12. 

Comments:
# [Codecov](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=h1) Report
> Merging [#521](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/commit/80684f6f86c13a89fc1e4feac248ef96b013765c?src=pr&el=desc) will **decrease** coverage by `0.2%`.
> The diff coverage is `18.75%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521/graphs/tree.svg?width=650&token=9qOlN6Hb1c&height=150&src=pr)](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #521      +/-   ##
==========================================
- Coverage   67.19%   66.99%   -0.21%     
==========================================
  Files          18       18              
  Lines        3847     3869      +22     
==========================================
+ Hits         2585     2592       +7     
- Misses       1262     1277      +15
```


| [Impacted Files](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...retrained\_bert/convert\_tf\_checkpoint\_to\_pytorch.py](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521/diff?src=pr&el=tree#diff-cHl0b3JjaF9wcmV0cmFpbmVkX2JlcnQvY29udmVydF90Zl9jaGVja3BvaW50X3RvX3B5dG9yY2gucHk=) | `0% <0%> (ø)` | :arrow_up: |
| [pytorch\_pretrained\_bert/modeling.py](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521/diff?src=pr&el=tree#diff-cHl0b3JjaF9wcmV0cmFpbmVkX2JlcnQvbW9kZWxpbmcucHk=) | `86.22% <24%> (-2.35%)` | :arrow_down: |
| [pytorch\_pretrained\_bert/tokenization\_gpt2.py](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521/diff?src=pr&el=tree#diff-cHl0b3JjaF9wcmV0cmFpbmVkX2JlcnQvdG9rZW5pemF0aW9uX2dwdDIucHk=) | `83.51% <0%> (+1.06%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=footer). Last update [80684f6...4a638d1](https://codecov.io/gh/huggingface/pytorch-pretrained-BERT/pull/521?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


# [Codecov](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=h1) Report
> Merging [#521](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/pytorch-transformers/commit/f2a3eb987e1fc2c85320fc3849c67811f5736b50?src=pr&el=desc) will **decrease** coverage by `0.18%`.
> The diff coverage is `20%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521/graphs/tree.svg?width=650&token=9qOlN6Hb1c&height=150&src=pr)](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #521      +/-   ##
==========================================
- Coverage   79.04%   78.85%   -0.19%     
==========================================
  Files          34       34              
  Lines        6242     6262      +20     
==========================================
+ Hits         4934     4938       +4     
- Misses       1308     1324      +16
```


| [Impacted Files](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pytorch\_transformers/modeling\_bert.py](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521/diff?src=pr&el=tree#diff-cHl0b3JjaF90cmFuc2Zvcm1lcnMvbW9kZWxpbmdfYmVydC5weQ==) | `85.44% <20%> (-2.54%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=footer). Last update [f2a3eb9...8e04e9e](https://codecov.io/gh/huggingface/pytorch-transformers/pull/521?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


@thomwolf Is this PR still useful? Can it be somehow improved and later merged, or it should be closed?

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.