MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

asyncio.exceptions.TimeoutError

Open GG-Lizen opened this issue 1 year ago • 2 comments
trafficstars

Bug description An easy example like Data Visualization can work fine, but examples like Machine Learning Modeling often encounter timeout errors.

Environment information

  • LLM type and model name: ollama, wizardcoder:34b-python/wizardcoder:13b-python
  • System version:win11
  • Python version: 3.10.13
  • metagpt version: 0.7.4
  • installation method: pip install -e .

Screenshots or logs

cmd: python examples/di/machine_learning.py --use_case sales_forecast output:

2024-03-24 00:18:18.070 | INFO     | metagpt.const:get_metagpt_package_root:29 - Package root set to e:\mytask\metagpt\metagpt
content_type  application/x-ndjson
```json
[
    {
        "task_id": "1",
        "dependent_task_ids": [],
        "instruction": "Perform exploratory data analysis to visualize sales trends, holiday effects, and distribution of sales across stores/departments using box/violin plots.",
        "task_type": "eda"
    },
    {
        "task_id": "2",
        "dependent_task_ids": ["1"],
        "instruction": "Perform time series decomposition to identify the seasonality and trend of sales data.",
        "task_type": "eda"
    },
    {
        "task_id": "3",
        "dependent_task_ids": ["2"],
        "instruction": "Create heatmaps of sales across stores over time to identify patterns in store-specific sales trends.",
        "task_type": "eda"
    },
    {
        "task_id": "4",
        "dependent_task_ids": ["1"],
        "instruction": "Create correlation matrices between features to identify the impact of holiday on sales and other factors.",
        "task_type": "eda"
    },
    {
        "task_id": "5",
        "dependent_task_ids": [],
        "instruction": "Split data into train and eval sets, normalize features, and perform feature engineering.",
        "task_type": "data preprocessing"
    },
    {
        "task_id": "6",
        "dependent_task_ids": ["5"],
        "instruction": "Train a model to forecast 'Weekly_Sales' considering holiday effects.",
        "task_type": "model train"
    },
    {
        "task_id": "7",
        "dependent_task_ids": ["6"],
        "instruction": "Evaluate the model using MAE or RMSE to assess accuracy and make predictions on eval data.",
        "task_type": "model evaluate"
    },
    {
        "task_id": "8",
        "dependent_task_ids": ["7"],
        "instruction": "Create bar charts for factor impact on sales, including holiday effects and other factors.",
        "task_type": "eda"
    },
    {
        "task_id": "9",
        "dependent_task_ids": ["8"],
        "instruction": "Analyze prediction error distribution to identify potential issues in the model.",
        "task_type": "eda"
    }
]
```
2024-03-24 00:22:28.687 | INFO     | metagpt.utils.cost_manager:update_cost:108 - prompt_tokens: 696, completion_tokens: 594
2024-03-24 00:22:28.689 | INFO     | metagpt.roles.role:_plan_and_act:484 - ready to take on task task_id='1' dependent_task_ids=[] instruction='Perform exploratory data analysis to visualize sales trends, holiday effects, and distribution of sales across stores/departments using box/violin plots.' task_type='eda' code='' result='' is_success=False is_finished=False
2024-03-24 00:22:28.690 | INFO     | metagpt.roles.di.data_interpreter:_write_code:149 - ready to WriteAnalysisCode
content_type  application/x-ndjson

To perform exploratory data analysis for sales trends, holiday effects, and distribution of sales across stores/departments using box/violin plots, we can use the `seaborn` library in Python. Here's a sample code to get you started:

```python
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from datetime import datetime
%matplotlib inline

# Read data
train_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/train.csv')
eval_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/eval.csv')

# Convert date column to datetime format
train_data['Date'] = pd.to_datetime(train_data['Date'])
eval_data['Date'] = pd.to_datetime(eval_data['Date'])

# Check data types of columns
print(train_data.dtypes)

# Box plot for sales trends across stores and departments
sns.boxplot(x='Store', y='Weekly_Sales', data=train_data)
plt.show()
sns.boxplot(x='Dept', y='Weekly_Sales', data=train_data)
plt.show()

# Violin plot for sales trends across stores and departments
sns.violinplot(x='Store', y='Weekly_Sales', data=train_data)
plt.show()
sns.violinplot(x='Dept', y='Weekly_Sales', data=train_data)
plt.show()

# Time series decomposition for sales trends
from statsmodels.tsa.seasonal import seasonal_decompose
result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
fig = result.plot()
plt.show()

# Heatmap of sales across stores over time
sns.heatmap(train_data.pivot('Date', 'Store', 'Weekly_Sales').corr(), annot=True, cmap='coolwarm')
plt.show()

# Correlation matrix between features
corrmat = train_data.select_dtypes(include=[np.number]).corr()
sns.heatmap(corrmat, cmap='coolwarm', annot=True)
plt.show()
```

