[WIP] Add VGCN-BERT model
Author: Louis-udm
Pull request: yes

# What does this PR do?
Adds the VGCN-BERT model from [VGCN-BERT: Augmenting BERT with Graph Embedding for Text Classification](https://arxiv.org/abs/2004.05707) paper.

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes #24038 (issue)


## 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#start-contributing-pull-requests),
      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. [24038](https://github.com/huggingface/transformers/issues/24038)
- [x] 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).
- [x] 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: @sgugger

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam

Documentation: @sgugger, @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: @sgugger
- TensorFlow: @Rocketknight1

 -->


Comments:
cc @ArthurZucker @younesbelkada 

Hey! Thanks a lot for opening this PR 🔥 
We have been pushing a lot for models to be on the hub, as it is a lot easier to implement ! What do you think about trying [this tutorial out](https://huggingface.co/docs/transformers/custom_models)! 

> Hey! Thanks a lot for opening this PR 🔥 We have been pushing a lot for models to be on the hub, as it is a lot easier to implement ! What do you think about trying [this tutorial out](https://huggingface.co/docs/transformers/custom_models)!

Thanks for your reply @ArthurZucker . I am trying with the new way and put model with code to [here in hub](https://huggingface.co/zhibinlu/vgcn-bert-distilbert-base-uncased)
but I found I can not put my `modeling_graph.py` in my upload script with this function `model.push_to_hub`. Also, people need import it using `from transformers.models.vgcn_bert.modeling_graph import WordGraph` in this PR, but do you have a suggestion when I put it in hub?

And, how to put model.safetensors instead of model.bin;
how to put other files like `README.md` (I create manually in the hub UI), `tokenizer.json` etc.

my upload script
```
from vgcn_bert.configuration_vgcn_bert import VGCNBertConfig
from vgcn_bert.modeling_vgcn_bert import VGCNBertModel, VGCNBertForMaskedLM, VGCNBertForMultipleChoice, VGCNBertForQuestionAnswering, VGCNBertForSequenceClassification, VGCNBertForTokenClassification

import transformers as tfr
from vgcn_bert.modeling_graph import WordGraph

VGCNBertConfig.register_for_auto_class()
VGCNBertModel.register_for_auto_class("AutoModel")
VGCNBertForMaskedLM.register_for_auto_class("AutoModelForMaskedLM")
VGCNBertForMultipleChoice.register_for_auto_class("AutoModelForMultipleChoice")
VGCNBertForQuestionAnswering.register_for_auto_class("AutoModelForQuestionAnswering")
VGCNBertForSequenceClassification.register_for_auto_class("AutoModelForSequenceClassification")
VGCNBertForTokenClassification.register_for_auto_class("AutoModelForTokenClassification")

tokenizer = tfr.AutoTokenizer.from_pretrained(
    "zhibinlu/vgcn-distilbert-base-uncased"
)

model = VGCNBertModel.from_pretrained(
    "zhibinlu/vgcn-distilbert-base-uncased",
)

from huggingface_hub import notebook_login

notebook_login()
model.push_to_hub("vgcn-bert-distilbert-base-uncased")
```

Oups your question slipped through the cracks, let me answers to the best of my knowledge

> 1. I found I can not put my modeling_graph.py in my upload script with this function model.push_to_hub. 
> 2. Also, people need import it using from transformers.models.vgcn_bert.modeling_graph import WordGraph in this PR, but do you have a suggestion when I put it in hub?
> 3. And, how to put model.safetensors instead of model.bin;
> 4. how to put other files like README.md (I create manually in the hub UI), tokenizer.json etc.

1. That is expected, if you have a look at this [doc page](https://huggingface.co/docs/hub/models-uploading#using-the-huggingfacehub-client-library), it will help you upload the actual code. `push_to_hub` is not made for this!
2. When you put the code on the hub (using `upload` or equivalent), then you simply need to create a `config.json`. If you want an example, here is [one](https://huggingface.co/tiiuae/falcon-7b/blob/main/config.json). Falcon is hosted on the hub. 
3. You should be able to save the safetensors weights using `use_safetensors=True` option when pushing to the hub/saving the model.
4. The readme can also be uploaded on the hub like any other files. You can push the tokenizer using `tokenizer.push_to_hub("path")`

hope this helps you 

> > 1. I found I can not put my modeling_graph.py in my upload script with this function model.push_to_hub.
> > 2. Also, people need import it using from transformers.models.vgcn_bert.modeling_graph import WordGraph in this PR, but do you have a suggestion when I put it in hub?
> > 3. And, how to put model.safetensors instead of model.bin;
> > 4. how to put other files like README.md (I create manually in the hub UI), tokenizer.json etc.
> 
> 1. That is expected, if you have a look at this [doc page](https://huggingface.co/docs/hub/models-uploading#using-the-huggingfacehub-client-library), it will help you upload the actual code. `push_to_hub` is not made for this!
> 2. When you put the code on the hub (using `upload` or equivalent), then you simply need to create a `config.json`. If you want an example, here is [one](https://huggingface.co/tiiuae/falcon-7b/blob/main/config.json). Falcon is hosted on the hub.
> 3. You should be able to save the safetensors weights using `use_safetensors=True` option when pushing to the hub/saving the model.
> 4. The readme can also be uploaded on the hub like any other files. You can push the tokenizer using `tokenizer.push_to_hub("path")`
> 
> hope this helps you

@ArthurZucker Ok, these answers will help me, after getting rid of all the problems, I will cancel this PR.

The new implement is here:
https://huggingface.co/zhibinlu/vgcn-bert-distilbert-base-uncased

Thanks a lot for sharing this and adding this model! 🔥