fix bug in run_clm.py
Sorry I don't have time to follow contributor guideline. 

group_texts function in transformers/examples/pytorch/language-modeling/run_clm.py will lead to training failure.

This is because the possibility that the length of a batch is too small is not considered.

I hope this can help some people. 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_15363). All of your documentation changes will be reflected on that endpoint.<|||||>May cause errors  "ValueError: expected sequence of length 1024 at dim 1 (got 79)".  This pull request can solve this problem<|||||>This is not a fix that will actually work since most models trained on causal language modeling objective do not have a padding token. 0 thus does not work as an index, and it shouldn't be the index picked for the labels either since PyTorch only ignore the index -100 in the loss.

It's also seem like a very edge case since it implies that you get the total length of 1000 texts in your dataset be shorter than the block size.<|||||>@sgugger  Thank you for your reply～ 

> This is not a fix that will actually work since most models trained on causal language modeling objective do not have a padding token. 0 thus does not work as an index, and it shouldn't be the index picked for the labels either since PyTorch only ignore the index -100 in the loss.

Agree. Padding should be set more appropriately, Or discard this part directly.

> It's also seem like a very edge case since it implies that you get the total length of 1000 texts in your dataset be shorter than the block size.

Disagree.  This often happens in the case of short text( I tested on 7.4 million short texts with an average length of 15). Function group_texts （"map processes 1,000 texts together"）probably process data incorrectly in the last "1,000 texts", because it can actually be any number between 0 and 1000.  This causes total_length  less than block_size which leads to dataloader error.

I think this should be fixed. Do I need to resubmit my pull request?<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.