Skip to content

Commit bc07848

Browse files
committed
fixed issues where table is trying to display non-str types
1 parent 0ee9326 commit bc07848

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llmtune/utils/rich_print_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ def inject_example_to_rich_layout(layout: Layout, layout_name: str, example: dic
2828
formatted = example.pop("formatted_prompt", None)
2929
formatted_text = Text(formatted)
3030

31+
print(example)
3132
for key, c in zip(example.keys(), colors):
3233
table.add_column(key, style=c)
3334

34-
tgt_text = example[key]
35+
tgt_text = str(example[key])
3536
start_idx = formatted.find(tgt_text)
3637
formatted_text.stylize(f"bold {c}", start_idx, start_idx + len(tgt_text))
3738

38-
table.add_row(*example.values())
39+
table.add_row(*[str(v) for v in example.values()])
3940

4041
layout.split_column(
4142
Layout(

0 commit comments

Comments
 (0)