What do you mean with:

I want to modify hidden layers of a pretrained network s.t. they output auxiliary loss values.

Do you want to change the input/output dimensions of the network? Or do you want to add layers to the model?
For the first case, it might make your network incompatible with your pretrained weights due to size mismatch between the weights.
For the second case, I would recommend for you to code the network as a class that you can modify as you want (if you are using the models from the zoo, you could just copy the code from there!) and then just loading the compatible weights like so:
pretrained_dict = torch.load('path_to_weights.pth')
            
model_dict = model.state_dict()

# 1. filter out unnecessary keys
pretrained_dict = {k: v for k, v in pretrained_dict.items() if (k in model_dict)}

# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict) 

# 3. load the new state dict
model.load_state_dict(model_dict)