tonym128 / shhh-bot

A Telegram Bot to convert speech to text from small videos and audio files.
MIT License
24 stars 1 forks source link

[Errno 2] No such file or directory: #7

Closed cchrkk closed 7 months ago

cchrkk commented 7 months ago

Hello, I'm trying to get it to work but whenever I send a voice message to the bot it throws this message in console:

2024-04-08 12:57:51,511 - root - INFO - Starting bot
2024-04-08 12:57:51,678 - telegram.ext.Application - INFO - Application started
2024-04-08 12:58:20,229 - root - INFO - Started processing for cherokeee
2024-04-08 12:58:20,772 - root - ERROR - 0.5431523323059082 cherokeee : 30279797 : FAIL UNKNOWN : Failed processing message
2024-04-08 12:58:20,772 - root - ERROR - [Errno 2] No such file or directory: '/tmp/b207fd4d1e014b6fb78d3dff1d210d96.wav.txt'

This on telegram: image

The compose config on portainer is the following, tried to recreate image but nothing changes

image

tonym128 commented 7 months ago

The wav.txt file is meant to be the speech to text output from whisper.cpp. It seems like it failed running the convert.sh script.

Do you know what system are you running on ? X64 (Intel / Amd machine), Aarch64 (Mac Mx), ArmV6/7 (PI) ?

cchrkk commented 7 months ago

The wav.txt file is meant to be the speech to text output from whisper.cpp. It seems like it failed running the convert.sh script.

Do you know what system are you running on ? X64 (Intel / Amd machine), Aarch64 (Mac Mx), ArmV6/7 (PI) ?

I'm running Alpine X64, maybe that's the problem. I should check what happens in the image creation

tonym128 commented 7 months ago

The wav.txt file is meant to be the speech to text output from whisper.cpp. It seems like it failed running the convert.sh script. Do you know what system are you running on ? X64 (Intel / Amd machine), Aarch64 (Mac Mx), ArmV6/7 (PI) ?

I'm running Alpine X64, maybe that's the problem. I should check what happens in the image creation

That's the image I'm running on my box, I'm making a few changes this week, will make sure I grab a new image and test with it.

cchrkk commented 7 months ago

Ok, let me know if you need some testing 😉

tonym128 commented 7 months ago

This might be a 🤦 moment, can you try ghcr.io/tonym128/shhh-bot:v1.0.0

I'm busy learning the automated docker builds and push, I don't think I'm updating the master when I push a new release, it builds it, but doesn't push it. ghcr.io/tonym128/shhh-bot:v1.0.1 is up for testing, it allows you to not set the SHHH_MY_CHAT_ID and optionally has a SHHH_ALLOWED_CHAT_IDS to define a list of allowed users and ignore everyone else.

cchrkk commented 7 months ago

Tried 1.0.0, 1.0.1 and 1.0.3 but error is always the same sadly.

it allows you to not set the SHHH_MY_CHAT_ID

I removed SHHH_MY_CHAT_ID variable and the bot replied to me in his own chat 👌

EDIT: Same with 1.0.5

2024-04-09 08:27:08,952 - root - INFO - SHHH_MY_CHAT_ID : None 2024-04-09 08:27:08,953 - root - INFO - SHHH_ALLOWED_CHAT_IDS : None 2024-04-09 08:27:08,980 - root - INFO - Starting bot 2024-04-09 08:27:09,149 - telegram.ext.Application - INFO - Application started 2024-04-09 08:27:31,886 - root - INFO - Started processing for None 2024-04-09 08:27:32,339 - root - ERROR - 0.4525599479675293 None : -1002132954009 : FAIL UNKNOWN : Failed processing message 2024-04-09 08:27:32,339 - root - ERROR - [Errno 2] No such file or directory: '/tmp/1aa04452512a4dd48953637264398c23.wav.txt'

tonym128 commented 7 months ago

Please try with the latest version and let me know if you're still encountering the issue

I hava a few more images now too, tiny, base, small and medium

image: ghcr.io/tonym128/shhh-bot-tiny
image: ghcr.io/tonym128/shhh-bot
image: ghcr.io/tonym128/shhh-bot-small
image: ghcr.io/tonym128/shhh-bot-medium
tonym128 commented 7 months ago

Here my compose script


services:
  shhhbot:
    container_name: shhhbot
    hostname: shhhbot
    restart: unless-stopped
    image: ghcr.io/tonym128/shhh-bot-small
    environment:
      - SHHH_API_KEY=0000000000:xxxxxxxxxxxxx

That not my API key :)

Two things I can think to check are

cchrkk commented 7 months ago

image Same story :D

Try mounting a /tmp volume into the container for the file saving

Just tried, didn't work. 2024-04-09 22:20:45,045 - root - ERROR - [Errno 2] No such file or directory: '/tmp/ec49a5bc3130459ca1c793f772e3ad33.wav.txt'

Check to see you have free disk space.

I have

tonym128 commented 7 months ago

How are you recording the audio for Telegram ?

I use Firefox desktop or forward recordings from WhatsApp.

I recall having issues with certain audio files in the past. I'll try add some ffmpeg logging so we can dig a bit deeper, would like to solve this issue for you.

cchrkk commented 7 months ago

Tried this compose:

image

on a debian VM and it works perfectly 🤔

tonym128 commented 7 months ago

Tried this compose:

image

on a debian VM and it works perfectly 🤔

That's great to hear you have it working. I'm working on a pr to expose error messages from ffmpeg and whisper if they occur, so we'll have more information to look at if it recurs in the future.

cchrkk commented 7 months ago

Tried this compose: image on a debian VM and it works perfectly 🤔

That's great to hear you have it working. I'm working on a pr to expose error messages from ffmpeg and whisper if they occur, so we'll have more information to look at if it recurs in the future.

Yay perfect, I've tried to debug the convert script but I'm too noob to understand how. That would help!

cchrkk commented 7 months ago

Working perfectly on debian, but I get this error in alpine:

Done! Model 'medium' saved in '/models/ggml-medium.bin'
You can now use it like this:
  $ ./main -m /models/ggml-medium.bin -f samples/jfk.wav
Link model to whisper one
Complete
2024-04-12 13:22:56,830 - root - INFO - Starting bot
2024-04-12 13:22:56,998 - telegram.ext.Application - INFO - Application started
2024-04-12 13:31:35,089 - root - INFO - Started processing for cherokeee
2024-04-12 13:31:35,458 - telegram.ext.Application - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/usr/local/src/shhh.py", line 145, in handle_message
    result = open(filename+".wav.txt", "r")
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/aeb530ddaf1a4142a5640b30f04481bd.wav.txt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/_application.py", line 1264, in process_update
    await coroutine
  File "/usr/local/lib/python3.9/site-packages/telegram/ext/_handlers/basehandler.py", line 157, in handle_update
    return await self.callback(update, context)
  File "/usr/local/src/shhh.py", line 167, in handle_message
    with open("/tmp/convert.log", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/convert.log'

same compose i'm using on debian: image