Yes, and it is actually pretty easy thanks to a script provided by Hugging Face: transformers/run_clm.py at master · huggingface/transformers · GitHub 1
You can use this script to finetune models for causal language modeling (i.e. next word prediction) on a text file or a dataset.