A 1D/2D toy diffusion model experimentation and visualization lab in MoonBit
git clone https://github.com/hxiuzheng/MoonDiffusionLab.git
cd MoonDiffusionLab
moon installmoon add hxiuzheng/moon_diffusion_labmoon run cmd/labmoon run cmd/experiment_runner
moon run cmd/quality_report
moon run cmd/acceptance_gate# 生成交互式网页报告
moon run cmd/export_html > assets/demo.html
# 生成流场矢量图
moon run cmd/export_svg > assets/demo.svgmoon check --target all --deny-warn
moon build
moon fmt
moon info --target all
moon test --deny-warn
moon run cmd/acceptance_gatelet reports = @benchmark.run_suite(@benchmark.DDIM, 2026UL)
println(@benchmark.suite_markdown(reports))
println(@benchmark.suite_csv(reports))moon check --target all --deny-warn
moon build
moon fmt
moon info --target all
moon test --deny-warn
moon run cmd/acceptance_gate
import {
"hxiuzheng/moon_diffusion_lab/core",
"hxiuzheng/moon_diffusion_lab/schedule",
"hxiuzheng/moon_diffusion_lab/model",
"hxiuzheng/moon_diffusion_lab/dataset",
"hxiuzheng/moon_diffusion_lab/diffusion",
"hxiuzheng/moon_diffusion_lab/visualize",
}
fn main {
let rng = @core.Rng::new(seed=2026UL)
let data = @dataset.sample_two_moons(100, noise=0.05, rng)
let sched = @schedule.DiffusionSchedule::create(30, Cosine(s=0.008))
let model = @model.AnalyticalModel::new(data, bandwidth=0.1)
let (samples, _) = @diffusion.sample_ddim_analytical(100, model, sched, rng, num_steps=5)
println(@visualize.render_ascii_scatter(samples, title="DDIM 5-Step Denoised"))
println(@core.sliced_wasserstein_approx(samples, data).to_string())
}A 1D/2D toy diffusion model experimentation and visualization lab in MoonBit