Feliks Zaslavskiy commited on
Commit
b70226e
·
1 Parent(s): c82850a

add token output

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -39,6 +39,10 @@ def text2text(input_text):
39
  print( "Number of input tokens: " + str(input_num_tokens))
40
  print("Length of input: " + str(len(input_text)))
41
 
 
 
 
 
42
  # Does not seem to care if it goes over 512... humm...
43
  # To make it faster generate 100 tokens at a time
44
  # sampling mode.. don't greedily take the highest probability token every time. Helps it chat with some variation
 
39
  print( "Number of input tokens: " + str(input_num_tokens))
40
  print("Length of input: " + str(len(input_text)))
41
 
42
+ list_of_tokens = tokenizer.convert_ids_to_tokens(input_ids.view(-1).tolist())
43
+
44
+ print( "Tokens : " + ' '.join(list_of_tokens))
45
+
46
  # Does not seem to care if it goes over 512... humm...
47
  # To make it faster generate 100 tokens at a time
48
  # sampling mode.. don't greedily take the highest probability token every time. Helps it chat with some variation