Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
whisper-asr-webservice
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Automate
Agent sessions
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Schwertgen
whisper-asr-webservice
Commits
076f99e6
Commit
076f99e6
authored
10 months ago
by
Aidan Crowther
Browse files
Options
Downloads
Patches
Plain Diff
Add environment variable definition to documentation and disable timeout by default
parent
e104eca0
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/faster_whisper/core.py
+3
-2
3 additions, 2 deletions
app/faster_whisper/core.py
app/openai_whisper/core.py
+3
-2
3 additions, 2 deletions
app/openai_whisper/core.py
docs/environmental-variables.md
+8
-0
8 additions, 0 deletions
docs/environmental-variables.md
with
14 additions
and
4 deletions
app/faster_whisper/core.py
+
3
−
2
View file @
076f99e6
...
@@ -20,12 +20,13 @@ model_lock = Lock()
...
@@ -20,12 +20,13 @@ model_lock = Lock()
# https://opennmt.net/CTranslate2/quantization.html
# https://opennmt.net/CTranslate2/quantization.html
last_activity_time
=
time
.
time
()
last_activity_time
=
time
.
time
()
idle_timeout
=
int
(
os
.
getenv
(
"
IDLE_TIMEOUT
"
,
30
0
))
# default to
5 minutes
idle_timeout
=
int
(
os
.
getenv
(
"
IDLE_TIMEOUT
"
,
0
))
# default to
being disabled
def
monitor_idleness
():
def
monitor_idleness
():
global
model
global
model
if
(
idle_timeout
<=
0
):
return
while
True
:
while
True
:
time
.
sleep
(
60
)
# check every minute
time
.
sleep
(
15
)
if
time
.
time
()
-
last_activity_time
>
idle_timeout
:
if
time
.
time
()
-
last_activity_time
>
idle_timeout
:
with
model_lock
:
with
model_lock
:
release_model
()
release_model
()
...
...
This diff is collapsed.
Click to expand it.
app/openai_whisper/core.py
+
3
−
2
View file @
076f99e6
...
@@ -15,12 +15,13 @@ model = None
...
@@ -15,12 +15,13 @@ model = None
model_lock
=
Lock
()
model_lock
=
Lock
()
last_activity_time
=
time
.
time
()
last_activity_time
=
time
.
time
()
idle_timeout
=
int
(
os
.
getenv
(
"
IDLE_TIMEOUT
"
,
30
0
))
# default to
5 minutes
idle_timeout
=
int
(
os
.
getenv
(
"
IDLE_TIMEOUT
"
,
0
))
# default to
being disabled
def
monitor_idleness
():
def
monitor_idleness
():
global
model
global
model
if
(
idle_timeout
<=
0
):
return
while
True
:
while
True
:
time
.
sleep
(
60
)
# check every minute
time
.
sleep
(
15
)
# check every minute
if
time
.
time
()
-
last_activity_time
>
idle_timeout
:
if
time
.
time
()
-
last_activity_time
>
idle_timeout
:
with
model_lock
:
with
model_lock
:
release_model
()
release_model
()
...
...
This diff is collapsed.
Click to expand it.
docs/environmental-variables.md
+
8
−
0
View file @
076f99e6
...
@@ -24,3 +24,11 @@ For English-only applications, the `.en` models tend to perform better, especial
...
@@ -24,3 +24,11 @@ For English-only applications, the `.en` models tend to perform better, especial
```
sh
```
sh
export
ASR_MODEL_PATH
=
/data/whisper
export
ASR_MODEL_PATH
=
/data/whisper
```
```
### Configuring the `Model Unloading Timeout`
```
sh
export
IDLE_TIMEOUT
=
300
```
After no activity for this period (in seconds), unload the model until it is requested again. When set to 0, there will be no timeout.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment