QData / spacetimeformer

Multivariate Time Series Forecasting with efficient Transformers. Code for the paper "Long-Range Transformers for Dynamic Spatiotemporal Forecasting."
https://arxiv.org/abs/2109.12218
MIT License
808 stars 191 forks source link

Spacetimeformer invalid accelerator name #60

Closed alre5639 closed 2 years ago

alre5639 commented 2 years ago

executed the following exaple from the readme:

python train.py spacetimeformer exchange --batch_size 32 --warmup_steps 1000 --d_model 200 --d_ff 700 --enc_layers 5 --dec_layers 6 --dropout_emb .1 --dropout_ff .3 --run_name pems-bay-spatiotemporal --base_lr 1e-3 --l2_coeff 1e-3 --loss mae --d_qk 30 --d_v 30 --n_heads 10 --patience 10 --decay_factor .8 --workers 4 --gpus 0

I get the following error:

Traceback (most recent call last):
  File "train.py", line 851, in <module>
    main(args)
  File "train.py", line 816, in main
    trainer = pl.Trainer(
  File "/opt/miniconda3/envs/spacetimeformer/lib/python3.8/site-packages/pytorch_lightning/utilities/argparse.py", line 345, in insert_env_defaults
    return fn(self, **kwargs)
  File "/opt/miniconda3/envs/spacetimeformer/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 433, in __init__
    self._accelerator_connector = AcceleratorConnector(
  File "/opt/miniconda3/envs/spacetimeformer/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/accelerator_connector.py", line 193, in __init__
    self._check_config_and_set_final_flags(
  File "/opt/miniconda3/envs/spacetimeformer/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/accelerator_connector.py", line 292, in _check_config_and_set_final_flags
    raise ValueError(
ValueError: You selected an invalid accelerator name: `accelerator='dp'`. Available names are: cpu, cuda, hpu, ipu, mps, tpu.

I see in the train.py file accelerator is set to "dp". I dont seen "dp" as a valid command in the torch lightning documentation, where dp is a data parallel strategy and the accelerator s/b gpu

jakegrigsby commented 2 years ago

This should just be a pytorch lightning version control issue. There have been a surprising number of breaking changes made since I started this project. IIRC the recent versions changed that kwarg to strategy.

I need to get around to marking the correct version in the requirements. I think it should be 1.6.4? Or manually edit that Trainer call.

(Also that exchange dataset is tiny and non-stationary so I'd recommend a smaller model and trying some of the time series tricks tricks like --linear_window, --use_seasonal_decomp, and --use_revin)

alre5639 commented 2 years ago

Thanks Jake, I assumed that was the issue but wanted to be sure. For the record switching the line in the train.py file to accelerator = "GPU" did fix the issue, just incase anyone else has the same issue :) I appreciate the advice as I am fairly new to this area, thanks again!