This code reads in the data from the given paths and performs various exploratory data analysis tasks using `seaborn` library functions. It also checks the data types of columns to select numerical features for correlation matrix analysis.
2024-03-24 00:26:40.016 | INFO     | metagpt.utils.cost_manager:update_cost:108 - prompt_tokens: 530, completion_tokens: 624
   1 import pandas as pd
   2 import numpy as np
   3 import seaborn as sns
   4 import matplotlib.pyplot as plt
   5 from datetime import datetime
   6 %matplotlib inline
   7
   8 # Read data
   9 train_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/train.csv')
  10 eval_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/eval.csv')
  11
  12 # Convert date column to datetime format
  13 train_data['Date'] = pd.to_datetime(train_data['Date'])
  14 eval_data['Date'] = pd.to_datetime(eval_data['Date'])
  15
  16 # Check data types of columns
  17 print(train_data.dtypes)
  18
  19 # Box plot for sales trends across stores and departments
  20 sns.boxplot(x='Store', y='Weekly_Sales', data=train_data)
  21 plt.show()
  22 sns.boxplot(x='Dept', y='Weekly_Sales', data=train_data)
  23 plt.show()
  24
  25 # Violin plot for sales trends across stores and departments
  26 sns.violinplot(x='Store', y='Weekly_Sales', data=train_data)
  27 plt.show()
  28 sns.violinplot(x='Dept', y='Weekly_Sales', data=train_data)
  29 plt.show()
  30
  31 # Time series decomposition for sales trends
  32 from statsmodels.tsa.seasonal import seasonal_decompose
  33 result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
  34 fig = result.plot()
  35 plt.show()
  36
  37 # Heatmap of sales across stores over time
  38 sns.heatmap(train_data.pivot('Date', 'Store', 'Weekly_Sales').corr(), annot=True, cmap='coolwarm')
  39 plt.show()
  40
  41 # Correlation matrix between features
  42 corrmat = train_data.select_dtypes(include=[np.number]).corr()
  43 sns.heatmap(corrmat, cmap='coolwarm', annot=True)
  44 plt.show()
  45
D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\zmq\_future.py:693: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required for zmq. Registering an additional selector thread for add_reader support via tornado. Use `asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())` to avoid this warning.
  self._get_loop()
Store                    int64
Dept                     int64
Date            datetime64[ns]
Weekly_Sales           float64
IsHoliday                 bool
dtype: object
,,,,,---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 33
     31 # Time series decomposition for sales trends
     32 from statsmodels.tsa.seasonal import seasonal_decompose
---> 33 result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
     34 fig = result.plot()
     35 plt.show()

File D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\statsmodels\tsa\seasonal.py:166, in seasonal_decompose(x, model, filt, period, two_sided, extrapolate_trend)
    164         period = pfreq
    165     else:
--> 166         raise ValueError(
    167             "You must specify a period or x must be a pandas object with "
    168             "a PeriodIndex or a DatetimeIndex with a freq not set to None"
    169         )
    170 if x.shape[0] < 2 * pfreq:
    171     raise ValueError(
    172         f"x must have 2 complete cycles requires {2 * pfreq} "
    173         f"observations. x only has {x.shape[0]} observation(s)"
    174     )

