add flux-klein example top of trickle protocol#32
Open
zargarzadehm wants to merge 1 commit into
Open
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.
Add
flux-klein— realtime FLUX.2-klein-4B video-to-video over trickleAdds a new example implementing the request in #1: realtime FLUX.2 [klein] img2img
over trickle on the live runner, modelled on the existing trickle/static-runner
examples.
livepeer-example/flux-kleinrunners.json+/healthpoll, likevllm)/updatecontrol)What it does
Receives a live video stream, transforms every frame against a text prompt with
FLUX.2-klein-4B, and streams the result back. Prompt, noise seed, and camera
anchoring are all adjustable mid-stream over
/update.Self-contained inference.
flux_klein.pywrapsdiffusers(
Flux2KleinPipeline) directly — it does not run Daydream Scope or any pluginruntime. The reference implementation cited in #1,
hthillman/scope-flux-klein, is aScope plugin; this example borrows its recipe (the Krea-style feedback loop and
the truncated-schedule refine) and reimplements it standalone so the example stays
self-contained like the others.
The feedback loop. Klein is a 4-step model, so full inference per frame is far
too slow for video. Frame 0 runs full inference; every frame after partially
denoises the previous output blended with the incoming frame. Because
Flux2KleinPipelinehas nostrengthparameter (it conditions on the image viajoint attention), the refine hand-rolls a truncated flow-matching schedule.
Measured throughput
NVIDIA RTX 6000 Pro, 384×384, 4 steps, feedback 0.5:
FLUX_BATCH=2 FLUX_COMPILE=max-autotuneGET /statsreports live input/inference/output rates,frames_skipped, and theactive tuning parameters.
Files
flux_klein.py(model + feedback loop) ·runner.py(aiohttp app, tricklechannels, worker) ·
client.py(file or webcam in, live prompt/seed/blend updates)·
Dockerfile·docker-compose.yml+docker-compose.onchain.yml·runners.json·pyproject.toml·.env.example·view.sh·README.md