sarafridov / K-Planes

Other
480 stars 46 forks source link

Model size #34

Closed fnzhan closed 1 year ago

fnzhan commented 1 year ago

Thanks for the great work! I just find the model size of trained K-Planes is much larger than the reported size in the paper. The parameters of proposal grid are not included in the reported results in the paper, which could lead to the different model size? Looking forward to your reply.

sarafridov commented 1 year ago

It's true that there is some extra memory for the proposal models, but this should be small in comparison with the memory for the full model, since the proposal models are lower-resolution and have shorter features. The proposal models are just there to improve speed but they shouldn't affect quality, so you could run with an even lower-resolution proposal model, or without a proposal model, if memory is an issue.

fnzhan commented 1 year ago

Thanks for your reply! Just try to make it more clear: here is the report model params:

image

here is the size of provided model:

image

The two sizes look quite different, just want to know if I misunderstand something.

fnzhan commented 1 year ago

I understand that params may not mean the model size. But it is still a little strange, e.g., params of TensoRF is 18 M and model size is 72 MB. For K-Planes, params is 34M and model size is 384 MB.

sarafridov commented 1 year ago

This is interesting; I have some suspicion as to what is happening.

  1. Part of the gap is because the "M" in params is "millions" not "megabytes", so for fp32 there's a factor of 4 difference.
  2. The saved model (at least for kplanes) includes the optimizer state, which for Adam requires a lot of memory (roughly 2x the size of the model, because it keeps two running averages of the gradient to adapt the step sizes). I would suspect that the memory of just the model itself should be about 1/3 of the size of the .pth file because of this.
fnzhan commented 1 year ago

This is interesting; I have some suspicion as to what is happening.

  1. Part of the gap is because the "M" in params is "millions" not "megabytes", so for fp32 there's a factor of 4 difference.
  2. The saved model (at least for kplanes) includes the optimizer state, which for Adam requires a lot of memory (roughly 2x the size of the model, because it keeps two running averages of the gradient to adapt the step sizes). I would suspect that the memory of just the model itself should be about 1/3 of the size of the .pth file because of this.

Great, that makes senes! Thanks for the explanation.