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

TerraTorch fit raises KeyErrors in segmentation_tasks.py #22

Closed
rhprasad0 opened this issue Jun 19, 2024 · 6 comments
Closed

TerraTorch fit raises KeyErrors in segmentation_tasks.py #22

rhprasad0 opened this issue Jun 19, 2024 · 6 comments
Assignees

Comments

@rhprasad0
Copy link

Perhaps this is more of an issue with my individual installation than it is of the TT repo, and am not sure that this is something that you will be able to reproduce on your end. I followed the installation instructions and was able to succesfully import terratorch in the python console.

However, when I call terratorch fit --config /home/ryan/terratorch/examples/confs/sen1floods11_vit_ryan.yaml for the Sentinel Floods model, some of the arguments supplied in the configuration file seem to not be read. See the attached screenshot.

In segmentation_tasks.py, when I hardcoded loss, ignore_index popped a KeyError. When I hardcoded ignore_index, class_weights threw a KeyError. It goes on. Not really sure how to debug this - entirely new to PyTorch and Lightning.

Thanks for making this software open source for us!
 
Code_pxIcQjUqzl

@Joao-L-S-Almeida Joao-L-S-Almeida self-assigned this Jun 22, 2024
@rhprasad0
Copy link
Author

@Joao-L-S-Almeida Thanks for have a look at this!

@CarlosGomes98
Copy link
Contributor

Hi @rhprasad0 , if I understand correctly you made changes to the segmentation task class. Could you share those, as well as the configuration yaml you used?

@rhprasad0
Copy link
Author

I was getting keyerrors with the provided sen1floods yaml. My customizations had no effect on the behavior I was experiencing. Is this something you can reproduce on your end with a fresh install? If not, I will make a video.

@rhprasad0
Copy link
Author

rhprasad0 commented Jun 25, 2024

Does this look right?
sen1floods11_vit.txt

default_root_dir being the output directory for the model weights?

@CarlosGomes98
Copy link
Contributor

@rhprasad0 thanks so much for pointing this out. I tracked this down and it seems to be related to version 2.3.0 of lightning and the way they now parse arguments from the cli changing.

I've created the PR #25 which locks lightning to version "<=2.2.5", and should fix this for now. For the future we will have to adapt to how lightning now handles things.

On your end, if you run pip uninstall lightning and then pip install lightning==2.2.5 it should hopefully fix the issue!

@rhprasad0
Copy link
Author

This got me unblocked! Currently training finetuning Prithvi with the default sen1floods11.yaml file with all 6 bands. Next up: 3 bands. Thank you for looking into this, @CarlosGomes98. I wish your work has more attention than it does currently. This is a hell of a lot more convenient than the original Prithvi repo.

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

3 participants