AttributeError: '_LiteModule' object has no attribute 'sample'
Dear Team, @fdbtrs @jonasgrebe @naserdamer I'm encountering an AttributeError when running Sample.py. The error message states:
batch_samples = diffusion_model.sample( File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1260, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: '_LiteModule' object has no attribute 'sample'
This occurs when diffusionmodel.sample is called within Sample.py. However, it seems the call isn't reaching the intended diffusionmodel class. I've also observed this issue during model training while generating samples.
in sample.py
with torch.no_grad(): for _ in range(n_batches): batch_samples = diffusion_model.sample( batch_size, size, context=context)
in main.py
`
with torch.no_grad():
# create unconditional samples (or conditional samples with empty context)
samples_uncond = model.sample(N_PER_BLOCK, size).cpu()
if latent_decoder is not None:
samples_uncond = latent_decoder(samples_uncond)
samples_uncond = denormalize_to_zero_to_one(samples_uncond)`
_LiteModule has no attribute of sample, so it is not going to the diffusion model class how to fix this issue. thank you
you need to install torch lighting < 2.0 e.g. 1.8.6. See the updated sampling instructions