Functional Interface to Diffusion Models in R
Overview
A native R implementation of diffusion models providing a functional interface to state-of-the-art generative AI. Inspired by the 'Python' library 'diffusers' from 'Hugging Face' https://huggingface.co/, 'diffuseR' generates and manipulates images from text prompts using models such as 'Stable Diffusion', with no 'Python' dependency. Supports multiple diffusion schedulers and device acceleration.
- Every precision
recommend()can return is now reachable.bf16was advertised for flux1 at 24 GB and flux2/zimage at 16-24 GB while no loader accepted it; the flux-family loaders takeprecision = "bf16", which resolves the unquantized transformer out of the hfhub cache rather than an artifact directory (bf16 is the source the quantizers read, not something built).recommend()explains the tier instead of returning a bare string. On a 16 GB card, flux2 at bf16 renders 1024x1024 in 6.4 s against 9.1 s at fp8 - the highest-quality tier is also the fastest, since nothing dequantizes per layer; it costs the 7.8 GB source staying on disk. download_ltx2()gainsprecision = c("nf4", "fp8")and defaults to nf4, which is whatrecommend("ltx")returns for any card with 14 GB or more. It previously built only fp8, so the recommended tier had to be built by hand withltx23_quantize_nf4(). Asking for fp8 without float8 write support now warns and builds nf4 instead of failing inside the quantizer.
Show all changes in 0.2.2Hide the rest of the changes in 0.2.2
- Quantized artifacts stay locally built. Prebuilt weights are not hosted for any model: only flux2 and zimage could be redistributed (Apache-2.0 and ungated), while LTX-2.3 is under the LTX-2 Community License and FLUX.1-schnell is gated, so hosting would cover half the catalog and leave two models on a different workflow.
- Model residency:
resident_load(),resident_activate(),resident_deactivate(),resident_generate(),resident_status()andresident_unload()keep a pipeline's weights page-locked on the host and treat the GPU copy as disposable, so handing a small card between models is a DMA transfer rather than a full reload. Same contract as whisper and chatterbox, with nogpu.ctldependency. This sits above the per-generation phase offloading in thetxt2img_*functions: those swap one component at a time within a render, residency decides who owns the card between renders. For a phase-offloading pipeline (the default) activation is the ownership claim and the transfers stay per-phase; only a pipeline loaded withphase_offload = FALSEis copied to the card wholesale, and that path is checked against free VRAM first.resident_status()reportscomponents_on_gpualongsidestate, because the two legitimately disagree: a render returns every component to pinned host memory as its phase ends, so an active handle can hold nothing. Verified on an RTX 5060 Ti (16 GB) against local artifacts: flux2 (11.22 GB pinned, 9.1 s render), flux1 (15.73 GB, 40.1 s), zimage (13.45 GB, 19.5 s) and ltx (18.41 GB across 5 components). All three image models reproduce bit-for-bit across a deactivate/activate cycle. FLUX.1 and LTX both have pinned sets larger than the card, so they exercise the refusal path rather than bulk onload.
Addressing the CRAN review of the 0.2.0 submission:
- Every exported
.Rdwith a\usageblock now documents its return value: 50@returntags added, chiefly to thenn_modulegenerators for the FLUX, FLUX.2, Z-Image, LTX-2.3 and Gemma3 ports. - Examples: 14 of the 23
\dontrun{}blocks now run during check, and were rewritten to be self-contained instead of referencing undefined objects. The 9 that remain need model weights on disk and are itemised incran-comments.md. ddim_scheduler_create()was uncallable at its documented defaults:beta_schedulewas never passed throughmatch.arg(), soswitch()errored on the length-3 default, and thedevicedefault was a length-2 vector thattorch_tensor()rejects.ddim_scheduler_step()had the same missingmatch.arg()onprediction_type. Every internal caller passed these explicitly, so the broken defaults went unnoticed.devicenow defaults totorch_device("cpu").DESCRIPTION: software names single-quoted ('Python', 'Stable Diffusion', 'Hugging Face' with its URL) and the trailing whitespace that had been folding into double spaces since the first commit removed.save_video()'s mp4 example is no longer live: the encoder inherits the session's stdin, whichR CMD check --as-cranuses to feed the example script to R, so it consumed part of the script.
From NEWS.md in the release
Install
Health
- OK13 OKNow
- OK6 OK2026-08-09
Documentation
- Help pages
- 344 (62 internal)
- Examples that run
- 64%16 run in a plain check · 9 never run
- Exported functions with examples
- 11%
- Documented parameters
- 89%
- Return-value docs
- 100%
- Help pages citing references
- 1%
- Performance Levers HTML
Downloads
Repository
- PRs merged (all time)
- 87%
- Median days to close, 50 most recently updated closed issues
- 2
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Issues over time
PRs over time
Commits over time
3 development-tooling and community-health practices detected across 3 families in the upstream repository
Checks run against github.com/cornball-ai/diffuser on 2026-10-22.
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-01-09Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.mdCommits: at least 35 crediting it in the message
- Claude CodePull requests: 5 from outside contributors, first on 2026-02-27
- Claude Opus 4.535 commits · Jan 2026
Dependencies
Code & Tests
People & History
- 0.2.2Latest2026-08-08 · current release
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-08-08
- Total releases
- 1 / 1 yrs
- License
- Apache License (>= 2)
- Download size
- 1.1 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("diffuseR")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.