I’m not sure I understand the question correctly.
You could initialize a model with random parameters via your code snippet or generally as:
model = MyModel()

where MyModel is the model class. Afterwards, you could load the state_dict via model.load_state_dict(state_dict).
The difference between a pretrained and a randomly initialized model are the parameters and buffers which are stored in the state_dict.