Add D_Nikud model
Author: NadavShaked
Pull request: no
Labels: name: New model

### Model description

Model description
The repository is dedicated to the implementation of our innovative D-Nikud model, which use the TavBERT architecture and Bi-LSTM to predict and apply diacritics (nikud) to Hebrew text. Diacritics play a crucial role in accurately conveying pronunciation and interpretation, making our model an essential tool for enhancing the quality of Hebrew text analysis.

Open source status
 The model implementation is available
 The model weights are available

Provide useful links for the implementation
Github: https://github.com/NadavShaked/D_Nikud
HuggingFaceHub: https://huggingface.co/NadavShaked/D_Nikud (include the model weights at model folder)
model weights: https://drive.google.com/drive/folders/1osK503txvsEWlZASBViSqOiNJMzAlD0F
Paper: https://arxiv.org/abs/2402.00075
train/dev/test data: https://github.com/NadavShaked/D_Nikud_Data


### Open source status

- [X] The model implementation is available
- [X] The model weights are available

### Provide useful links for the implementation

In the readme file there are an explanation how to run the predict, train and eval methods

Comments:
Hi @NadavShaked, thanks for opening this new model request! 

The easiest and recommended way to make a model available in `transformers` is to add the modeling code directly on the hub: https://huggingface.co/docs/transformers/custom_models. This means, once working, the model can be found and used immediately without having to go through the lengthy PR process. 

Thanks for reply @amyeroberts,
I tried to follow after the instructions, but I got this error in 'Hosted inference API' widget:
![image](https://github.com/huggingface/transformers/assets/19892483/03e5a5cd-6b14-497a-829f-09c943ae30b6)
I see the "model_type" key in my config, so I didnt understand what could cause this error

do you have any suggestion?


this is the repo I created with the bin file:
https://huggingface.co/NadavShaked/d_nikud23?text=%D7%A9%D7%9C%D7%95%D7%9D

this is the original repo
HuggingFaceHub: https://huggingface.co/NadavShaked/D_Nikud (include the model weights at model folder)



-------------------------
UPDATE:
to fix it I update the model_type in the model and not only in the model config field

Hi @NadavShaked, hmmm, I'm not sure why this is happening. Could you confirm that you still see this error? 

When I go to https://huggingface.co/NadavShaked/d_nikud23, I see a different error

https://huggingface.co/NadavShaked/d_nikud23

which I believe is occurring because the code containing the model class definitions aren't uploaded yet. 

Hey @amyeroberts , thanks for the reply.
Yes, I handled the last error, sorry for missing the update here, now I got a new one.
what do you mean in "which I believe is occurring because the code containing the model class definitions aren't uploaded yet."

Hi

Could you provide a code snippet that show the error when you try to use this model on the Hub (remote code). Thank you 🤗 

Hey @ydshieh , thanks for the reply,
This is the repos with the code
Github: https://github.com/NadavShaked/D_Nikud
HuggingFaceHub: https://huggingface.co/NadavShaked/D_Nikud (include the model weights at the model folder)
Model weights: https://drive.google.com/drive/folders/1osK503txvsEWlZASBViSqOiNJMzAlD0F

this is the hugging face hub with the incorrect Hosted inference API: https://huggingface.co/NadavShaked/d_nikud23

Let's not to get bother by ` 'Hosted inference API' widget:`. The first thing is to check if you can load this model (use `from_pretrained` with `trust_remote_code=True`) then use the loaded model to do an inference.

@ydshieh I tested it and looks like it's not the model...

I added this scope to the code, which overrides the original model.
![image](https://github.com/huggingface/transformers/assets/19892483/3d73c864-e97c-4133-a185-9f13edb954a3)

We expected to get 3 objects but got 2
![image](https://github.com/huggingface/transformers/assets/19892483/e07a6cf9-e8c4-44a3-a01c-87b087874ad6)
probably I published only the tokenizer model and not the whole model, although I thought I pushed it to hub correctly

In addition,
I think that the pipeline crushed because the model required as input two arrays:
The one is a tokenized array for the string (by using tavBert tokenizer
    tokenizer_tavbert = AutoTokenizer.from_pretrained("tau/tavbert-he")

)
and the second is the attention mask

and the output should be processed too

any suggestion how to publish the original model? and not only the first part of the model? and how to solve the pipeline
![image](https://github.com/huggingface/transformers/assets/19892483/5e7101f9-09f6-47d5-9511-47dedd8c0f4d)
rocessing issue

@ydshieh do you have any suggestion?

@NadavShaked Sorry, didn't get notified previously.

First, please don't use screenshot as the main method of sharing code/erro. Use text (in a proper format) instead.

Can't really say about `AutoModel.from_pretrained(...)`, but from the error message, it looks like there is some mistakes in the modeling class definition file, about the number of actual and expected outputs elements.

Only you who could do the debugging on the your custom modeling file. Follow the error logs and resolve them step by step is the way to go.