Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adjust model manager test sleep delay #184

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/faster_whisper_server/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def from_faster_whisper_segments(
end=segment.end,
text=segment.text,
tokens=segment.tokens,
temperature=segment.temperature,
temperature=segment.temperature or 0, # FIX: hardcoded
avg_logprob=segment.avg_logprob,
compression_ratio=segment.compression_ratio,
no_speech_prob=segment.no_speech_prob,
Expand Down
10 changes: 5 additions & 5 deletions tests/model_manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def test_model_unloaded_after_ttl() -> None:
await aclient.post(f"/api/ps/{model}")
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 1
await asyncio.sleep(ttl + 1)
await asyncio.sleep(ttl + 1) # wait for the model to be unloaded
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 0

Expand All @@ -35,7 +35,7 @@ async def test_ttl_resets_after_usage() -> None:
await aclient.post(f"/api/ps/{model}")
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 1
await asyncio.sleep(ttl - 2)
await asyncio.sleep(ttl - 2) # sleep for less than the ttl. The model should not be unloaded
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 1

Expand All @@ -48,11 +48,11 @@ async def test_ttl_resets_after_usage() -> None:
).json()
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 1
await asyncio.sleep(ttl - 2)
await asyncio.sleep(ttl - 2) # sleep for less than the ttl. The model should not be unloaded
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 1

await asyncio.sleep(3)
await asyncio.sleep(3) # sleep for a bit more. The model should be unloaded
res = (await aclient.get("/api/ps")).json()
assert len(res["models"]) == 0

Expand Down Expand Up @@ -80,7 +80,7 @@ async def test_model_cant_be_unloaded_when_used() -> None:
"/v1/audio/transcriptions", files={"file": ("audio.wav", data, "audio/wav")}, data={"model": model}
)
)
await asyncio.sleep(0.01)
await asyncio.sleep(0.1) # wait for the server to start processing the request
res = await aclient.delete(f"/api/ps/{model}")
assert res.status_code == 409

Expand Down
Loading