point-e icon indicating copy to clipboard operation
point-e copied to clipboard

TypeError: 'float' object cannot be interpreted as an integer

Open guyko81 opened this issue 3 years ago • 5 comments

when running the text2pointcloud.ipynb example I got the error:

TypeError                                 Traceback (most recent call last)
Cell In [8], line 6
      4 # Produce a sample from the model.
      5 samples = None
----> 6 for x in tqdm(sampler.sample_batch_progressive(batch_size=1, model_kwargs=dict(texts=[prompt]))):
      7     samples = x

File c:\anaconda3\envs\sd\lib\site-packages\tqdm\std.py:1195, in tqdm.__iter__(self)
   1192 time = self._time
   1194 try:
-> 1195     for obj in iterable:
   1196         yield obj
   1197         # Update and possibly print the progressbar.
   1198         # Note: does not call self.update(1) for speed optimisation.

File c:\point-e\point_e\diffusion\sampler.py:164, in PointCloudSampler.sample_batch_progressive(self, batch_size, model_kwargs)
    156     samples_it = diffusion.p_sample_loop_progressive(
    157         model,
    158         shape=(internal_batch_size, *sample_shape[1:]),
   (...)
    161         clip_denoised=self.clip_denoised,
    162     )
--> 163 for x in samples_it:
...
    105     out = self.diffusion.p_mean_variance(
    106         self.model, x_t * c_in, t, clip_denoised=clip_denoised, model_kwargs=model_kwargs
    107     )

torch version 1.12.1+cu116 Python version 3.10.4 Windows 10

guyko81 avatar Dec 20 '22 22:12 guyko81

Also get this on windows 11

TheSeanLavery avatar Dec 21 '22 06:12 TheSeanLavery

I found the bug (also Windows 11)

changing line 96 of point_e\diffusion\k_diffusion.py from

return float(self.alpha_cumprod_to_t(alpha_cumprod))

to

return int(self.alpha_cumprod_to_t(alpha_cumprod))

solves it, I was able to generate the sample "red motorcycle"

image

(this works because I guess that t variable is meant to be timesteps, hence an int)

image

mjdi avatar Dec 21 '22 06:12 mjdi

thanks @mjdi, good catch!

guyko81 avatar Dec 21 '22 14:12 guyko81

@guyko81 Don't close this until the author fixes this in the repo.

TheSeanLavery avatar Dec 21 '22 17:12 TheSeanLavery

You're right, reopening

guyko81 avatar Dec 22 '22 12:12 guyko81