def beam_search_test(self, speaker):
    self.encoder.eval()
    self.decoder.eval()
    self.critic.eval()
    looped = False
    self.results = {}
    while True:
        for traj in self.beam_search(speaker):
            if (traj['instr_id'] in self.results):
                looped = True
            else:
                self.results[traj['instr_id']] = traj
        if looped:
            break
def beam_search_test(self, speaker):
    self.encoder.eval()
    self.decoder.eval()
    self.critic.eval()
    looped = False
    self.results = {}
    while True:
        for traj in self.beam_search(speaker):
            if (traj['instr_id'] in self.results):
                looped = True
            else:
                self.results[traj['instr_id']] = traj
        if looped:
            break