Closed GG-Lizen closed 7 months ago
It's really a bit of like reasoning time consuming problem.
It's really a bit of like reasoning time consuming problem.
- How long does it take to set up inference?
- 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.
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
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.
Bug description An easy example like Data Visualization can work fine, but examples like Machine Learning Modeling often encounter timeout errors.
Environment information
Screenshots or logs
cmd:
python examples/di/machine_learning.py --use_case sales_forecast
output: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: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. Useasyncio.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
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 usingpd.to_datetime()
function before passing it toseasonal_decompose()
. Here's the updated code:Is this an issue with Ollama? How should I go about resolving it? Thank you for your response!