-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hi! First of all, thank you for the amazing work on this package!
I am integrating Whisper.php into my Laravel project to implement a transcription API endpoint. However, I am encountering a strange issue that results in a 502 Bad Gateway error when processing requests.
Debugging Steps Taken
- Initially, the endpoint returned a 502 Bad Gateway response.
- Upon checking the Laravel Herd Nginx error logs, I found the following error message:
[error] 77725#32945537: *3 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: *****.test, request: "POST /api/v1/audio/transcriptions HTTP/1.1",
- To investigate further, I enabled logging in Whisper.php. However, the logs consistently stop at a specific point, and no further output or errors are shown.
Logs and Code
Whisper.php Logs:
[2024-12-17 14:00:03] local.INFO: whisper_init_from_file_with_params_no_state: loading model from '/Users/test/*****/*****/storage/app/models/ggml-base.bin'
[2024-12-17 14:00:03] local.INFO: whisper_init_with_params_no_state: use gpu = 0
[2024-12-17 14:00:03] local.INFO: whisper_init_with_params_no_state: flash attn = 0
[2024-12-17 14:00:03] local.INFO: whisper_init_with_params_no_state: gpu_device = 0
[2024-12-17 14:00:03] local.INFO: whisper_init_with_params_no_state: dtw = 0
[2024-12-17 14:00:03] local.INFO: whisper_init_with_params_no_state: devices = 3
[2024-12-17 14:00:03] local.INFO: whisper_init_with_params_no_state: backends = 3
[2024-12-17 14:00:03] local.INFO: whisper_model_load: loading model
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_vocab = 51865
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_audio_ctx = 1500
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_audio_state = 512
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_audio_head = 8
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_audio_layer = 6
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_text_ctx = 448
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_text_state = 512
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_text_head = 8
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_text_layer = 6
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_mels = 80
[2024-12-17 14:00:03] local.INFO: whisper_model_load: ftype = 1
[2024-12-17 14:00:03] local.INFO: whisper_model_load: qntvr = 0
[2024-12-17 14:00:03] local.INFO: whisper_model_load: type = 2 (base)
[2024-12-17 14:00:03] local.INFO: whisper_model_load: adding 1608 extra tokens
[2024-12-17 14:00:03] local.INFO: whisper_model_load: n_langs = 99
[2024-12-17 14:00:03] local.INFO: whisper_model_load: CPU total size = 147.37 MB
[2024-12-17 14:00:03] local.INFO: whisper_model_load: model size = 147.37 MB
[2024-12-17 14:00:03] local.INFO: whisper_backend_init: using BLAS backend
[2024-12-17 14:00:03] local.INFO: whisper_init_state: kv self size = 6.29 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: kv cross size = 18.87 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: kv pad size = 3.15 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (conv) = 16.26 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (encode) = 85.86 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (cross) = 4.65 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (decode) = 96.35 MB
[2024-12-17 14:00:03] local.INFO: whisper_backend_init: using BLAS backend
[2024-12-17 14:00:03] local.INFO: whisper_init_state: kv self size = 6.29 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: kv cross size = 18.87 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: kv pad size = 3.15 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (conv) = 16.26 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (encode) = 85.86 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (cross) = 4.65 MB
[2024-12-17 14:00:03] local.INFO: whisper_init_state: compute buffer (decode) = 96.35 MB
Current Implementation Code:
$file = $request->file('file')->store('audios');
Whisper::setLogger(Log::getLogger());
$whisper = Whisper::fromPretrained('base', baseDir: storage_path('app/models'));
$audio = readAudio(storage_path('app/private/' . $file));
$segments = $whisper->transcribe($audio, 4);
foreach ($segments as $segment) {
dump(toTimestamp($segment->startTimestamp) . ': ' . $segment->text . "\n");
}I also tried increasing php memory limits with no luck.
Environment Details:
- Laravel Version: v11.26.0
- PHP Version: 8.3
- Server: Laravel Herd
- System: Apple Silicon M2 Pro
Metadata
Metadata
Assignees
Labels
No labels