iris.c icon indicating copy to clipboard operation
iris.c copied to clipboard

Embedding iris.c as a library + optional per-step trace for experiments?

Open zhuzhonghua opened this issue 1 month ago • 2 comments

Hi Salvatore

I'm using iris.c to learn diffusion internals by building a small scriptable experiment harness around it (out-of-tree: sweeps over steps/schedule/guidance/seed, contact sheets, image diffs, reproducible manifests). Right now it drives the CLI, and re-loading the model for every image makes sweeps painful.

Before writing code, I wanted to ask what you'd be comfortable with:

  1. A libiris target (static lib + a small embedding example) so the pipeline can be driven in-process. No behavior change, no new dependencies, C99 only.
  2. An optional per-step callback in the sampler loop, compiled out by default, e.g. iris_set_step_cb(ctx, cb, ud) giving (step, timestep). It would let external tools trace/benchmark and could also power a --trace CSV.

Both can be default-off and kept tiny. If you'd rather keep the core untouched, I'll keep everything in examples/ and just send bug reproductions and focused fixes I find with the harness.

Is either in scope? Happy to start with the smallest patch, or a docs-only example first if that's easier to evaluate.

Thanks.

zhuzhonghua avatar Oct 25 '26 13:10 zhuzhonghua

@zhuzhonghua

make lib

just gives you that libiris.a static lib for en example on how to embed this you can look at

https://codeberg.org/ashimokawa/iris-gtk

ashimokawa avatar Nov 02 '26 21:11 ashimokawa

Thanks @ashimokawa — I had missed make lib, and iris-gtk is a useful reference.

Also, my second ask turned out unnecessary: iris_set_step_image_callback() already exists in iris.h, which is exactly what a scripted harness needs. I've published mine out-of-tree here: https://github.com/zhuzhonghua/iris.c-scheme

zhuzhonghua avatar Nov 04 '26 08:11 zhuzhonghua