Skip to content

Instantly share code, notes, and snippets.

@heffo42
Last active July 25, 2019 02:40
Show Gist options
  • Save heffo42/ce9e7d70c5c2dffedc99fd2599cf5423 to your computer and use it in GitHub Desktop.
Save heffo42/ce9e7d70c5c2dffedc99fd2599cf5423 to your computer and use it in GitHub Desktop.
start = np.random.randint(0,len(valid_list) - 150)
seed_list = valid_list[start:start+20]
current_string = [string2int[string] for string in seed_list]
for i in range(20):
input = torch.tensor(current_string,dtype=torch.long).cuda().reshape(1,-1)
output = model(input)
_, predicted = torch.max(output[:,-1,:], 1)
current_string.append(predicted.item())
print(' '.join(seed_list))
print(' '.join(int2string[x] for x in current_string))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment