Repository navigation
feat(sponsorblock): experimental on-device sponsor detection with a skip button (GitHub flavor) - #1289
Open
seshuthota wants to merge 4 commits into
Open
feat(sponsorblock): experimental on-device sponsor detection with a skip button (GitHub flavor)#1289seshuthota wants to merge 4 commits into
seshuthota wants to merge 4 commits into
Conversation
When the SponsorBlock database has no segments for a video, a small ONNX model (Ettin 17M, INT8) reads the captions and marks the sponsor spans it finds. The spans never auto-skip: they get the existing "Skip Sponsor" button and a seek-bar mark. - Off by default and marked experimental. A new group under Settings > Integrations > SponsorBlock turns it on and handles the one-time model download (pinned Hugging Face revision, SHA-256 verified), status and delete. - English captions only, VODs only, and only while SponsorBlock is on. - The model needs a handful of operators, so tools/onnxruntime builds a reduced ONNX Runtime AAR (about 2.9 MB per arm64 APK against 32 MB for the Maven artifact). Without the AAR the build falls back to the Maven runtime. R8 keeps ai.onnxruntime.* because the AAR ships no consumer rules. - The skip button layer used the whole window width in two-pane layout, so the button drew over the related list. It now matches the video. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeLeHxbB5VJpe961SJVMpd
Real implementation and ONNX Runtime now live in src/github with no-op stubs in src/foss, matching the Discord split. GitHub release and nightly builds fail when the reduced ONNX Runtime AAR is missing; CI builds and caches it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeLeHxbB5VJpe961SJVMpd
…ettings Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeLeHxbB5VJpe961SJVMpd
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.
Summary
Experimental, opt-in, GitHub-flavor-only. When SponsorBlock has no segments for a video, a small on-device model reads the captions and, if it finds a sponsor, shows the existing skip button for it. It never skips on its own.
flow-ml-uuid prefix.SponsorBlockHandlernever auto-skips them andSponsorBlockSkipPolicyalways shows the manual skip button for them, even if the category is set to auto-skip.app/src/github, no-op stubs inapp/src/foss,githubImplementationfor ONNX Runtime. The FOSS APK has no ONNX Runtime (arm64 release: 19.5 MB) and the setting is hidden there.tools/onnxruntime/build-onnxruntime-android.sh; no AAR is committed. The arm64.sois 2.9 MB vs 32.1 MB for the Maven artifact (AAR 4.7 MB).assembleGithubRelease/Nightlyfail with a clear message ifapp/libs/onnxruntime-android-1.29.0.aaris missing; GitHub debug builds fall back to the Maven artifact so contributors aren't blocked. CI builds the AAR (cached by hash oftools/onnxruntime/**) before lint/release.-keep class ai.onnxruntime.** { *; }is added to ProGuard rules because the custom AAR ships no consumer rules.Model
0b8399f4f8bc226b21d8c8f39d4611abd536890c) and verifies SHA-256 for both files before installing, so the download can't change under an installed build. Changing the model means bumping the revision and constants inSponsorModelStore.kttogether.jhu-clsp/ettin-encoder-17m(MIT), fine-tuned as a BILOU token classifier (768-token windows, 128 overlap, threshold 0.7).License and training data
Xenova/sponsorblock-768: no license is stated on its dataset page.ScriptSmith/sponsorblock-youtube-metadata-2024: CC BY-4.0 (covers the compilation, not the underlying YouTube transcripts).Related issue
None.
Change type
Validation
./gradlew :app:assembleGithubDebug: passes./gradlew :app:testGithubDebugUnitTestand:app:testFossDebugUnitTest: pass (the sponsor tests that need the model files ran with-PsponsorModelAssets=<dir>, otherwise they skip)./gradlew ktlintCheck,:app:compileFossDebugKotlin,:app:assembleGithubRelease :app:assembleFossRelease(with the AAR present): passassembleGithubReleasewithout the AAR fails with the message above; GitHub debug and FOSS compile without the AARai.onnxruntimeclassesTest device and Android version: Xiaomi Pad 6 (arm64, MIUI/HyperOS), debug build.
Risk and compatibility
Experimental: it can miss a sponsor or mark the wrong part of a video (the 39-video benchmark had 19 positives; labels are noisy). The settings text says so.
Network: one model download, only after the user enables the toggle. No telemetry. Nothing is sent about videos; captions are read locally.
Background/battery: inference runs only when SponsorBlock has no segments and the toggle is on. Battery and thermal impact are not measured.
Preferences: adds one DataStore key (
sponsorOnDeviceEnabled, default false). No Room schema change.Size: GitHub APK includes the 2.9 MB (arm64) runtime; the model is downloaded, not bundled. FOSS is unaffected.
The model is hosted on a personal Hugging Face account, as discussed.
The change does not introduce secrets, private data, or unexpected telemetry.
New user-facing text uses Android string resources (English only).
Dependency changes are limited to this PR (ONNX Runtime, GitHub flavor only).
This PR does not change the Room schema.
No breaking changes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LeLeHxbB5VJpe961SJVMpd