Open ardaakdere opened 6 months ago
Hi,
Try modify the https://github.com/huggingface/chat-ui/blob/main/src/routes/conversation/%5Bid%5D/%2Bserver.ts file,
moving the await summarizeIfNeeded;
at line 325 a few lines before.
change from
await collections.conversations.updateOne(
{
_id: convId,
},
{
$set: {
messages,
title: conv?.title,
updatedAt: new Date(),
},
}
);
update({
type: "finalAnswer",
text: messages[messages.length - 1].content,
});
await summarizeIfNeeded;
to
await summarizeIfNeeded;
await collections.conversations.updateOne(
{
_id: convId,
},
{
$set: {
messages,
title: conv?.title,
updatedAt: new Date(),
},
}
);
update({
type: "finalAnswer",
text: messages[messages.length - 1].content,
});
please respond if it is working for you now.
Thanks! @mikelfried
I have tried your solution. Now it works in a few cases but not in all.
After the solution you suggested, I no longer get the log error mentioned in the issue, that's really good news.
Here I can verify that it responds to a longer text from the menu on the left, but in the chat input, I get the feedback "Sorry, something went wrong. Please try again.":
When I look at the logs in the same scenario:
Here, you can check the screen recording: https://github.com/huggingface/chat-ui/assets/54773283/f4128023-f76e-4df5-b0d3-c5cee9bc054d
A console error that I have only encountered once (and then never again, may not be directly related to this topic, i'm not sure):
I didn't get a visible error for "Sorry, something went wrong. Please try again."
Do you have any idea about this?
Here's what fixed it for me https://github.com/huggingface/chat-ui/issues/1169#issuecomment-2173309506
When I try to run the llama2 model card that I trained, with chat-ui in Space using Nvidia A10G small, I get no response.
I see the following error in the container log:
""" 07:43:00 3|index | TypeError [ERR_INVALID_STATE]: Invalid state: Controller is already closed 07:43:00 3|index | at new NodeError (node:internal/errors:399:5) 07:43:00 3|index | at ReadableStreamDefaultController.enqueue (node:internal/webstreams/readablestream:1036:13) 07:43:00 3|index | at update (file:///app/build/server/chunks/_server.ts-2f619497.js:451:20) 07:43:00 3|index | at file:///app/build/server/chunks/_server.ts-2f619497.js:461:13 07:43:00 3|index | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 07:43:00 3|index | at async Object.start (file:///app/build/server/chunks/_server.ts-2f619497.js:552:7) { 07:43:00 3|index | code: 'ERR_INVALID_STATE' 07:43:00 3|index | } """
Chat UI files:
env.local.template file used:
entrypoint.sh.template used:
The interesting thing is that when I send a one word text, although I can't get a reply from the chat section in the interface, I can see the short reply from the preview in the left menu. I am sharing a screenshot below explaining this situation:![Screenshot 2024-01-04 at 09 43 20](https://github.com/huggingface/chat-ui/assets/54773283/7c1f7291-4411-4e60-a3cf-08718ed4266e)
another example for the same situation: (run on Nvidia 10G Large)![Screenshot 2024-01-04 at 10 22 57](https://github.com/huggingface/chat-ui/assets/54773283/17411170-47ef-4b70-90d7-3e50f51360b4)
Screenshot of the container error I mentioned at the beginning of the Issue:![Screenshot 2024-01-04 at 09 42 34](https://github.com/huggingface/chat-ui/assets/54773283/98c0cb6f-0257-4d55-a97f-2c6699f92fbb)
chat-ui uses "text-generation-launcher" to run the model. People who previously solved the same error for llama.cpp solved the problem by setting the "np" argument to 2. When I looked at the documentation of "text-generation-launcher" I couldn't see a similar argument. I did tests by playing with the VALIDATION_WORKERS, NUM_SHARD arguments here ( https://huggingface.co/docs/text-generation-inference/basic_tutorials/launcher). But I couldn't get any result.
Could there be something I might have missed here? Does anyone have a solution you can suggest on this?
Thanks.