oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.54k stars 5.31k forks source link

no history for instruct #6231

Open ChristianWallesch opened 3 months ago

ChristianWallesch commented 3 months ago

Describe the bug

when choosing instruct in the chat window there is no history for the instruct mode saved. the log files are empty

Is there an existing issue for this?

Reproduction

run a model in instruct and click new chat and try to return to the old one

Screenshot

No response

Logs

no errors

System Info

Windows 11, Nvidia rtx 4090
Remowylliams commented 3 months ago

I'm seeing this problem on Linux as well. But I think I understand why we are getting the failure: ` File "/home/rwylliams/ai_goodies/text-generation-webui/modules/chat.py", line 563, in find_all_histories_with_first_prompts if data['internal'][0][0] == '<|BEGIN-VISIBLE-CHAT|>':


IndexError: list index out of range
`
This asks to return the value of BEGIN-VISIBLE-CHAT from the internal collection.
Instruct isn't storing this in the log, as a result you won't get an index and hence list index out of range. This is causing the  Past Chats list to not be updated and making Instruct Past chats unavailable via the list.
Chat mode logs put this value in it's logs so doesn't crash out of the function used to update the Past chat list.
Seems like it would be a pretty easy bug fix.

Cheers
Remowylliams commented 3 months ago

I may have found a fix for the problem. in modules/chat.py:581 if data['internal'][0][0] == '<|BEGIN-VISIBLE-CHAT|>: add a check for internal having contents: if len(data['internal']) > 1 and data['internal'][0][0] == '<|BEGIN-VISIBLE-CHAT|>': And it should work as expected.

Cheers