Skip to content

Commit cad9384

Browse files
committed
Debug code
1 parent 8579a98 commit cad9384

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nemo/collections/nlp/modules/common/text_generation_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ def chat_completion(self, data):
195195
nemo_source, special_tokens
196196
)
197197
len_strip = len(special_tokens['end_of_turn'] + special_tokens['turn_start'])
198-
#print(f"BEFORE:\n```{conversation}```")
199198
conversation = conversation[:-len_strip]
199+
print(f"BEFORE:\n```{conversation}```")
200200

201201
batching = data.get('max_tokens', 32) > 64
202202
if batching:
@@ -273,7 +273,7 @@ def chat_completion(self, data):
273273
MegatronGenerate.tasks.task_done()
274274

275275
output_sentence = output['sentences'][queryid]
276-
#print(f"FULL OUTPUT:\n```{output_sentence}```")
276+
print(f"FULL OUTPUT:\n```{output_sentence}```")
277277

278278
# The "<|begin_of_text|>" token gets removed in the output -- this is probably a tokenizer issue,
279279
# but we hack it here until this is fixed.
@@ -297,7 +297,7 @@ def chat_completion(self, data):
297297
output_sentence = output_sentence.removesuffix(suffix)
298298
done = False
299299

300-
#print(f"TRIMMED OUTPUT:\n```{output_sentence}```")
300+
print(f"TRIMMED OUTPUT:\n```{output_sentence}```")
301301

302302
tokens = output['tokens'][queryid]
303303
tokens = [t.decode('utf-8', errors='replace') if isinstance(t, bytes) else t for t in tokens]

0 commit comments

Comments
 (0)