Skip to content

Commit

Permalink
0.1708.2 - chunking buffer increased
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingFathead committed Dec 20, 2024
1 parent cd48d16 commit fc86e37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ After launching your bot successfully, you can interact with it via Telegram (se
- `/language` - set the model's transcription language (`auto` = autodetect); if you know the language spoken in the audio, setting the transcription language manually with this command may improve both transcription speed and accuracy.

## Changes
- v0.1708.2 - Added buffer for chunking
- Changed the chunk sizes from `4096` to `4000` to avoid edge case
- v0.1708.1 - Small bug fixes in the output
- Note that running the program within `firejail` using Nvidia driver v.560.xx or newer requires i.e.:
```
Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# openai-whisper transcriber-bot for Telegram

# version of this program
version_number = "0.1708.1"
version_number = "0.1708.2"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# https://github.com/FlyingFathead/whisper-transcriber-telegram-bot/
Expand Down
13 changes: 11 additions & 2 deletions src/transcription_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,16 @@ async def transcribe_audio(bot, update, audio_path, output_dir, youtube_url, vid
log_gpu_utilization() # Log GPU utilization before starting transcription

logger.info(f"Using device: {device} for transcription")
transcription_command = ["whisper", audio_path, "--model", model, "--output_dir", output_dir, "--device", device]

# transcription_command = ["whisper", audio_path, "--model", model, "--output_dir", output_dir, "--device", device]

transcription_command = [
"whisper", audio_path,
"--model", model,
"--output_dir", output_dir,
"--device", device
]

if language and language != "auto":
logger.info(f"Starting transcription with model '{model}' and language '{language}' for: {audio_path}")
transcription_command.extend(["--language", language])
Expand Down Expand Up @@ -599,7 +608,7 @@ async def process_url_message(message_text, bot, update, model, language):
# Here is where we add the transcription_note
transcription_note = "📝🔊 <i>(transcribed audio)</i>\n\n"
note_length = len(transcription_note)
max_message_length = 4096 - note_length # Adjust max length to account for transcription note
max_message_length = 4000 - note_length # Adjust max length to account for transcription note

if transcription_settings['send_as_messages'] and 'txt' in transcription_paths:
try:
Expand Down

0 comments on commit fc86e37

Please sign in to comment.