Spaces:
Build error
Build error
File size: 696 Bytes
7365efc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import os
from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer
# Create the models directory if it doesn't exist
os.makedirs("./models", exist_ok=True)
os.makedirs("./models/tokenizer", exist_ok=True)
os.makedirs("./models/model", exist_ok=True)
print("Downloading and saving tokenizer...")
tokenizer = Wav2Vec2Tokenizer.from_pretrained("facebook/wav2vec2-base-960h")
tokenizer.save_pretrained("./models/tokenizer")
print("Tokenizer saved successfully.")
print("Downloading and saving model...")
model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")
model.save_pretrained("./models/model")
print("Model saved successfully.")
print("Download and save process completed.") |