NVIDIA / TensorRT-Incubator

Experimental projects related to TensorRT
81 stars 12 forks source link

Parameters in Module Containers Not Retained in state_dict after modification #386

Closed farazkh80 closed 1 week ago

farazkh80 commented 1 week ago

When a module contains a container (e.g., list) of parameters, replacing a parameter inside that container with a non-parameter

module.param_list[0] = tp.ones(...)) 

causes it to disappear from the module.state_dict.

We could prevent changing a Parameter attr of a module into a non-Parameter, but this is not easy for members of collections

pranavm-nvidia commented 3 hours ago

@farazkh80 Is this resolved? If not, can we reopen this issue? The behavior is confusing right now since we automatically convert to Parameters except for items in collections