Spaces:
Running
Running
Commit ·
1265a5f
1
Parent(s): ac63b1e
Update with h2oGPT hash 61aa7c5504e243b9d2100968375942e0f78ec8c2
Browse files20 unmodified lines212223242526458 unmodified lines485486487488489490491492493142 unmodified lines6366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997002 unmodified lines703704705706707708709710134 unmodified lines84584684784884985085185285320 unmodified linesadmin_pass = kwargs['admin_pass']model_state0 = kwargs['model_state0']score_model_state0 = kwargs['score_model_state0']# easy update of kwargs needed for evaluate() etc.kwargs.update(locals())458 unmodified linesoutputs=[score_text_nochat],)if not kwargs['auto_score']:score_event = score_btn.click(**score_args, queue=stream_output, api_name='score' if allow_api else None) \.then(**score_args2, queue=stream_output, api_name='score2' if allow_api else None)score_event_nochat = score_btn_nochat.click(**score_args_nochat, queue=stream_output,api_name='score_nochat' if allow_api else None)def user(*args, undo=False, sanitize_user_prompt=True, model2=False):142 unmodified linesif kwargs['auto_score']:# in case 2nd model, consume instruction first, so can clear quickly# bot doesn't consume instruction itself, just history from user, so why workssubmit_event = instruction.submit(**user_args, queue=stream_output,api_name='instruction' if allow_api else None) \.then(**user_args2, queue=stream_output, api_name='instruction2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='instruction_bot' if allow_api else None) \.then(**score_args, api_name='instruction_bot_score' if allow_api else None) \.then(**bot_args2, api_name='instruction_bot2' if allow_api else None) \.then(**score_args2, api_name='instruction_bot_score2' if allow_api else None) \.then(clear_torch_cache)submit_event2 = submit.click(**user_args, queue=stream_output, api_name='submit' if allow_api else None) \.then(**user_args2, queue=stream_output, api_name='submit2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='submit_bot' if allow_api else None) \.then(**score_args, api_name='submit_bot_score' if allow_api else None) \.then(**bot_args2, api_name='submit_bot2' if allow_api else None) \.then(**score_args2, api_name='submit_bot_score2' if allow_api else None) \.then(clear_torch_cache)submit_event3 = retry.click(**user_args, queue=stream_output, api_name='retry' if allow_api else None) \.then(**user_args2, queue=stream_output, api_name='retry2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**retry_bot_args, api_name='retry_bot' if allow_api else None) \.then(**score_args, api_name='retry_bot_score' if allow_api else None) \.then(**retry_bot_args2, api_name='retry_bot2' if allow_api else None) \.then(**score_args2, api_name='retry_bot_score2' if allow_api else None) \.then(clear_torch_cache)submit_event4 = undo.click(**undo_user_args, queue=stream_output, api_name='undo' if allow_api else None) \.then(**undo_user_args2, queue=stream_output, api_name='undo2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**score_args, api_name='undo_score' if allow_api else None) \.then(**score_args2, api_name='undo_score2' if allow_api else None)else:submit_event = instruction.submit(**user_args, queue=stream_output,api_name='instruction' if allow_api else None) \.then(**user_args2, queue=stream_output, api_name='instruction2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='instruction_bot' if allow_api else None) \.then(**bot_args2, api_name='instruction_bot2' if allow_api else None) \.then(clear_torch_cache)submit_event2 = submit.click(**user_args, queue=stream_output, api_name='submit' if allow_api else None) \.then(**user_args2, queue=stream_output, api_name='submit2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='submit_bot' if allow_api else None) \.then(**bot_args2, api_name='submit_bot2' if allow_api else None) \.then(clear_torch_cache)submit_event3 = retry.click(**user_args, queue=stream_output, api_name='retry' if allow_api else None) \.then(**user_args2, queue=stream_output, api_name='retry2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**retry_bot_args, api_name='retry_bot' if allow_api else None) \.then(**retry_bot_args2, api_name='retry_bot2' if allow_api else None) \.then(clear_torch_cache)submit_event4 = undo.click(**undo_user_args, queue=stream_output, api_name='undo' if allow_api else None) \.then(**undo_user_args2, queue=stream_output, api_name='undo2' if allow_api else None)# does both modelsclear.click(lambda: None, None, text_output, queue=False, api_name='clear' if allow_api else None) \2 unmodified lines# because score for nochat consumes actual textbox, while chat consumes chat history filled by user()submit_event_nochat = submit_nochat.click(fun, inputs=[model_state] + inputs_list,outputs=text_output_nochat,api_name='submit_nochat' if allow_api else None) \.then(**score_args_nochat, api_name='instruction_bot_score_nochat' if allow_api else None) \.then(clear_instruct, None, instruction_nochat) \.then(clear_instruct, None, iinput_nochat) \.then(clear_torch_cache)134 unmodified lines# callback for logging flagged input/outputcallback.setup(inputs_list + [text_output, text_output2], "flagged_data_points")flag_btn.click(lambda *args: callback.flag(args), inputs_list + [text_output, text_output2], None, preprocess=False,api_name='flag' if allow_api else None)flag_btn_nochat.click(lambda *args: callback.flag(args), inputs_list + [text_output_nochat], None, preprocess=False,api_name='flag_nochat' if allow_api else None)def get_system_info():20 unmodified lines21222324252627458 unmodified lines486487488489490491492493494142 unmodified lines6376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007012 unmodified lines704705706707708709710711712134 unmodified lines84784884985085185285385485585685720 unmodified linesadmin_pass = kwargs['admin_pass']model_state0 = kwargs['model_state0']score_model_state0 = kwargs['score_model_state0']queue = True# easy update of kwargs needed for evaluate() etc.kwargs.update(locals())458 unmodified linesoutputs=[score_text_nochat],)if not kwargs['auto_score']:score_event = score_btn.click(**score_args, queue=queue, api_name='score' if allow_api else None) \.then(**score_args2, queue=queue, api_name='score2' if allow_api else None)score_event_nochat = score_btn_nochat.click(**score_args_nochat, queue=queue,api_name='score_nochat' if allow_api else None)def user(*args, undo=False, sanitize_user_prompt=True, model2=False):142 unmodified linesif kwargs['auto_score']:# in case 2nd model, consume instruction first, so can clear quickly# bot doesn't consume instruction itself, just history from user, so why workssubmit_event = instruction.submit(**user_args, queue=queue,api_name='instruction' if allow_api else None) \.then(**user_args2, api_name='instruction2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='instruction_bot' if allow_api else None, queue=queue) \.then(**score_args, api_name='instruction_bot_score' if allow_api else None, queue=queue) \.then(**bot_args2, api_name='instruction_bot2' if allow_api else None, queue=queue) \.then(**score_args2, api_name='instruction_bot_score2' if allow_api else None, queue=queue) \.then(clear_torch_cache)submit_event2 = submit.click(**user_args, api_name='submit' if allow_api else None) \.then(**user_args2, api_name='submit2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='submit_bot' if allow_api else None, queue=queue) \.then(**score_args, api_name='submit_bot_score' if allow_api else None, queue=queue) \.then(**bot_args2, api_name='submit_bot2' if allow_api else None, queue=queue) \.then(**score_args2, api_name='submit_bot_score2' if allow_api else None, queue=queue) \.then(clear_torch_cache)submit_event3 = retry.click(**user_args, api_name='retry' if allow_api else None) \.then(**user_args2, api_name='retry2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**retry_bot_args, api_name='retry_bot' if allow_api else None, queue=queue) \.then(**score_args, api_name='retry_bot_score' if allow_api else None, queue=queue) \.then(**retry_bot_args2, api_name='retry_bot2' if allow_api else None, queue=queue) \.then(**score_args2, api_name='retry_bot_score2' if allow_api else None, queue=queue) \.then(clear_torch_cache)submit_event4 = undo.click(**undo_user_args, api_name='undo' if allow_api else None) \.then(**undo_user_args2, api_name='undo2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**score_args, api_name='undo_score' if allow_api else None) \.then(**score_args2, api_name='undo_score2' if allow_api else None)else:submit_event = instruction.submit(**user_args,api_name='instruction' if allow_api else None) \.then(**user_args2, api_name='instruction2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='instruction_bot' if allow_api else None, queue=queue) \.then(**bot_args2, api_name='instruction_bot2' if allow_api else None, queue=queue) \.then(clear_torch_cache)submit_event2 = submit.click(**user_args, api_name='submit' if allow_api else None) \.then(**user_args2, api_name='submit2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**bot_args, api_name='submit_bot' if allow_api else None, queue=queue) \.then(**bot_args2, api_name='submit_bot2' if allow_api else None, queue=queue) \.then(clear_torch_cache)submit_event3 = retry.click(**user_args, api_name='retry' if allow_api else None) \.then(**user_args2, api_name='retry2' if allow_api else None) \.then(clear_instruct, None, instruction) \.then(clear_instruct, None, iinput) \.then(**retry_bot_args, api_name='retry_bot' if allow_api else None, queue=queue) \.then(**retry_bot_args2, api_name='retry_bot2' if allow_api else None, queue=queue) \.then(clear_torch_cache)submit_event4 = undo.click(**undo_user_args, api_name='undo' if allow_api else None) \.then(**undo_user_args2, api_name='undo2' if allow_api else None)# does both modelsclear.click(lambda: None, None, text_output, queue=False, api_name='clear' if allow_api else None) \2 unmodified lines# because score for nochat consumes actual textbox, while chat consumes chat history filled by user()submit_event_nochat = submit_nochat.click(fun, inputs=[model_state] + inputs_list,outputs=text_output_nochat,queue=queue,api_name='submit_nochat' if allow_api else None) \.then(**score_args_nochat, api_name='instruction_bot_score_nochat' if allow_api else None, queue=queue) \.then(clear_instruct, None, instruction_nochat) \.then(clear_instruct, None, iinput_nochat) \.then(clear_torch_cache)134 unmodified lines# callback for logging flagged input/outputcallback.setup(inputs_list + [text_output, text_output2], "flagged_data_points")flag_btn.click(lambda *args: callback.flag(args), inputs_list + [text_output, text_output2], None,preprocess=False,api_name='flag' if allow_api else None)flag_btn_nochat.click(lambda *args: callback.flag(args), inputs_list + [text_output_nochat], None,preprocess=False,api_name='flag_nochat' if allow_api else None)def get_system_info():
gradio_runner.py+44-40