how to do next word prediction in xlnet?
##  how to do next word prediction in xlnet?

First of all thanks for **huggingface - transformers**
community.
I am actually beginner for XLnet. I want to do Next word prediction by using XLnet. How can i do this?
and I have my own domain-specific datasets(1000 lines), finetune this dataset in xlnet.
is this dataset enoughfor us to get good results?

Take a look at the example code [here](https://github.com/huggingface/transformers/blob/master/examples/run_generation.py). 1000 lines of text for fine-tuning shouldn't be an issue I think, since you're just fine-tuning. As always, try it out and you'll see.<|||||>Thank you so much for your reply<|||||>@BramVanroy But how to fine-tune xlnet for next-word-prediction ?
Is it correct to use perm_mask and target_mapping to simulate left-to-rigth ?<|||||>Can you direct me to a code on how to predict next word in tf 2.0?<|||||>You can see the [causal language modeling example in usage](https://huggingface.co/transformers/usage.html#causal-language-modeling). There's a TensorFlow toggle, and it showcases gpt-2.