Skip to content

Docker gunicorn implementation stuck to transcribe in flask environment #514

@danirisdiandita

Description

@danirisdiandita

when i run whisper model using flask app in gunicorn (in Docker). The transcription didn't work

from faster_whisper import WhisperModel 
class WhisperTranscriber(): 
    def __init__(self) -> None:
        self.faster_whisper = WhisperModel('/app/apps/model/whisper_medium', device='cpu', compute_type="int8")
    def transcribe(self, filepath): 
        # this part below stuck forever when run transcribe 
        segments, info = self.faster_whisper.transcribe(filepath, beam_size=5, word_timestamps=True)
        for seg in segments: 
             print(seg.text)

however, when i run the script in a docker exec -it <container_name> /bin/bash and run python script the inference works well

the gunicorn config gunicorn-cfg.py is shown below

workers = 1
accesslog = "-"
loglevel = "debug"
capture_output = True
enable_stdio_inheritance = True

and the command when running docker

gunicorn --timeout 7200 --certfile=server.crt --keyfile=server.key --config gunicorn-cfg.py -b 0.0.0.0:5005 run:app

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions