tahirsher commited on
Commit
26ada0a
Β·
verified Β·
1 Parent(s): 859561d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -10,13 +10,13 @@ from transformers import (
10
  AutoModelForSpeechSeq2Seq,
11
  TrainingArguments,
12
  Trainer,
13
- DataCollatorSpeechSeq2Seq, # βœ… Fix: Use correct data collator
14
  )
15
 
16
  # ================================
17
  # 1️⃣ Authenticate with Hugging Face Hub (Securely)
18
  # ================================
19
- HF_TOKEN = os.getenv("hf_token") # Ensure it's set in Hugging Face Spaces Secrets
20
 
21
  if HF_TOKEN is None:
22
  raise ValueError("❌ Hugging Face API token not found. Please set it in Secrets.")
@@ -117,7 +117,7 @@ training_args = TrainingArguments(
117
  )
118
 
119
  # βœ… FIX: Use correct Data Collator
120
- data_collator = DataCollatorSpeechSeq2Seq(processor=processor, model=model, return_tensors="pt")
121
 
122
  # Define Trainer
123
  trainer = Trainer(
 
10
  AutoModelForSpeechSeq2Seq,
11
  TrainingArguments,
12
  Trainer,
13
+ DataCollatorForSeq2Seq, # βœ… Fix: Use correct data collator
14
  )
15
 
16
  # ================================
17
  # 1️⃣ Authenticate with Hugging Face Hub (Securely)
18
  # ================================
19
+ HF_TOKEN = os.getenv("HF_TOKEN") # Ensure it's set in Hugging Face Spaces Secrets
20
 
21
  if HF_TOKEN is None:
22
  raise ValueError("❌ Hugging Face API token not found. Please set it in Secrets.")
 
117
  )
118
 
119
  # βœ… FIX: Use correct Data Collator
120
+ data_collator = DataCollatorForSeq2Seq(tokenizer=processor.tokenizer, model=model, return_tensors="pt")
121
 
122
  # Define Trainer
123
  trainer = Trainer(