NASA-IMPACT / hls-foundation-os

This repository contains examples of fine-tuning Harmonized Landsat and Sentinel-2 (HLS) Prithvi foundation model.
Apache License 2.0
304 stars 79 forks source link

configs work_dir issue? #19

Closed jakubsadel closed 1 year ago

jakubsadel commented 1 year ago

Hi I would like to test the fine tuning of your model on my data, but first I wanted to see if the whole environment works for me. To do this, following the instructions, I installed all the necessary packages and downloaded the dataset for scars.

I have run following command mim train mmsegmentation --launcher pytorch configs/burn_scars.p

After which a string of errors pops up for me, the most important of which is this one. File "configs/burn_scars.py", line 67, in <module> work_dir = os.path.join(project_dir, experiment) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/config/lazy.py", line 205, in __call__ raise RuntimeError() RuntimeError

This is strange to me because in the main directory of the project I created the corresponding directory it is /project_dir/experiment

Do I misunderstand something and this work_dir should be created elsewhere? Please give me some guidance thanks in advance.

All errors ``` .venv) jsadel@kp-desktops2:~/hls-foundation-os$ mim train mmsegmentation configs/burn_scars.py /home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/model/utils.py:137: UserWarning: Cannot import torch.fx, `merge_dict` is a simple function to merge multiple dicts warnings.warn('Cannot import torch.fx, `merge_dict` is a simple function ' Training command is /home/jsadel/hls-foundation-os/.venv/bin/python3 /home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmseg/.mim/tools/train.py configs/burn_scars.py --launcher none. /home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/model/utils.py:137: UserWarning: Cannot import torch.fx, `merge_dict` is a simple function to merge multiple dicts warnings.warn('Cannot import torch.fx, `merge_dict` is a simple function ' Traceback (most recent call last): File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmseg/.mim/tools/train.py", line 104, in main() File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmseg/.mim/tools/train.py", line 58, in main cfg = Config.fromfile(args.config) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/config/config.py", line 489, in fromfile raise e File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/config/config.py", line 487, in fromfile cfg_dict, imported_names = Config._parse_lazy_import(filename) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/config/config.py", line 1102, in _parse_lazy_import exec( File "configs/burn_scars.py", line 67, in work_dir = os.path.join(project_dir, experiment) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmengine/config/lazy.py", line 205, in __call__ raise RuntimeError() RuntimeError Traceback (most recent call last): File "/home/jsadel/hls-foundation-os/.venv/bin/mim", line 8, in sys.exit(cli()) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mim/commands/train.py", line 100, in cli is_success, msg = train( File "/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mim/commands/train.py", line 261, in train ret = subprocess.check_call( File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/jsadel/hls-foundation-os/.venv/bin/python3', '/home/jsadel/hls-foundation-os/.venv/lib/python3.8/site-packages/mmseg/.mim/tools/train.py', 'configs/burn_scars.py', '--launcher', 'none']' returned non-zero exit status 1. ```
vdemchenko3 commented 11 months ago

Hi, I'm having a similar issue. How did you resolve this?

jakubsadel commented 11 months ago

i have reinstalled mmcv, mmengine and mmsegmentation, and now is fine

jakubsadel commented 11 months ago

@vdemchenko3 this notebook may be helpful

@anumerico hi, some time ago I had also a problem with this setup and I have solve it with help of mmseg tutorial: https://github.com/open-mmlab/mmsegmentation/blob/main/demo/MMSegmentation_Tutorial.ipynb With some code from this notebook I was able to run HLS repo in google colaboratory