INNER CODE UNIT · Python
dim
HendrikStrobelt/detecting-fake-text · backend/api.py:147
dim=-1)
# Sample
prev = torch.multinomial(probs, num_samples=1)
# Construct output
output = torch.cat((output, prev), dim=1)
output_text = self.enc.decode(output[0].tolist())
return output_text
def postprocess(self, token):
with_space = False
with_break = False
if token.startswith('Ġ'):
with_space = True
token = token[1:]
# print(token)
elif token.startswith('â'):
token = ' '