I am trying to change the value in my model’s state dict, but even after updating the state dict, the value does not change, any help would be appreciated.
sd = model.state_dict() 
sd['encoder.layer.11.output.LayerNorm._running_mean'] = layer_norm_stats['encoder.layer.11.output.LayerNorm._running_mean']  # Layer norm stats is a dict containing mean of the layer norm 
print(model.state_dict()['encoder.layer.11.output.LayerNorm._running_mean'])  # prints all zero tensor, which is the original value
print(layer_norm_stats['encoder.layer.11.output.LayerNorm._running_mean'] )  # prints the running mean, which is not the zero vector