TorchSpatiotemporal / tsl

tsl: a PyTorch library for processing spatiotemporal data.
https://torch-spatiotemporal.readthedocs.io/
MIT License
236 stars 22 forks source link

The examples are not working, perhaps some info is missing #11

Closed StefanBloemheuvel closed 1 year ago

StefanBloemheuvel commented 1 year ago

Hi,

Thanks for your work on this package, this really helps out at lot!

I am trying to run the examples/forecasting/run_traffic_experiment.py file, but i get the following error:

C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\pytorch_lightning\utilities\seed.py:55: UserWarning: No seed found, seed set to 1866288922
  rank_zero_warn(f"No seed found, seed set to {seed}")
Global seed set to 1866288922
[2022-12-02 12:10:51,148][tsl][INFO] -
**** Experiment config ****
run:
  seed: 1866288922
  dir: C:\....\experiments\tsl\examples\forecasting\outputs\2022-12-02\12-10-51
  name: 2022-12-02_12-10-51_1866288922

Error executing job with overrides: []
Traceback (most recent call last):
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\tsl\experiment\experiment.py", line 156, in decorated_run_fn
    self.run_output = func(cfg)
  File "run_traffic_experiment.py", line 73, in run_traffic
    dataset = get_dataset(cfg.dataset.name)
omegaconf.errors.ConfigAttributeError: Key 'dataset' is not in struct
    full_key: dataset
    object_type=dict

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

So I thought maybe i have to change line 215 from:

    exp = Experiment(run_fn=run_traffic, config_path='config/traffic')

to

    exp = Experiment(run_fn=run_traffic, config_path='config/traffic/stcn.yaml')

but that gave the following error:

