jupyterlab / jupyter-ai

A generative AI extension for JupyterLab
https://jupyter-ai.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
3.22k stars 325 forks source link

IndexError: list index out of range??? #571

Open 0xNullLight opened 10 months ago

0xNullLight commented 10 months ago

Description

I'm trying to use a huggingface api with jupyter_ai

I keep getting this

Task exception was never retrieved
future: <Task finished name='Task-181143' coro=<RootChatHandler._route() done, defined at /home/user1/anaconda3/lib/python3.11/site-packages/jupyter_ai/handlers.py:215> exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "/home/user1/anaconda3/lib/python3.11/site-packages/jupyter_ai/handlers.py", line 219, in _route
    maybe_command = message.body.split(None, 1)[0]
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

I already retried re-installing jupyter_ai multiple times with pip install jupyter-ai

I even tried.. pip3 install jupyter_ai --upgrade --force-reinstall not sure why I keep getting that error..

Reproduce

After installing jupyter-ai, I attempt to use the Jupyter AI Chat. Added WizardLM/WizardCoder-Python-34B-V1.0 on Local model ID added my api on hugging face (write)

Type in hello on the chat..

Expected behavior

I expected the chatbot to respond back to me. But it didn't. Instead on the terminal I used to open up jupyter-labs it says..

Switching chat language model from None to huggingface_hub:WizardLM/WizardCoder-Python-34B-V1.0.
/home/user1/anaconda3/lib/python3.11/site-packages/huggingface_hub/utils/_deprecation.py:127: FutureWarning: '__init__' (from 'huggingface_hub.inference_api') is deprecated and will be removed from version '0.19.0'. `InferenceApi` client is deprecated in favor of the more feature-complete `InferenceClient`. Check out this guide to learn how to convert your script to use it: https://huggingface.co/docs/huggingface_hub/guides/inference#legacy-inferenceapi-client.
  warnings.warn(warning_message, FutureWarning)

> Entering new ConversationChain chain...
Prompt after formatting:
You are Jupyternaut, a conversational assistant living in JupyterLab to help users.
You are not a language model, but rather an application built on a foundation model from Hugging Face Hub called codellama/CodeLlama-13b-Python-hf.
You are talkative and you provide lots of specific details from the foundation model's context.
You may use Markdown to format your response.
Code blocks must be formatted in Markdown.
Math should be rendered with inline TeX markup, surrounded by $.
If you do not know the answer to a question, answer truthfully by responding that you do not know.
The following is a friendly conversation between you and a human.

Current conversation:

Human: hello
AI:

I went back to the browser, click entered and the IndexError mention above popped up

Context

Troubleshoot Output
    jupyter_ai                    2.9.0
    jupyter_ai_magics             2.9.0
welcome[bot] commented 10 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

JasonWeill commented 10 months ago

Hi @Hcrypt! Thanks so much for filing this issue. Do you see this with all models under Hugging Face Hub? I tried to use the same model, and while I didn't see the error you saw with the prompt hello, I got a timeout:

[E 2024-01-11 17:04:42.622 AiExtension] Error raised by inference API: Model WizardLM/WizardCoder-Python-34B-V1.0 time out
[I 2024-01-11 17:04:42.628 ServerApp] Default chat handler resolved in 334501 ms.

Do you see the same error with other model providers?

0xNullLight commented 9 months ago

Yea, I get the same error with all the models. How did set yours up to get it working? Just curious so I can follow through exactly what you went through just to double check what's happening here.

JasonWeill commented 9 months ago

I typically build and run Jupyter AI from source, using the ./scripts/install.sh script from my local jupyter-ai repository. If you still see this bug with the newest published version of Jupyter AI (2.9.1), could you please try with the tip of the main branch? Thanks!