modelB = TheModelBClass(*args, **kwargs)
modelB.load_state_dict(torch.load(PATH), strict=False)
Partially loading a model or loading a partial model are common scenarios when transfer learning or training a new complex model. Leveraging trained parameters, even if only a few are usable, will help to warmstart the training process and hopefully help your model converge much faster than training from scratch.
Whether you are loading from a partial  state_dict , which is missing some keys, or loading a  state_dict  with more keys than the model that you are loading into, you can set the  strict  argument to  False  in the  load_state_dict()  function to ignore non-matching keys.
If you want to load parameters from one layer to another, but some keys do not match, simply change the name of the parameter keys in the  state_dict  that you are loading to match the keys in the model that you are loading into.