openai / point-e

Point cloud diffusion for 3D model synthesis
MIT License
6.51k stars 757 forks source link

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

Open guyko81 opened 1 year ago

guyko81 commented 1 year ago

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

TheSeanLavery commented 1 year ago

Also get this on windows 11

mjdi commented 1 year ago

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

guyko81 commented 1 year ago

thanks @mjdi, good catch!

TheSeanLavery commented 1 year ago

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

guyko81 commented 1 year ago

You're right, reopening