model.generate does not work when using a AlbertModel
### System Info

- `transformers` version: 4.31.0
- Platform: Linux-5.15.109+-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.16.4
- Safetensors version: 0.3.1
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.0.1+cu118 (False)
- Tensorflow version (GPU?): 2.12.0 (False)
- Flax version (CPU?/GPU?/TPU?): 0.7.0 (cpu)
- Jax version: 0.4.13
- JaxLib version: 0.4.13
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>


### Who can help?

@sgugger 

Apologies in advance if this is not a bug and instead a fault of my code.

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

## Step 1: Loading AI4Bharat/indic-bert model and tokenizer
```
# Load model directly
tokenizer = AutoTokenizer.from_pretrained("ai4bharat/indic-bert", src_lang="en_XX",tgt_lang="mr_IN")
model = AlbertModel.from_pretrained("ai4bharat/indic-bert", max_length = context_length)
```
## Step 2: Loading the dataset using datasets

```
from datasets import load_dataset
dataset = load_dataset("anujsahani01/English-Marathi", split = 'test[:20]')
```

## Step 3: Tokenizing the input data
```
# generate output
 model_inputs = tokenizer(data['english'], text_target =  data['marathi'],  max_length= max_length, padding = 'max_length', 
 truncation=True, return_tensors = 'pt').to(device)
 labels = model_inputs['labels']
 source = model_inputs['input_ids']
```

## Step 4:  Using .generate to make predictions
```
 preds = model.generate(**model_inputs, max_new_tokens = max_length)
```


### Expected behavior

Hey folks,
I was comparing different multilingual language models on basis of different evaluation metrics. Was not able to generate outputs using indic-bert

## Model
```ai4bharat/indic-bert```

## Error Message 
```
TypeError: The current model class (AlbertModel) is not compatible with `.generate()`, as it doesn't have a language model head.
```

Any of your inputs will be highly appreciated.
Thank You !
I don't know what more you want me to say. As the error clearly states, this is not a model that supports `.generate`. ALBERT was trained on a masked language modeling objective so none of its variants are compatible with `.generate()`.