Comments (8)
在短期预测读取m4数据 training_values = np.array([v for v in dataset.values[dataset.groups == self.seasonal_patterns]],dtype=np.float32)报错
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (23000,) + inhomogeneous part. 想问一下怎么解决呀
你好,请问你执行的哪个脚本,我这边并没有这个问题,我尝试执行了M4其中一个预测,是正常执行的,日志如下:
##########start training : short_term_forecast_m4_Monthly_TimeMixer_m4_ftM_sl36_ll18_pl18_dm32_nh8_el4_dl1_df32_fc3_ebtimeF_dtTrue_'Exp'_0#########################
train 48000
val 48000
iters: 100, epoch: 1 | loss: 7.8308382
speed: 0.2817s/iter; left time: 5253.2988s
iters: 200, epoch: 1 | loss: 8.6521778
speed: 0.0946s/iter; left time: 1754.8944s
iters: 300, epoch: 1 | loss: 7.9615688
speed: 0.0943s/iter; left time: 1740.0839s
Epoch: 1 cost time: 104.02890491485596
Epoch: 1, Steps: 375 | Train Loss: 8.4553798 Vali Loss: 13.4481628 Test Loss: 13.4481628
Validation loss decreased (inf --> 13.448163). Saving model ...
Updating learning rate to 0.01
iters: 100, epoch: 2 | loss: 6.9544621
speed: 0.9484s/iter; left time: 17332.5653s
iters: 200, epoch: 2 | loss: 7.8785143
speed: 0.0935s/iter; left time: 1699.4366s
iters: 300, epoch: 2 | loss: 8.8131914
speed: 0.0929s/iter; left time: 1680.1044s
Epoch: 2 cost time: 105.14443969726562
Epoch: 2, Steps: 375 | Train Loss: 8.1038713 Vali Loss: 13.2876223 Test Loss: 13.2876223
from timemixer.
from timemixer.
请问你执行的是哪一个脚本,是怎么执行的?这段代码我测试了没有问题
from timemixer.
您好,我也遇到了同样的问题,执行的脚本是scripts/short_term_forecast/M4/TimeMixer.sh脚本,环境按照requirements.txt配置。在上述代码位置添加dtype=object后,会产生新的报错:
File "run.py", line 139, in
exp.train(setting)
File "/home/srwang/nlp/TimeMixer/exp/exp_short_term_forecasting.py", line 99, in train
loss_value = criterion(batch_x, self.args.frequency_map, outputs, batch_y, batch_y_mark)
File "/home/srwang/anaconda3/envs/timemixer/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/srwang/nlp/TimeMixer/utils/losses.py", line 67, in forward
return 200 * t.mean(divide_no_nan(t.abs(forecast - target),
RuntimeError: The size of tensor a (18) must match the size of tensor b (36) at non-singleton dimension 1
from timemixer.
您好,我也遇到了同样的问题,执行的脚本是scripts/short_term_forecast/M4/TimeMixer.sh脚本,环境按照requirements.txt配置。在上述代码位置添加dtype=object后,会产生新的报错: File "run.py", line 139, in exp.train(setting) File "/home/srwang/nlp/TimeMixer/exp/exp_short_term_forecasting.py", line 99, in train loss_value = criterion(batch_x, self.args.frequency_map, outputs, batch_y, batch_y_mark) File "/home/srwang/anaconda3/envs/timemixer/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/srwang/nlp/TimeMixer/utils/losses.py", line 67, in forward return 200 * t.mean(divide_no_nan(t.abs(forecast - target), RuntimeError: The size of tensor a (18) must match the size of tensor b (36) at non-singleton dimension 1
看起来是tensor不匹配,您执行的参数脚本可以发一下嘛,是否和提供的脚本中参数一致呢?
from timemixer.
执行的参数脚本是scripts/short_term_forecast/M4/TimeMixer.sh,和提供的脚本完全一致,具体参数为:
model_name=TimeMixer
e_layers=4
down_sampling_layers=1
down_sampling_window=2
learning_rate=0.01
d_model=32
d_ff=32
batch_size=16
python -u run.py
--task_name short_term_forecast
--is_training 1
--root_path ./dataset/m4
--seasonal_patterns 'Monthly'
--model_id m4_Monthly
--model $model_name
--data m4
--features M
--e_layers $e_layers
--d_layers 1
--factor 3
--enc_in 1
--dec_in 1
--c_out 1
--batch_size 128
--d_model $d_model
--d_ff 32
--des 'Exp'
--itr 1
--learning_rate $learning_rate
--train_epochs 50
--patience 20
--down_sampling_layers $down_sampling_layers
--down_sampling_method avg
--down_sampling_window $down_sampling_window
--loss 'SMAPE'
如果不修改training_values,报错与提问者相同:ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (48000,) + inhomogeneous part.
from timemixer.
你好 我更新了M4短程预测的代码以便于更加便利运行,您可以在尝试一下是否可以运行呢
from timemixer.
感谢您的耐心回答,使用更新后的代码M4可以正常运行了~
from timemixer.
Related Issues (20)
- loss exploding after some iterations HOT 1
- no one scripts can be run HOT 1
- 这个问题是怎么造成的呢 HOT 1
- Test Loss: 41927.7059582 ??? With default hyper-parameters HOT 5
- Why does it look terrible in results? (Weather dataset) HOT 1
- 运行脚本出现以下错误,请问该怎么处理 HOT 3
- 周期趋势的分解 HOT 2
- GELU hard coded HOT 1
- 运行short_term_forecast出现如下报错 HOT 1
- 请问unified hyperparameter和searched hyperparameter有什么区别呢 HOT 1
- 请问这两行代码的作用是什么? HOT 8
- 关于lab_len HOT 1
- Perhaps the logic errors in the code HOT 1
- 设置 args.features = 'MS'时程序错误 HOT 3
- B, T, N = x.size()出错 HOT 4
- The “freeze_support()” line can be omitted if the program is not going to be frozen to produce an executable. HOT 3
- Forecastability的计算 HOT 1
- 关于模型benchmark脚本文件 HOT 2
- How to add future covariates HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timemixer.