Update app.py
Browse files
app.py
CHANGED
@@ -10,13 +10,13 @@ from transformers import (
|
|
10 |
AutoModelForSpeechSeq2Seq,
|
11 |
TrainingArguments,
|
12 |
Trainer,
|
13 |
-
|
14 |
)
|
15 |
|
16 |
# ================================
|
17 |
# 1οΈβ£ Authenticate with Hugging Face Hub (Securely)
|
18 |
# ================================
|
19 |
-
HF_TOKEN = os.getenv("
|
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 =
|
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(
|