Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改预测序列长度报错 #69

Open
preetypig opened this issue Dec 18, 2024 · 1 comment
Open

修改预测序列长度报错 #69

preetypig opened this issue Dec 18, 2024 · 1 comment

Comments

@preetypig
Copy link

您好!作者。
我在使用自己的数据集复现您的代码时,首先使用TSformer.py生成pt文件(修改了input_len=247已经num_tokens=247/12),在STEP.py上预测output_len=12时能够顺利复现您的代码,并取得优秀性能!
但改变STEP.py文件中的output_len=48后,出现以下报错:
Traceback (most recent call last):
File "/mnt/3.6TB-DATA/liji/BasicTS-master/experiments/train.py", line 29, in
main()
File "/mnt/3.6TB-DATA/liji/BasicTS-master/experiments/train.py", line 23, in main
basicts.launch_training(args.cfg, args.gpus, node_rank=0)
File "/mnt/3.6TB-DATA/liji/BasicTS-master/basicts/launcher.py", line 118, in launch_training
easytorch.launch_training(cfg=cfg, devices=gpus, node_rank=node_rank)
File "/home/pcz4514/anaconda3/envs/liji_graph/lib/python3.9/site-packages/easytorch/launcher/launcher.py", line 86, in launch_training
train_dist(cfg)
File "/home/pcz4514/anaconda3/envs/liji_graph/lib/python3.9/site-packages/easytorch/launcher/launcher.py", line 35, in training_func
raise e
File "/home/pcz4514/anaconda3/envs/liji_graph/lib/python3.9/site-packages/easytorch/launcher/launcher.py", line 31, in training_func
runner.train(cfg)
File "/mnt/3.6TB-DATA/liji/BasicTS-master/basicts/runners/base_epoch_runner.py", line 430, in train
loss = self.train_iters(epoch, iter_index, data)
File "/mnt/3.6TB-DATA/liji/BasicTS-master/basicts/runners/base_tsf_runner.py", line 345, in train_iters
loss = self.metric_forward(self.loss, forward_return)
File "/mnt/3.6TB-DATA/liji/BasicTS-master/basicts/runners/base_tsf_runner.py", line 321, in metric_forward
metric_item = metric_func(**args)
File "/mnt/3.6TB-DATA/liji/BasicTS-master/baselines/STEP/loss/step_loss.py", line 13, in step_loss
loss_pred = masked_mae(prediction=prediction, target=target, null_val=null_val)
File "/mnt/3.6TB-DATA/liji/BasicTS-master/basicts/metrics/mae.py", line 34, in masked_mae
loss = torch.abs(prediction - target)
RuntimeError: The size of tensor a (37) must match the size of tensor b (5) at non-singleton dimension 3
请问是否是STEP.py中还有相应参数需要改变,您是否可以解答该问题,谢谢!

@preetypig
Copy link
Author

对了,补充上面的问题。我的数据集有17个特征,但我只需要其预测最后5个特征,所以我在TSFormer.py和STRP.py中都加入了一行CFG.MODEL.TARGET_TIME_SERIES =[12, 13, 14, 15, 16]的代码。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant