And did you try this?
model = TheModelClass(*args, **kwargs)
model.train()
actual_dict = model.state_dict()
model = TheModelClass(*args, **kwargs)
model.load_state_dict(actual_dict)

Basically, canonical way without writing on the disk but keeping the data dynamically allocated