add optional twelvelabs pegasus transcription backend#36
Open
mohit-twelvelabs wants to merge 1 commit into
Open
add optional twelvelabs pegasus transcription backend#36mohit-twelvelabs wants to merge 1 commit into
mohit-twelvelabs wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I'm Mohit, I work at TwelveLabs (@mohit-twelvelabs).
This PR adds an optional TwelveLabs Pegasus transcription backend alongside the default Whisper pipeline.
What it adds
decipher/pegasus.pymodule withvideo_to_srt(...): uploads the video as a TwelveLabs asset, waits for it to be ready, and asks Pegasus to return SubRip (SRT) subtitles (output is fence-stripped and validated against an SRT cue regex).--backend {whisper,pegasus}flag ondecipher transcribe(defaultwhisper), wired throughaction.transcribe(...)via a newbackendargument.pip install "decipher[pegasus]"(twelvelabs>=1.2.8).tests/test_pegasus.py(no-network unit tests for parsing/validation + a key-gated wiring test that skips withoutTWELVELABS_API_KEY).Why it helps
Pegasus is a video-understanding model that reads the video directly rather than just the extracted audio track, so it can use on-screen context (overlaid text, speaker cues) when transcribing. It also runs in the cloud, so users without a local GPU get an alternative to Whisper. Marengo/Pegasus and Whisper are complementary, not a replacement.
Opt-in / non-breaking
Default behaviour is unchanged:
backenddefaults towhisper, thetwelvelabspackage is only imported inside thepegasusbranch, and it's anextras_require(not installed by default). Existing Whisper users see no difference.How it was tested
tests/test_pegasus.pypasses (5 passed): fence stripping, SRT cue regex, missing-key error, and SDK construction with a key.ready, analysed with Pegasus 1.5, and returned a valid SRT cue (~8s). Marengo text embeddings also confirmed (512-dim) while validating the SDK contract.black.You can grab a free API key at https://twelvelabs.io — there's a generous free tier.