AttributeError: 'AlbertModel' object has no attribute 'bias' -Transforms 4.9.2
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.9.2
- Platform: Lunix
- Python version: 3
- PyTorch version (GPU?): 1.9.0
- Tensorflow version (GPU?): 2.6.0
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.-->

@LysandreJik

- albert , bert, xlm: @LysandreJik




## Information

I am using (AlBert Pretrained on custom corpus): 

The problem arises when using:
* [ ] this is my own scripts: (give details below) _which uses transformers_

Wrote a simple script to extract CLS embedding for sentence from an albert model pretrained on custom vocab.  I define the model using **AlbertModel.from_pretrained** and try to load my pre-trained weights using **load_tf_weights_in_albert** I run the script and get the error  **AttributeError: 'AlbertModel' object has no attribute 'bias**

The tasks I am working on is:
* [ ] my own task or dataset: (give details below)
   
Trying to extract CLS embedding for an input sentence from my  albert model I pretrained on custom vocab. I will then feed these embedding into a custom classification layer. 
 
## To reproduce

Steps to reproduce the behavior:

1.  Define my model: modelprt =  AlbertModel.from_pretrained(pretrained_model_name_or_path='AOUTPR21/model.ckpt-10000', config=ptcfg, from_tf=True)   --(I also tried converting checkpoint to pytorch but that gave  an even worse error) 
2.   load weights into model via :  modelprt = load_tf_weights_in_albert(modelprt, ptcfg, prot_model)  ..._Note here prot_model = AOUTPR21/model.ckpt-10000_
3.   Run my script and I get the error

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

**Error seen :** 

  File "./finetune_prot_pep.py", line 54, in <module>
    contexemb =  getProtembedd(try_loader)
  File "/workspace/finetuneclassifier.py", line 52, in __init__
    modelprt =  AlbertModel.from_pretrained(pretrained_model_name_or_path='AOUTPR21/model.ckpt-10000', config=self.ptcfg, from_tf=True)
  File "/usr/local/lib/python3.6/dist-packages/transformers/modeling_utils.py", line 1331, in from_pretrained
    model = cls.load_tf_weights(model, config, resolved_archive_file[:-6])  # Remove the '.index'
  File "/usr/local/lib/python3.6/dist-packages/transformers/models/albert/modeling_albert.py", line 169, in load_tf_weights_in_albert
    pointer = getattr(pointer, "bias")
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 1131, in __getattr__
    type(self).__name__, name))
AttributeError: 'AlbertModel' object has no attribute 'bias'


## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->
I expected that no error will come up
Since your tf checkpoint has a prediction head which isn't included in `AlbertModel`, using `AlbertForPreTraining` should solve the problem. But `AlbertForPreTraining` currently has a small alias bug, I'll open a PR for the fix.<|||||>> Since your tf checkpoint has a prediction head which isn't included in `AlbertModel`, using `AlbertForPreTraining` should solve the problem. But `AlbertForPreTraining` currently has a small alias bug, I'll open a PR for the fix.

Many Thanks. I saw you recommended that I use **AlbertForPreTraining**, and then you said **AlbertForPreTraining**  has a bug. So I should I wait on the fix before proceeding correct?<|||||>> > Since your tf checkpoint has a prediction head which isn't included in `AlbertModel`, using `AlbertForPreTraining` should solve the problem. But `AlbertForPreTraining` currently has a small alias bug, I'll open a PR for the fix.
> 
> Many Thanks. I saw you recommended that I use **AlbertForPreTraining**, and then you said **AlbertForPreTraining** has a bug. So I should I wait on the fix before proceeding correct?

That's right. If you switch to `AlbertForPreTraining` now, you may encounter another error as the alias was not set at the right place.<|||||>> > > Since your tf checkpoint has a prediction head which isn't included in `AlbertModel`, using `AlbertForPreTraining` should solve the problem. But `AlbertForPreTraining` currently has a small alias bug, I'll open a PR for the fix.
> > 
> > 
> > Many Thanks. I saw you recommended that I use **AlbertForPreTraining**, and then you said **AlbertForPreTraining** has a bug. So I should I wait on the fix before proceeding correct?
> 
> That's right. If you switch to `AlbertForPreTraining` now, you may encounter another error as the alias was not set at the right place.

Sounds good, I will wait. Thanks again.<|||||>Hi, the PR has been merged. You can install transformers from source and test whether it works as expected :-)<|||||>> Hi, the PR has been merged. You can install transformers from source and test whether it works as expected :-)

Will do. Thanks<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.