File size: 756 Bytes
1ae875b 8c93826 1ae875b 8c93826 93097a6 1ae875b 8c93826 1ae875b 8c93826 1ae875b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from datasets import load_dataset
from transformers import FastSpeechForConditionalGeneration, Trainer, TrainingArguments
# تحميل البيانات للهجة النجدية
dataset = load_dataset("m6011/sada2022")
najdi_data = dataset.filter(lambda example: example['SpeakerDialect'] == 'Najdi')
# إعداد النموذج
model = FastSpeechForConditionalGeneration.from_pretrained("facebook/fastspeech2-en-ljspeech")
# إعداد المدرب
training_args = TrainingArguments(
output_dir="./results",
per_device_train_batch_size=4,
num_train_epochs=5,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=najdi_data['train'],
eval_dataset=najdi_data['test']
)
# بدء التدريب
trainer.train()
|