def sample(self):
    '\n        ### Sampling function to generate samples periodically while training\n        '
    prompt = self.prompt
    log = [(prompt, Text.subtle)]
    mem = CompressedMemory([], [])
    for i in monit.iterate('Sample', 25):
        data = self.text.text_to_i(prompt).unsqueeze((- 1))
        data = data.to(self.device)
        (output, new_mem) = self.model(data, mem)
        output = output.argmax(dim=(- 1)).squeeze(1)
        prompt += (self.prompt_separator + self.text.itos[output[(- 1)]])
        prompt = prompt[(- 1):]
        log += [((self.prompt_separator + self.text.itos[output[(- 1)]]), Text.value)]
        (mem, _) = self.merge_compress_memory(mem, new_mem)
    logger.log(log)
### Sampling function to generate samples periodically while training
def sample(self):
    '\n        \n        '
    prompt = self.prompt
    log = [(prompt, Text.subtle)]
    mem = CompressedMemory([], [])
    for i in monit.iterate('Sample', 25):
        data = self.text.text_to_i(prompt).unsqueeze((- 1))
        data = data.to(self.device)
        (output, new_mem) = self.model(data, mem)
        output = output.argmax(dim=(- 1)).squeeze(1)
        prompt += (self.prompt_separator + self.text.itos[output[(- 1)]])
        prompt = prompt[(- 1):]
        log += [((self.prompt_separator + self.text.itos[output[(- 1)]]), Text.value)]
        (mem, _) = self.merge_compress_memory(mem, new_mem)
    logger.log(log)