Skip to content

Encountered Error when generating visualization using matplotlib #1337

@jackfood

Description

@jackfood

Describe the bug

`Viewing image...

Traceback (most recent call last):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\respond.py", line 79, in respond
for chunk in interpreter.llm.run(messages_for_llm):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\llm\llm.py", line 141, in run
image_description = self.vision_renderer(lmc=img_msg)
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\computer\vision\vision.py", line 171, in query
answer = self.model.answer_question(
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\moondream.py", line 93, in answer_question
answer = self.generate(
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\moondream.py", line 77, in generate
output_ids = self.text_model.generate(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\transformers\generation\utils.py", line 1914, in generate
result = self._sample(
File "D:\Python~OpenInterpreter\lib\site-packages\transformers\generation\utils.py", line 2651, in _sample
outputs = self(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 1104, in forward
outputs = self.transformer(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 959, in forward
layer_outputs = decoder_layer(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 763, in forward
attn_outputs, self_attn_weights, present_key_value = self.mixer(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 382, in forward
query_rot, key_rot = apply_rotary_pos_emb(
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 214, in apply_rotary_pos_emb
cos = cos[position_ids].unsqueeze(unsqueeze_dim)
IndexError: index is out of bounds for dimension with size 0

Traceback (most recent call last):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\respond.py", line 79, in respond
for chunk in interpreter.llm.run(messages_for_llm):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\llm\llm.py", line 141, in run
image_description = self.vision_renderer(lmc=img_msg)
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\computer\vision\vision.py", line 171, in query
answer = self.model.answer_question(
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\moondream.py", line 93, in answer_question
answer = self.generate(
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\moondream.py", line 77, in generate
output_ids = self.text_model.generate(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\transformers\generation\utils.py", line 1914, in generate
result = self._sample(
File "D:\Python~OpenInterpreter\lib\site-packages\transformers\generation\utils.py", line 2651, in _sample
outputs = self(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 1104, in forward
outputs = self.transformer(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 959, in forward
layer_outputs = decoder_layer(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 763, in forward
attn_outputs, self_attn_weights, present_key_value = self.mixer(
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Python~OpenInterpreter\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 382, in forward
query_rot, key_rot = apply_rotary_pos_emb(
File
"C:\Users\Peter-Susan.cache\huggingface\modules\transformers_modules\vikhyatk\moondream2\9ba2958f5a886de83fa18a235d6512
95a05b4d13\modeling_phi.py", line 214, in apply_rotary_pos_emb
cos = cos[position_ids].unsqueeze(unsqueeze_dim)
IndexError: index is out of bounds for dimension with size 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Python\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "D:\Python~OpenInterpreter\Scripts\interpreter.exe_main
.py", line 7, in
sys.exit(main())
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line
525, in main
start_terminal_interface(interpreter)
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line
491, in start_terminal_interface
interpreter.chat()
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\core.py", line 188, in chat
for _ in self._streaming_chat(message=message, display=display):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\core.py", line 220, in _streaming_chat
yield from terminal_interface(self, message)
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\terminal_interface\terminal_interface.py", line 140, in
terminal_interface
for chunk in interpreter.chat(message, display=False, stream=True):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\core.py", line 259, in _streaming_chat
yield from self._respond_and_store()
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\core.py", line 310, in _respond_and_store
for chunk in respond(self):
File "D:\Python~OpenInterpreter\lib\site-packages\interpreter\core\respond.py", line 125, in respond
raise Exception("Error occurred. " + str(e))
Exception: Error occurred. index is out of bounds for dimension with size 0`

Reproduce

Using LMstudio and Deepseekv2 GGUF,

1st prompt: perform simple analyse for C:\Data Sample.xlsx
[basic dataset generated]
2nd prompt: perform visualization on the dataset

import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_excel('C:\\Users\\Peter-Susan\\Desktop\\Data Sample.xlsx')
plt.figure(figsize=(10, 5))
plt.bar(data['LocID'], data['ASFR'])
plt.xlabel('Location ID')
plt.ylabel('Age Specific Fertility Rate (ASFR)')
plt.title('Bar Plot of ASFR by LocID')
plt.show()

Viewing image...

Expected behavior

A new windows pop up for visualization

Screenshots

image
image

Open Interpreter version

0.3.4

Python version

3.10.0

Operating System name and version

Windows 11

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions