diff --git a/fastchat/model/model_registry.py b/fastchat/model/model_registry.py index df4a58e2b..19a513eaa 100644 --- a/fastchat/model/model_registry.py +++ b/fastchat/model/model_registry.py @@ -23,7 +23,9 @@ def get_model_info(name: str) -> ModelInfo: return model_info[name] else: # To fix this, please use `register_model_info` to register your model - return ModelInfo(name, "", "Register the description at fastchat/model/model_registry.py") + return ModelInfo( + name, "", "Register the description at fastchat/model/model_registry.py" + ) register_model_info( diff --git a/fastchat/serve/gradio_web_server.py b/fastchat/serve/gradio_web_server.py index 2c5a54850..02b737db7 100644 --- a/fastchat/serve/gradio_web_server.py +++ b/fastchat/serve/gradio_web_server.py @@ -655,7 +655,9 @@ def build_single_model_ui(models, add_promotion_links=False): [state, chatbot] + btn_list, ) send_btn.click( - add_text, [state, model_selector, textbox], [state, chatbot, textbox] + btn_list, + add_text, + [state, model_selector, textbox], + [state, chatbot, textbox] + btn_list, ).then( bot_response, [state, temperature, top_p, max_output_tokens], @@ -690,7 +692,7 @@ def build_demo(models): state, model_selector, ], - _js=load_js + _js=load_js, ) return demo @@ -725,8 +727,9 @@ def build_demo(models): help="Whether to load the model list once or reload the model list every time", ) parser.add_argument( - "--moderate", action="store_true", - help="Enable content moderation to block unsafe inputs" + "--moderate", + action="store_true", + help="Enable content moderation to block unsafe inputs", ) parser.add_argument( "--show-terms-of-use", diff --git a/fastchat/serve/gradio_web_server_multi.py b/fastchat/serve/gradio_web_server_multi.py index 96ad60106..92618d911 100644 --- a/fastchat/serve/gradio_web_server_multi.py +++ b/fastchat/serve/gradio_web_server_multi.py @@ -112,7 +112,9 @@ def build_demo(models, elo_results_file, leaderboard_table_file): side_by_side_named_list = build_side_by_side_ui_named(models) with gr.Tab("Single Model", id=2): - single_model_list = build_single_model_ui(models, add_promotion_links=True) + single_model_list = build_single_model_ui( + models, add_promotion_links=True + ) if elo_results_file: with gr.Tab("Leaderboard", id=3): @@ -131,7 +133,10 @@ def build_demo(models, elo_results_file, leaderboard_table_file): demo.load( load_demo, [url_params], - [tabs] + single_model_list + side_by_side_anony_list + side_by_side_named_list, + [tabs] + + single_model_list + + side_by_side_anony_list + + side_by_side_named_list, _js=load_js, ) @@ -167,8 +172,9 @@ def build_demo(models, elo_results_file, leaderboard_table_file): help="Whether to load the model list once or reload the model list every time.", ) parser.add_argument( - "--moderate", action="store_true", - help="Enable content moderation to block unsafe inputs" + "--moderate", + action="store_true", + help="Enable content moderation to block unsafe inputs", ) parser.add_argument( "--show-terms-of-use", @@ -206,8 +212,12 @@ def build_demo(models, elo_results_file, leaderboard_table_file): help='Set the gradio authentication file path. The file should contain one or more user:password pairs in this format: "u1:p1,u2:p2,u3:p3"', default=None, ) - parser.add_argument("--elo-results-file", type=str, help="Load leaderboard results and plots") - parser.add_argument("--leaderboard-table-file", type=str, help="Load leaderboard results and plots") + parser.add_argument( + "--elo-results-file", type=str, help="Load leaderboard results and plots" + ) + parser.add_argument( + "--leaderboard-table-file", type=str, help="Load leaderboard results and plots" + ) args = parser.parse_args() logger.info(f"args: {args}") diff --git a/fastchat/serve/monitor/summarize_cluster.py b/fastchat/serve/monitor/summarize_cluster.py index 8c5047623..1d5fbcddc 100644 --- a/fastchat/serve/monitor/summarize_cluster.py +++ b/fastchat/serve/monitor/summarize_cluster.py @@ -42,8 +42,11 @@ def truncate_string(s, l): instruct = "Given a list of user messages, use less than 8 words to summarize a central topic for all messages in English. Your output should only include a single line. Try to be specific." split = int(args.num_prompts * 0.8) prompt = "\n".join( - [truncate_string(x, l=200) for x in topk_prompts[: split]] + - [truncate_string(x, l=200) for x in random_prompts[: args.num_prompts - split]] + [truncate_string(x, l=200) for x in topk_prompts[:split]] + + [ + truncate_string(x, l=200) + for x in random_prompts[: args.num_prompts - split] + ] ) prompt = "BEGIN OF THE MESSAGE LIST\n" + prompt + "\nEND OF THE MESSAGE LIST."