Spaces:
Running
on
T4
Running
on
T4
Fedir Zadniprovskyi
commited on
Commit
•
196f56a
1
Parent(s):
d2c39a2
chore: adjust model manager test sleep delay
Browse files
src/faster_whisper_server/api_models.py
CHANGED
@@ -69,7 +69,7 @@ class TranscriptionSegment(BaseModel):
|
|
69 |
end=segment.end,
|
70 |
text=segment.text,
|
71 |
tokens=segment.tokens,
|
72 |
-
temperature=segment.temperature,
|
73 |
avg_logprob=segment.avg_logprob,
|
74 |
compression_ratio=segment.compression_ratio,
|
75 |
no_speech_prob=segment.no_speech_prob,
|
|
|
69 |
end=segment.end,
|
70 |
text=segment.text,
|
71 |
tokens=segment.tokens,
|
72 |
+
temperature=segment.temperature or 0, # FIX: hardcoded
|
73 |
avg_logprob=segment.avg_logprob,
|
74 |
compression_ratio=segment.compression_ratio,
|
75 |
no_speech_prob=segment.no_speech_prob,
|
tests/model_manager_test.py
CHANGED
@@ -20,7 +20,7 @@ async def test_model_unloaded_after_ttl() -> None:
|
|
20 |
await aclient.post(f"/api/ps/{model}")
|
21 |
res = (await aclient.get("/api/ps")).json()
|
22 |
assert len(res["models"]) == 1
|
23 |
-
await asyncio.sleep(ttl + 1)
|
24 |
res = (await aclient.get("/api/ps")).json()
|
25 |
assert len(res["models"]) == 0
|
26 |
|
@@ -35,7 +35,7 @@ async def test_ttl_resets_after_usage() -> None:
|
|
35 |
await aclient.post(f"/api/ps/{model}")
|
36 |
res = (await aclient.get("/api/ps")).json()
|
37 |
assert len(res["models"]) == 1
|
38 |
-
await asyncio.sleep(ttl - 2)
|
39 |
res = (await aclient.get("/api/ps")).json()
|
40 |
assert len(res["models"]) == 1
|
41 |
|
@@ -48,11 +48,11 @@ async def test_ttl_resets_after_usage() -> None:
|
|
48 |
).json()
|
49 |
res = (await aclient.get("/api/ps")).json()
|
50 |
assert len(res["models"]) == 1
|
51 |
-
await asyncio.sleep(ttl - 2)
|
52 |
res = (await aclient.get("/api/ps")).json()
|
53 |
assert len(res["models"]) == 1
|
54 |
|
55 |
-
await asyncio.sleep(3)
|
56 |
res = (await aclient.get("/api/ps")).json()
|
57 |
assert len(res["models"]) == 0
|
58 |
|
@@ -80,7 +80,7 @@ async def test_model_cant_be_unloaded_when_used() -> None:
|
|
80 |
"/v1/audio/transcriptions", files={"file": ("audio.wav", data, "audio/wav")}, data={"model": model}
|
81 |
)
|
82 |
)
|
83 |
-
await asyncio.sleep(0.
|
84 |
res = await aclient.delete(f"/api/ps/{model}")
|
85 |
assert res.status_code == 409
|
86 |
|
|
|
20 |
await aclient.post(f"/api/ps/{model}")
|
21 |
res = (await aclient.get("/api/ps")).json()
|
22 |
assert len(res["models"]) == 1
|
23 |
+
await asyncio.sleep(ttl + 1) # wait for the model to be unloaded
|
24 |
res = (await aclient.get("/api/ps")).json()
|
25 |
assert len(res["models"]) == 0
|
26 |
|
|
|
35 |
await aclient.post(f"/api/ps/{model}")
|
36 |
res = (await aclient.get("/api/ps")).json()
|
37 |
assert len(res["models"]) == 1
|
38 |
+
await asyncio.sleep(ttl - 2) # sleep for less than the ttl. The model should not be unloaded
|
39 |
res = (await aclient.get("/api/ps")).json()
|
40 |
assert len(res["models"]) == 1
|
41 |
|
|
|
48 |
).json()
|
49 |
res = (await aclient.get("/api/ps")).json()
|
50 |
assert len(res["models"]) == 1
|
51 |
+
await asyncio.sleep(ttl - 2) # sleep for less than the ttl. The model should not be unloaded
|
52 |
res = (await aclient.get("/api/ps")).json()
|
53 |
assert len(res["models"]) == 1
|
54 |
|
55 |
+
await asyncio.sleep(3) # sleep for a bit more. The model should be unloaded
|
56 |
res = (await aclient.get("/api/ps")).json()
|
57 |
assert len(res["models"]) == 0
|
58 |
|
|
|
80 |
"/v1/audio/transcriptions", files={"file": ("audio.wav", data, "audio/wav")}, data={"model": model}
|
81 |
)
|
82 |
)
|
83 |
+
await asyncio.sleep(0.1) # wait for the server to start processing the request
|
84 |
res = await aclient.delete(f"/api/ps/{model}")
|
85 |
assert res.status_code == 409
|
86 |
|