I fine-tuned a pre-trained model(wav2vec) in hugging face using the transformers library and converted it from PyTorch to Tensorflow. I want to load this fine-tuned model in Tensorlfow but I can’t seem to find any tutorials showcasing how to. Any help would be appreciated.
from transformers import TFWav2Vec2ForXxx TFWav2Vec2ForXxx.from_pretrained(model_name_or_path)
model_name_or_path is the folder where you stored that model, or the name of the repo you pushed it to on the Hugging Face Hub.
How would i load this model in tensorflow , wouldn’t this be loading it using huggingface ?
The TensorFlow library does not offer an implementation of the Wav2Vec2 model, so I’m not sure how you would like to be loading it without using Transformers.
well there is this
This is one particular model, not the architecture. Since the person that added it to the TF Hub is a core contributor to Transformers, it’s probably the same code as in the library behind it.
okay thank you i am going to try to retrain the model in pure tenserflow
I’m not sure you need to, you can save the model loaded as above in any pure TF format you want. As you would when retraining the model in pure TensorFlow.
Well my main goal is to be able to load the wav2vec model inside tensorflow and after training a pytroch model inside hugging face and converting it to tensorflow I get a h5 file and a seperate config file .
when I try to load it like this it gives me this error but when I try running this notebook:
which is the wav2vec model the guy upload to tensorflow this part works :
soo Idk what’s wrong with this .
Thank you for being patient with me
As I said, first load it inside a
TFWav2Vec2ForXxx model (I’m not sure exactly which model you used, replaced the Xxx to the proper name). You can do this with
This model will be a Keras model. You can save it using Keras, so should be able to then load it with Keras.
okay thank you i will try this i am sorry for wasting ur time