Fix 'vocab_size' attribute of LlavaConfig
Author: ywang96
Pull request: yes

# What does this PR do?
This PR fixes a bug from https://github.com/huggingface/transformers/pull/29586 where it made `vocab_size` a [read-only property](https://github.com/huggingface/transformers/pull/29586/files#diff-17ae6c8e2e43649b0eb9cd73161c53e6bf9d92c8dbc9a96f1ce813207b8e9bf7R142-R148) of `LlavaConfig`, preventing it from being assigned during the `super().__init__(**kwargs)`. The fix is to pop `vocab_size` from kwargs before we call `super().__init__(**kwargs)`.

Fixes #https://github.com/huggingface/transformers/issues/29789



## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR 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.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @pacman100

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada

Documentation: @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


Comments:
@amyeroberts Could you please take a look since you reviewed the original Llava-1.6 PR?

cc @xwjiang2010

related https://github.com/huggingface/transformers/pull/29389#discussion_r1535069438

@ywang96 Thanks for opening this PR! 

We merged in #29389, which handles the breaking error. Thinking about it more, at the moment, we shouldn't need to pop from the kwargs with the setter solution. Later, once deprecated (i.e. we've had a ~2 months of warnings that it's not used), we'll want to allow users to still pass in this argument, as technically for any config I can do: 

```
config = MyConfigClass(foo=5)
```

and the param foo will be set, even if it's not a argument of the config. So we really keep `vocab_size` (even if it is admittedly confusing to have it there). 

Closing for now, as the issue is addressed.

> @ywang96 Thanks for opening this PR!
> 
> We merged in #29389, which handles the breaking error. Thinking about it more, at the moment, we shouldn't need to pop from the kwargs with the setter solution. Later, once deprecated (i.e. we've had a ~2 months of warnings that it's not used), we'll want to allow users to still pass in this argument, as technically for any config I can do:
> 
> ```
> config = MyConfigClass(foo=5)
> ```
> 
> and the param foo will be set, even if it's not a argument of the config. So we really keep `vocab_size` (even if it is admittedly confusing to have it there).
> 
> Closing for now, as the issue is addressed.

Sounds good - I'm okay with either as long as the issue is fixed, and I agree the setter solution is cleaner. Thanks!

@ywang96 A patch v4.39.1 has just been released with the fix