From 558e185e4fc40e0fe301ab92d38550a302a350ff Mon Sep 17 00:00:00 2001 From: aminediro Date: Wed, 30 Sep 2026 08:38:34 +0000 Subject: [PATCH] Handle None message content in print_prompt_completions_sample --- trl/trainer/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trl/trainer/utils.py b/trl/trainer/utils.py index dda61adfd88..ed1f896bb3c 100644 --- a/trl/trainer/utils.py +++ b/trl/trainer/utils.py @@ -774,7 +774,7 @@ def format_entry(entry) -> Text: t.append(reasoning, style="italic dim white") t.append("\n") if "content" in msg: - t.append(msg["content"]) + t.append(msg["content"] or "") elif "name" in msg and "args" in msg: # Tool call t.append(f"{role.upper()}\n", style="bold red")