Spaces:
Runtime error
Runtime error
trip-fontaine
commited on
Commit
•
f4a680a
1
Parent(s):
ae97053
warmup
Browse files- app.py +9 -9
- requirements.txt +2 -1
app.py
CHANGED
@@ -104,15 +104,15 @@ def transcribe(inputs):
|
|
104 |
yield distil_text, distil_runtime, text, runtime
|
105 |
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
|
117 |
|
118 |
|
|
|
104 |
yield distil_text, distil_runtime, text, runtime
|
105 |
|
106 |
|
107 |
+
print("Warming up...")
|
108 |
+
inputs = np.random.randn(30 * pipe.feature_extractor.sampling_rate)
|
109 |
+
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
110 |
+
|
111 |
+
for _ in range(N_WARMUP):
|
112 |
+
_ = pipe_forward(inputs.copy(), batch_size=BATCH_SIZE)["text"]
|
113 |
+
_ = distil_pipe_forward(inputs.copy(), batch_size=BATCH_SIZE)["text"]
|
114 |
+
print(_)
|
115 |
+
print("Models warmed up!")
|
116 |
|
117 |
|
118 |
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
transformers
|
2 |
-
accelerate
|
|
|
|
1 |
transformers
|
2 |
+
accelerate
|
3 |
+
numpy
|