Erroneous Code
I guess there is a minor mistake in this line.

https://github.com/huggingface/pytorch-pretrained-BERT/blob/80684f6f86c13a89fc1e4feac248ef96b013765c/pytorch_pretrained_bert/modeling_transfo_xl.py#L1385

In `TransfoXLLMHeadModel`, the forward computation requires the target (if available) has the shape [batch_size, sequence_length], that is, it is rank-2 here. However, in the `ProjectedAdaptiveLogSoftmax` (case when `config.sample_softmax < 0`, and the default value 
of `config.sample_softmax` was set to -1), the forward compuation (indicated in the above line) requires the target (if available) has the shape [batch_size * sequence_length], which means it is rank-1 here. This could not passed the assertion check in the forward computation and raise the error.

Luckily I have checked the computation logic for the Transformer-XL part, most of them are correct. Therefore I suggest just a minor change from `softmax_output = self.crit(pred_hid.view(-1, pred_hid.size(-1)), target) ` to `softmax_output = self.crit(pred_hid.view(-1, pred_hid.size(-1)), target.reshape(-1)) `

If you prefer PR, I could do this little favor;)
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.
