Convert assertions to exceptions in some examples
# What does this PR do?

For #12789.

This PR converts assertions to exceptions in some example files in `/examples/pytorch/language-modeling/`. I found this commit locally from over a year ago, so new scripts have been added since it was created.

## Who can review?

Maintained examples (not research project or legacy):

- PyTorch: @sgugger
_The documentation is not available anymore as the PR was closed or merged._<|||||>The issue was aimed at the modules in the library, not the examples. I'd keep the examples as they are for now.<|||||>@sgugger, I was not aware of that! Can you mention that prominently in the issue (#12789) so others know to avoid them?

Also, I modified the initial comment because I had forgotten to link the issue in the first place, even though I had made a note to before I created this PR.<|||||>Edited my comments on the issue to reflect this.<|||||>Thanks! I'm closing PR now, then.