Please, before asking questions look on the internet for a minute or two. This is a VERY common use case, as you may have expected. It takes us too much time to keep repeating all the same questions. Thanks.
The first hit that I got on Google already gives you a tutorial on fine-tuning: Fine-tuning a pretrained model — transformers 4.10.1 documentation 7
Second: Fine-tuning with custom datasets — transformers 4.10.1 documentation 3
Notebooks: 🤗 Transformers Notebooks — transformers 4.10.1 documentation 2
Of course, you cannot get the last hidden states as an attribute of the model. You first need to do a forward pass with some given data. From the output of the data you can then extract the last hidden state.