(tsl) sdblo@DLMACHINE C:\Users\sdblo\...\experiments\tsl\examples\forecasting>python run_traffic_experiment.py
Traceback (most recent call last):
  File "run_traffic_experiment.py", line 216, in <module>
    res = exp.run()
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\tsl\experiment\experiment.py", line 189, in run
    self.run_fn()
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\hydra\main.py", line 90, in decorated_main
    _run_hydra(
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\hydra\_internal\utils.py", line 330, in _run_hydra
    validate_config_path(config_path)
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\hydra\core\utils.py", line 293, in validate_config_path
    raise ValueError(msg)
ValueError: Using config_path to specify the config name is not supported, specify the config name via config_name.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/config_path_changes

So it seems there is some information missing in the yaml files. How could this be fixed?

Kind regards

marshka commented 1 year ago

Hi,

thanks for your interest in our work! You are right, we did not put any instructions on how to run the examples scripts, our apologies. You can now find a README file with more details on how to run those scripts at:

https://github.com/TorchSpatiotemporal/tsl/blob/main/examples/README.md

Let me know if you still encounter problems.

Cheers!

StefanBloemheuvel commented 1 year ago

thanks for the quick reply!

I get the following error, which seems to happen due to version errors with the hydra package:

Traceback (most recent call last):
  File "forecasting/run_traffic_experiment.py", line 216, in <module>
    res = exp.run()
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\tsl\experiment\experiment.py", line 189, in run
    self.run_fn()
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\hydra\main.py", line 90, in decorated_main
    _run_hydra(
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\hydra\_internal\utils.py", line 330, in _run_hydra
    validate_config_path(config_path)
  File "C:\Users\sdblo\miniconda3\envs\tsl\lib\site-packages\hydra\core\utils.py", line 293, in validate_config_path
    raise ValueError(msg)
ValueError: Using config_path to specify the config name is not supported, specify the config name via config_name.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/config_path_changes

I ran the setup you propose with the TSL package, shown here:

(tsl) sdblo@DLMACHINE C:\Users\sdblo\...\experiments\tsl\examples>pip freeze
absl-py @ file:///home/conda/feedstock_root/build_artifacts/absl-py_1665754496418/work
aiohttp @ file:///D:/bld/aiohttp_1666878637984/work
aiosignal @ file:///home/conda/feedstock_root/build_artifacts/aiosignal_1667935791922/work
antlr4-python3-runtime==4.9.3
asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1669740551754/work
async-timeout @ file:///home/conda/feedstock_root/build_artifacts/async-timeout_1640026696943/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1659291887007/work
backcall @ file:///home/conda/feedstock_root/build_artifacts/backcall_1592338393461/work
backports.functools-lru-cache @ file:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1618230623929/work
blinker @ file:///home/conda/feedstock_root/build_artifacts/blinker_1664823096650/work
brotlipy @ file:///D:/bld/brotlipy_1666764911856/work
cachetools @ file:///home/conda/feedstock_root/build_artifacts/cachetools_1660055382950/work
certifi==2022.9.24
cffi @ file:///D:/bld/cffi_1666754862652/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1661170624537/work
click @ file:///D:/bld/click_1666798499870/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work
cryptography @ file:///D:/bld/cryptography_1669593566623/work
debugpy @ file:///D:/bld/debugpy_1669710025521/work
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1641555617451/work
einops==0.6.0
entrypoints @ file:///home/conda/feedstock_root/build_artifacts/entrypoints_1643888246732/work
executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1667317341051/work
frozenlist @ file:///D:/bld/frozenlist_1667935581907/work
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1668082755814/work
google-auth @ file:///home/conda/feedstock_root/build_artifacts/google-auth_1668389748046/work
google-auth-oauthlib @ file:///home/conda/feedstock_root/build_artifacts/google-auth-oauthlib_1630497468950/work
grpcio @ file:///D:/bld/grpc-split_1667193609149/work
hydra-core==1.2.0
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1663625384323/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1669312071043/work
importlib-resources==5.10.0
ipykernel @ file:///D:/bld/ipykernel_1668027251175/work
ipython @ file:///D:/bld/ipython_1669904345744/work
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1669134318875/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1654302431367/work
joblib @ file:///home/conda/feedstock_root/build_artifacts/joblib_1663332044897/work
jupyter_client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1668623095912/work
jupyter_core @ file:///D:/bld/jupyter_core_1669776290826/work
Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1657921053229/work
MarkupSafe @ file:///D:/bld/markupsafe_1666770340967/work
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1660814786464/work
multidict @ file:///D:/bld/multidict_1666830108787/work
nest-asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1664684991461/work
numexpr==2.8.4
numpy @ file:///D:/bld/numpy_1668919236258/work
oauthlib @ file:///home/conda/feedstock_root/build_artifacts/oauthlib_1666056362788/work
omegaconf==2.2.3
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1637239678211/work
pandas==1.4.4
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1638334955874/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/platformdirs_1657729053205/work
prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1669057097528/work
protobuf==4.21.9
psutil @ file:///D:/bld/psutil_1667886078163/work
pure-eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1642875951954/work
pyasn1==0.4.8
pyasn1-modules==0.2.7
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
pyDeprecate @ file:///home/conda/feedstock_root/build_artifacts/pydeprecate_1623410077719/work
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1660666458521/work
PyJWT @ file:///home/conda/feedstock_root/build_artifacts/pyjwt_1666240235902/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1665350324128/work
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1652235407899/work
PySocks @ file:///D:/bld/pysocks_1661604991356/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
pytorch-lightning @ file:///home/conda/feedstock_root/build_artifacts/pytorch-lightning_1663971289049/work
pytz==2022.6
pyu2f @ file:///home/conda/feedstock_root/build_artifacts/pyu2f_1604248910016/work
pywin32==304
PyYAML @ file:///D:/bld/pyyaml_1666772539683/work
pyzmq @ file:///D:/bld/pyzmq_1666828542236/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1661872987712/work
requests-oauthlib @ file:///home/conda/feedstock_root/build_artifacts/requests-oauthlib_1643557462909/work
rsa @ file:///home/conda/feedstock_root/build_artifacts/rsa_1658328885051/work
scikit-learn @ file:///D:/bld/scikit-learn_1666884827068/work
scipy==1.9.3
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
stack-data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1669632077133/work
tables==3.7.0
tensorboard @ file:///home/conda/feedstock_root/build_artifacts/tensorboard_1667970813026/work/tensorboard-2.11.0-py3-none-any.whl
tensorboard-data-server @ file:///D:/bld/tensorboard-data-server_1666943944714/work/tensorboard_data_server-0.6.0-py3-none-any.whl
tensorboard-plugin-wit @ file:///home/conda/feedstock_root/build_artifacts/tensorboard-plugin-wit_1641458951060/work/tensorboard_plugin_wit-1.8.1-py3-none-any.whl
threadpoolctl @ file:///home/conda/feedstock_root/build_artifacts/threadpoolctl_1643647933166/work
torch==1.12.1
torch-cluster @ file:///C:/Miniconda/envs/test/conda-bld/pytorch-cluster_1656606372457/work
torch-geometric @ file:///C:/Miniconda/envs/test/conda-bld/pyg_1665661771215/work
torch-scatter @ file:///C:/Miniconda/envs/test/conda-bld/pytorch-scatter_1656602914622/work
torch-sparse @ file:///C:/Miniconda/envs/test/conda-bld/pytorch-sparse_1665389699025/work
torch-spatiotemporal @ file:///C:/Users/sdblo/Mijn%20Drive/PhD/experiments/tsl
torchmetrics @ file:///home/conda/feedstock_root/build_artifacts/torchmetrics_1668675125584/work
tornado @ file:///D:/bld/tornado_1666788847934/work
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1662214488106/work
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1669796852779/work
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1665144421445/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1669259737463/work
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1600965781394/work
Werkzeug @ file:///home/conda/feedstock_root/build_artifacts/werkzeug_1660053523487/work
win-inet-pton @ file:///D:/bld/win_inet_pton_1667051142467/work
yarl @ file:///D:/bld/yarl_1666861919538/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1669453021653/work
marshka commented 1 year ago

The hydra version is correct, I guess the problem is in your code change:

exp = Experiment(run_fn=run_traffic, config_path='config/traffic/stcn.yaml')

The config_path arg must be the directory in which configs are stored, in this case 'config/traffic'. The config you want to use must be specified at runtime, e.g.:

python forecasting/run_traffic_experiment.py config=stcn dataset.name=la
StefanBloemheuvel commented 1 year ago

ah yes indeed! Now it works, thanks for the quick reply. Great work on this package!

marshka commented 1 year ago

Thank you for pointing this out!