Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradio causing slow generation #54

Closed
pseudotensor opened this issue Apr 19, 2023 · 4 comments
Closed

gradio causing slow generation #54

pseudotensor opened this issue Apr 19, 2023 · 4 comments

Comments

@pseudotensor
Copy link
Collaborator

pseudotensor commented Apr 19, 2023

E.g. Put contents of this page into chat: https://www.emergentmind.com/ and hit enter

Once done, put this in: https://raw.githubusercontent.com/h2oai/h2o-llmstudio/main/LICENSE and hit enter

See slow generation and heavy CPU usage:

image

and very slow generation:

image

1 core usage, and alot of attempts by gradio to handle as image, tokenize it, parse it, etc.:

image

@pseudotensor
Copy link
Collaborator Author

pseudotensor commented Apr 19, 2023

E.g. can get stuck/slow in:

        elif isinstance(chat_message, str):
            children = self.md.parseInline(chat_message)[0].children
            if children and any("code" in child.tag for child in children):
                return self.md.render(chat_message)
            else:
                chat_message = chat_message.replace("\n", "<br>")
                return self.md.renderInline(chat_message)
        else:
            raise ValueError(f"Invalid message for Chatbot component: {chat_message}")

@pseudotensor
Copy link
Collaborator Author

This hack fixes it:

        elif isinstance(chat_message, str):
            children = self.md.parseInline(chat_message)[0].children
            if children and any("code" in child.tag for child in children):
                return chat_message # self.md.render(chat_message)
            else:
                chat_message = chat_message.replace("\n", "<br>")
                return chat_message  #self.md.renderInline(chat_message)
        else:
            raise ValueError(f"Invalid message for Chatbot component: {chat_message}")

But I don't see option to disable markdown processing gradio, and a bit odd that is so slow. They must have loops in loops or something.

@pseudotensor
Copy link
Collaborator Author

Still shows formatted output in gradio output despite no md processing:

image

pseudotensor added a commit that referenced this issue Apr 20, 2023
…down, single core slowness drags everything down, dealing with each new additional character etc.
@pseudotensor
Copy link
Collaborator Author

fixed with newer gradio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant