def restore(self, emb_name='embed'):
    for (name, param) in self.model.named_parameters():
        if (param.requires_grad and (emb_name in name)):
            assert (name in self.emb_backup)
            param.data = self.emb_backup[name]
    self.emb_backup = {}
def restore(self, emb_name='embed'):
    for (name, param) in self.model.named_parameters():
        if (param.requires_grad and (emb_name in name)):
            assert (name in self.emb_backup)
            param.data = self.emb_backup[name]
    self.emb_backup = {}