How to load Wav2Vec2Processor from local model directory?

Hello,

I have a fine-tuned model saved in the local directory. I can load the model using the code below:

from transformers import Wav2Vec2ForCTC

model = Wav2Vec2ForCTC.from_pretrained("/home/ramil/wav2vec2-large-xlsr-turkish-demo/checkpoint-11400")

But when I try to load the processor:

from transformers import Wav2Vec2Processor

model = Wav2Vec2Processor.from_pretrained("/home/ramil/wav2vec2-large-xlsr-turkish-demo/checkpoint-11400")

I am getting "OSError: Can't load tokenizer for '/home/ramil/wav2vec2-large-xlsr-turkish-demo/checkpoint-11400'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '/home/ramil/wav2vec2-large-xlsr-turkish-demo/checkpoint-11400' is the correct path to a directory containing all relevant files for a Wav2Vec2CTCTokenizer tokenizer"

I would appreciate your help with this matter.

You need to save the processor along your model in the same folder:

Wav2Vec2Processor.save_pretrained(xxx)
1 Like

Is the processor affected during the training process? Or It is not affected so that I can save it either before or after training?

It’s not affected.

Thank you very much!