Skip to content

Commit c38b945

Browse files
committed
Fix arena moderation skipping right model conversation history
In side-by-side arena modes, moderation was reading states[0] twice instead of states[1] for the right model, and vision anony passed only the current user message instead of full conversation history.
1 parent 587d5cf commit c38b945

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎fastchat/serve/gradio_block_arena_anony.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def add_text(
307307
model_list = [states[i].model_name for i in range(num_sides)]
308308
# turn on moderation in battle mode
309309
all_conv_text_left = states[0].conv.get_prompt()
310-
all_conv_text_right = states[0].conv.get_prompt()
310+
all_conv_text_right = states[1].conv.get_prompt()
311311
all_conv_text = (
312312
all_conv_text_left[-1000:] + all_conv_text_right[-1000:] + "\nuser: " + text
313313
)

‎fastchat/serve/gradio_block_arena_vision_anony.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,16 @@ def add_text(
308308
)
309309

310310
model_list = [states[i].model_name for i in range(num_sides)]
311+
all_conv_text_left = states[0].conv.get_prompt()
312+
all_conv_text_right = states[1].conv.get_prompt()
313+
all_conv_text = (
314+
all_conv_text_left[-1000:] + all_conv_text_right[-1000:] + "\nuser: " + text
315+
)
311316

312317
images = convert_images_to_conversation_format(images)
313318

314319
text, image_flagged, csam_flag = moderate_input(
315-
state0, text, text, model_list, images, ip
320+
state0, text, all_conv_text, model_list, images, ip
316321
)
317322

318323
conv = states[0].conv

‎fastchat/serve/gradio_block_arena_vision_named.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def add_text(
242242

243243
model_list = [states[i].model_name for i in range(num_sides)]
244244
all_conv_text_left = states[0].conv.get_prompt()
245-
all_conv_text_right = states[0].conv.get_prompt()
245+
all_conv_text_right = states[1].conv.get_prompt()
246246
all_conv_text = (
247247
all_conv_text_left[-1000:] + all_conv_text_right[-1000:] + "\nuser: " + text
248248
)

0 commit comments

Comments
 (0)