Nonparametric estimation of a factorizable density using diffusion models