Your model must have a lot of parameters. Instead of flattening them into a single big tensor, you process it in parts:
from copy import deepcopy

avg_param = deepcopy(list(p.data for p in model.parameters()))

def train():
    ...
    for p, avg_p in zip(model.parameters(), avg_param):
        avg_p.mul_(0.9).add_(0.1, p.data)

Not sure if you’ll manage to fit another copy of the params in memory, so you can restore them after testing.