Closed andreykramer closed 1 year ago
Thanks for the catch, @andreykramer. This is indeed a bug.
From my reading of the code, make_functional/make_functional_with_buffers should still work as expected. The "Remove the loaded state on self.stateless_model" will still remove the loaded state, but instead of replacing a tensor with a meta tensor (a Tensor without storage), it'll replace a tensor with None.
It looks like the only implication is that if you directly access self.stateless_model
, it will have some Nones where it should instead have meta tensors.
I noticed that the
old_state
variable ofmake_functional.py::FunctionalModuleWithBuffers::forward
is always full ofNone
elements. Digging a bit I saw that there is no return in the general case of_get_nested_attr
So the outermost call is always returning
None
whenlen(names) > 1
. If I'm right and this is a bug what implications does it have? For instance, the "Remove the loaded state on self.stateless_model" step surely wouldn't be doing what it's supposed to.