RepoReplicateReplicatepublished May 28, 2025seen 5d

replicate/cog-flux-kontext

Python

Open original ↗

Captured source

source ↗
published May 28, 2025seen 5dcaptured 8hhttp 200method plain

replicate/cog-flux-kontext

Description: Cog wrapper of Black Forest Lab's / FLUX.1 Kontext [dev]

Language: Python

License: Apache-2.0

Stars: 21

Forks: 10

Open issues: 3

Created: 2025-05-28T16:46:02Z

Pushed: 2025-08-07T01:14:37Z

Default branch: main

Fork: no

Archived: no

README:

FLUX.1 Kontext (Cog inference)

Compact Cog wrapper around Black Forest Labs' FLUX.1 *Kontext* dev model. It loads the Transformer, auto-encoder, CLIP/T5 text encoders, and optional NSFW safety checker, then exposes a single predict endpoint that performs image-to-image editing or style transfer conditioned on a text prompt.

# basic usage
cog predict -i prompt="make the hair blue" -i input_image=@lady.png

Everything required (weights download, Torch 2 compilation, etc.) happens automatically on first run.

Licensed under Apache-2.0 for the wrapper code; see model card for FLUX.1 license.

Performance Optimizations

  • torch.compile is used in dynamic mode
  • the two linear layers in the single stream block are quantized to run in FP8, using a modified version of aredden's fp8 linear layer
  • taylor seer style activation caching, enabled by the go_fast option in the cog predictor. May cause quality degradation for more complex editing tasks.
  • enable pytorch's cudnn attention backend

Pushing to Replicate

To deploy this model to Replicate:

1. Create a model page on Replicate at replicate.com/create

2. Install Cog following the installation instructions

3. Login to Replicate:

cog login

4. Push the model to Replicate:

cog push r8.im/your-username/your-model-name

Replace your-username with your Replicate username and your-model-name with the name you chose when creating the model page.

Notability

notability 3.0/10

Low-stars new repo, likely routine cog wrapper.