So, I tried something like this. I am not sure if this is correct, so do feel free to correct me in case it is a wrong practice.
I made a deepcopy of the original model. Let’s call it new_learner(). Similar to what I have done above, I computed the new weights in a variable new_weight. Now, I am made use of this to update without making use of opt.step():
with torch.no_grad():
    for i, (name, params) in enumerate(new_learner.named_parameters()):
        params.copy_(new_weight[i])

Now, once I evaluate this new_learner on eval_data, I am deleting it using del new_learner
Next, I am using the loss generated from the prediction to update the original model’s weights.
pred_val = new_learner(eval_data)
loss_val = loss_fn(pred_val, eval_labels)
del new_learner
train_loss.backward()
meta_opt.step()

And it’s done! Please let me know if this is ok, or should I be aware of a better practice? Thank you!