Spaces:
Sleeping
Sleeping
Update tasks/audio.py
Browse files- tasks/audio.py +3 -6
tasks/audio.py
CHANGED
@@ -56,12 +56,8 @@ async def evaluate_audio(request: AudioEvaluationRequest):
|
|
56 |
feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
|
57 |
|
58 |
# Prétraitement en streaming avec fonction explicite
|
59 |
-
test_dataset = test_dataset.map(
|
60 |
-
|
61 |
-
fn_kwargs={"feature_extractor": feature_extractor},
|
62 |
-
remove_columns=["audio"]
|
63 |
-
)
|
64 |
-
logging.info(test_dataset)
|
65 |
del feature_extractor # Libération explicite
|
66 |
gc.collect()
|
67 |
|
@@ -72,6 +68,7 @@ async def evaluate_audio(request: AudioEvaluationRequest):
|
|
72 |
logging.info("Début des prédictions par batch")
|
73 |
|
74 |
for data in test_dataset:
|
|
|
75 |
with torch.no_grad():
|
76 |
result = classifier(np.asarray(data["input_values"]))
|
77 |
|
|
|
56 |
feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
|
57 |
|
58 |
# Prétraitement en streaming avec fonction explicite
|
59 |
+
test_dataset = test_dataset.map(preprocess_function, remove_columns="audio", batched=True)
|
60 |
+
|
|
|
|
|
|
|
|
|
61 |
del feature_extractor # Libération explicite
|
62 |
gc.collect()
|
63 |
|
|
|
68 |
logging.info("Début des prédictions par batch")
|
69 |
|
70 |
for data in test_dataset:
|
71 |
+
logging.info(data)
|
72 |
with torch.no_grad():
|
73 |
result = classifier(np.asarray(data["input_values"]))
|
74 |
|