ValueError: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None
2024-03-24 00:27:01.367 | INFO     | metagpt.roles.di.data_interpreter:_write_code:149 - ready to WriteAnalysisCode
content_type  application/x-ndjson
```python
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from datetime import datetime
%matplotlib inline

# Read data
train_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/train.csv')
eval_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/eval.csv')

# Convert date column to datetime format
train_data['Date'] = pd.to_datetime(train_data['Date'])
eval_data['Date'] = pd.to_datetime(eval_data['Date'])

# Check data types of columns
print(train_data.dtypes)

# Box plot for sales trends across stores and departments
sns.boxplot(x='Store', y='Weekly_Sales', data=train_data)
plt.show()
sns.boxplot(x='Dept', y='Weekly_Sales', data=train_data)
plt.show()

# Violin plot for sales trends across stores and departments
sns.violinplot(x='Store', y='Weekly_Sales', data=train_data)
plt.show()
sns.violinplot(x='Dept', y='Weekly_Sales', data=train_data)
plt.show()

# Time series decomposition for sales trends
from statsmodels.tsa.seasonal import seasonal_decompose
result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
fig = result.plot()
plt.show()

# Heatmap of sales across stores over time
sns.heatmap(train_data.pivot('Date', 'Store', 'Weekly_Sales').corr(), annot=True, cmap='coolwarm')
plt.show()

# Correlation matrix between features
corrmat = train_data.select_dtypes(include=[np.number]).corr()
sns.heatmap(corrmat, cmap='coolwarm', annot=True)
plt.show()
```
2024-03-24 00:31:28.274 | INFO     | metagpt.utils.cost_manager:update_cost:108 - prompt_tokens: 953, completion_tokens: 517
   1 import pandas as pd
   2 import numpy as np
   3 import seaborn as sns
   4 import matplotlib.pyplot as plt
   5 from datetime import datetime
   6 %matplotlib inline
   7
   8 # Read data
   9 train_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/train.csv')
  10 eval_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/eval.csv')
  11
  12 # Convert date column to datetime format
  13 train_data['Date'] = pd.to_datetime(train_data['Date'])
  14 eval_data['Date'] = pd.to_datetime(eval_data['Date'])
  15
  16 # Check data types of columns
  17 print(train_data.dtypes)
  18
  19 # Box plot for sales trends across stores and departments
  20 sns.boxplot(x='Store', y='Weekly_Sales', data=train_data)
  21 plt.show()
  22 sns.boxplot(x='Dept', y='Weekly_Sales', data=train_data)
  23 plt.show()
  24
  25 # Violin plot for sales trends across stores and departments
  26 sns.violinplot(x='Store', y='Weekly_Sales', data=train_data)
  27 plt.show()
  28 sns.violinplot(x='Dept', y='Weekly_Sales', data=train_data)
  29 plt.show()
  30
  31 # Time series decomposition for sales trends
  32 from statsmodels.tsa.seasonal import seasonal_decompose
  33 result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
  34 fig = result.plot()
  35 plt.show()
  36
  37 # Heatmap of sales across stores over time
  38 sns.heatmap(train_data.pivot('Date', 'Store', 'Weekly_Sales').corr(), annot=True, cmap='coolwarm')
  39 plt.show()
  40
  41 # Correlation matrix between features
  42 corrmat = train_data.select_dtypes(include=[np.number]).corr()
  43 sns.heatmap(corrmat, cmap='coolwarm', annot=True)
  44 plt.show()
  45
Store                    int64
Dept                     int64
Date            datetime64[ns]
Weekly_Sales           float64
IsHoliday                 bool
dtype: object
,,,,,---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[2], line 33
     31 # Time series decomposition for sales trends
     32 from statsmodels.tsa.seasonal import seasonal_decompose
---> 33 result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
     34 fig = result.plot()
     35 plt.show()

File D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\statsmodels\tsa\seasonal.py:166, in seasonal_decompose(x, model, filt, period, two_sided, extrapolate_trend)
    164         period = pfreq
    165     else:
--> 166         raise ValueError(
    167             "You must specify a period or x must be a pandas object with "
    168             "a PeriodIndex or a DatetimeIndex with a freq not set to None"
    169         )
    170 if x.shape[0] < 2 * pfreq:
    171     raise ValueError(
    172         f"x must have 2 complete cycles requires {2 * pfreq} "
    173         f"observations. x only has {x.shape[0]} observation(s)"
    174     )

ValueError: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None
2024-03-24 00:31:45.464 | INFO     | metagpt.roles.di.data_interpreter:_write_code:149 - ready to WriteAnalysisCode
content_type  application/x-ndjson
To fix the error, you need to convert `Date` column to datetime format using `pd.to_datetime()` function before passing it to `seasonal_decompose()`. Here's the updated code:

