in grok/data.py [0:0]
def decode(self, tensor: Tensor, with_brackets: bool = False) -> str:
"""
Convert a tensor of token ids into a string of text
:param tensor: a tensor of the token ids
:param with_brackets: if true, the returned string will include <> brackets
around the text corresponding to each token.
:returns: string of these tokens.
"""
indices = tensor.long()
if with_brackets:
l = "<"
r = ">"
else:
l = ""
r = ""
tokens = [l + self.itos[i] + r for i in indices]
return " ".join(tokens)