```python
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from datetime import datetime
%matplotlib inline

# Read data
train_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/train.csv')
eval_data = pd.read_csv('E:/MyTask/Metagpt/dataset/salesForecast/eval.csv')

# Convert date column to datetime format
train_data['Date'] = pd.to_datetime(train_data['Date'])
eval_data['Date'] = pd.to_datetime(eval_data['Date'])

# Box plot for sales trends across stores and departments
sns.boxplot(x='Store', y='Weekly_Sales', data=train_data)
plt.show()
sns.boxplot(x='Dept', y='Weekly_Sales', data=train_data)
plt.show()

# Violin plot for sales trends across stores and departments
sns.violinplot(x='Store', y='Weekly_Sales', data=train_data)
plt.show()
sns.violinplot(x='Dept', y='Weekly_Sales', data=train_data)
plt.show()

# Time series decomposition for sales trends
from statsmodels.tsa.seasonal import seasonal_decompose
result = seasonal_decompose(train_data['Weekly_Sales'], model='additive')
fig = result.plot()
plt.show()

# Heatmap of sales across stores over time
sns.heatmap(train_data.pivot('Date', 'Store', 'Weekly_Sales').corr(), annot=True, cmap='coolwarm')
plt.show()

# Correlation matrix between features
2024-03-24 00:36:45.636 | WARNING  | metagpt.utils.common:wrapper:647 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory.
corrmat = train_data.select_dtypes(include=[npTraceback (most recent call last):
  File "e:\mytask\metagpt\metagpt\metagpt\utils\common.py", line 638, in wrapper
    return await func(self, *args, **kwargs)
  File "e:\mytask\metagpt\metagpt\metagpt\roles\role.py", line 548, in run
    rsp = await self.react()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\role.py", line 519, in react
    rsp = await self._plan_and_act()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 89, in _plan_and_act
    rsp = await super()._plan_and_act()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\role.py", line 487, in _plan_and_act
    task_result = await self._act_on_task(task)
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 95, in _act_on_task
    code, result, is_success = await self._write_and_exec_code()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 121, in _write_and_exec_code
    code, cause_by = await self._write_code(counter, plan_status, tool_info)
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 154, in _write_code
    code = await todo.run(
  File "e:\mytask\metagpt\metagpt\metagpt\actions\di\write_analysis_code.py", line 59, in run
    rsp = await self.llm.aask(context, system_msgs=[INTERPRETER_SYSTEM_MSG], **kwargs)
  File "e:\mytask\metagpt\metagpt\metagpt\provider\base_llm.py", line 127, in aask
    rsp = await self.acompletion_text(message, stream=stream, timeout=timeout)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\__init__.py", line 314, in iter
    return fut.result()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\concurrent\futures\_base.py", line 451, in result
    return self.__get_result()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
  File "e:\mytask\metagpt\metagpt\metagpt\provider\base_llm.py", line 175, in acompletion_text
    return await self._achat_completion_stream(messages, timeout=timeout)
  File "e:\mytask\metagpt\metagpt\metagpt\provider\ollama_api.py", line 79, in _achat_completion_stream
    async for raw_chunk in stream_resp:
  File "e:\mytask\metagpt\metagpt\metagpt\provider\general_api_base.py", line 413, in wrap_resp
    async for r in resp:
  File "e:\mytask\metagpt\metagpt\metagpt\provider\general_api_requestor.py", line 87, in <genexpr>
    return (
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 35, in __anext__
    rv = await self.read_func()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 311, in readline
    return await self.readuntil()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 343, in readuntil
    await self._wait("readuntil")
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 303, in _wait
    with self._timer:
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\helpers.py", line 725, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\MyTask\Metagpt\MetaGPT\examples\di\machine_learning.py", line 23, in <module>
    fire.Fire(main)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\fire\core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\fire\core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\fire\core.py", line 679, in _CallAndUpdateTrace
    component = loop.run_until_complete(fn(*varargs, **kwargs))
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "E:\MyTask\Metagpt\MetaGPT\examples\di\machine_learning.py", line 19, in main
    await mi.run(requirement)
  File "e:\mytask\metagpt\metagpt\metagpt\utils\common.py", line 660, in wrapper
    raise Exception(format_trackback_info(limit=None))
Exception: Traceback (most recent call last):
  File "e:\mytask\metagpt\metagpt\metagpt\utils\common.py", line 638, in wrapper
    return await func(self, *args, **kwargs)
  File "e:\mytask\metagpt\metagpt\metagpt\roles\role.py", line 548, in run
    rsp = await self.react()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\role.py", line 519, in react
    rsp = await self._plan_and_act()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 89, in _plan_and_act
    rsp = await super()._plan_and_act()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\role.py", line 487, in _plan_and_act
    task_result = await self._act_on_task(task)
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 95, in _act_on_task
    code, result, is_success = await self._write_and_exec_code()
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 121, in _write_and_exec_code
    code, cause_by = await self._write_code(counter, plan_status, tool_info)
  File "e:\mytask\metagpt\metagpt\metagpt\roles\di\data_interpreter.py", line 154, in _write_code
    code = await todo.run(
  File "e:\mytask\metagpt\metagpt\metagpt\actions\di\write_analysis_code.py", line 59, in run
    rsp = await self.llm.aask(context, system_msgs=[INTERPRETER_SYSTEM_MSG], **kwargs)
  File "e:\mytask\metagpt\metagpt\metagpt\provider\base_llm.py", line 127, in aask
    rsp = await self.acompletion_text(message, stream=stream, timeout=timeout)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\__init__.py", line 314, in iter
    return fut.result()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\concurrent\futures\_base.py", line 451, in result
    return self.__get_result()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\tenacity\_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
  File "e:\mytask\metagpt\metagpt\metagpt\provider\base_llm.py", line 175, in acompletion_text
    return await self._achat_completion_stream(messages, timeout=timeout)
  File "e:\mytask\metagpt\metagpt\metagpt\provider\ollama_api.py", line 79, in _achat_completion_stream
    async for raw_chunk in stream_resp:
  File "e:\mytask\metagpt\metagpt\metagpt\provider\general_api_base.py", line 413, in wrap_resp
    async for r in resp:
  File "e:\mytask\metagpt\metagpt\metagpt\provider\general_api_requestor.py", line 87, in <genexpr>
    return (
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 35, in __anext__
    rv = await self.read_func()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 311, in readline
    return await self.readuntil()
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 343, in readuntil
    await self._wait("readuntil")
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\streams.py", line 303, in _wait
    with self._timer:
  File "D:\Dev_Software\Anaconda\envs\metagpt\lib\site-packages\aiohttp\helpers.py", line 725, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

[IPKernelApp] WARNING | Parent appears to have exited, shutting down.

image Is this an issue with Ollama? How should I go about resolving it? Thank you for your response!

GG-Lizen avatar Mar 24 '24 04:03 GG-Lizen

It's really a bit of like reasoning time consuming problem.

  1. How long does it take to set up inference?
  2. How long did it take for the observed timeout to occur?

geekan avatar Mar 25 '24 03:03 geekan

It's really a bit of like reasoning time consuming problem.

  1. How long does it take to set up inference?
  2. How long did it take for the observed timeout to occur?

After running several times, bugs consistently occurred during the code generation process, which typically took about four to five minutes. The occurrence of bugs probably greater than five minutes into the code generation process.

GG-Lizen avatar Mar 25 '24 11:03 GG-Lizen

From the logs of previous attempts, I have discovered the same issue.( Among six attempts, there were three instances of asyncio.exceptions.TimeoutError. The logs were generated by running the command nohup python examples/di/machine_learning.py > ./logs/xx.log 2>&1 &. )

A common feature among these logs is that the last respond is repeated more than 26 times. Have you ever encountered the same problem?I am not sure if this is related to the bug or not.

logs are here: di_machine_learning_sales_forecast.log di_machine_learning_sales_forecast2.log di_machine_learning_sales_forecast3.log

orange-crow avatar Mar 30 '24 11:03 orange-crow

From the logs of previous attempts, I have discovered the same issue.( Among six attempts, there were three instances of asyncio.exceptions.TimeoutError. The logs were generated by running the command nohup python examples/di/machine_learning.py > ./logs/xx.log 2>&1 &. )

A common feature among these logs is that the last respond is repeated more than 26 times. Have you ever encountered the same problem?I am not sure if this is related to the bug or not.

logs are here: di_machine_learning_sales_forecast.log di_machine_learning_sales_forecast2.log di_machine_learning_sales_forecast3.log

in new release It takes more than ten minutes of reasoning to make an timeouterror,and repeated respond may cause by the format returned by LLM is incorrect, or the generated code consistently has bugs. switch model or call llm api may help.

GG-Lizen avatar Mar 30 '24 12:03 GG-Lizen