Skip to content

Commit f655c8c

Browse files
authored
Merge branch 'main' into naip_analysis
2 parents ae04893 + 06f82f7 commit f655c8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+8969
-20474
lines changed

.binder/environment.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: claymodel
2+
channels:
3+
- conda-forge
4+
- pytorch
5+
- nodefaults
6+
dependencies:
7+
- conda-lock~=2.5.6
8+
- einops~=0.7.0
9+
- fiona~=1.9.5
10+
- geopandas-base~=0.14.1
11+
- h5netcdf~=1.3.0
12+
- jupyter-book~=1.0.0
13+
- jupyterlab~=4.0.7
14+
- jsonargparse~=4.27.0
15+
- lightning~=2.1.0
16+
- matplotlib-base~=3.8.2
17+
- planetary-computer~=1.0.0
18+
- python-box~=7.1.0
19+
- pytorch~=2.1.0
20+
- cpuonly
21+
- python~=3.11.0
22+
- pyarrow~=16.1.0
23+
- rioxarray~=0.15.0
24+
- rasterio~=1.3.10
25+
- s3fs~=2024.3.1
26+
- scikit-image~=0.22.0
27+
- scikit-learn~=1.4.0
28+
- stackstac~=0.5.0
29+
- timm~=0.9.16
30+
- torchdata~=0.7.1
31+
- torchvision~=0.16.1
32+
- transformers~=4.35.2
33+
- typeshed-client~=2.4.0
34+
- vit-pytorch~=1.6.4
35+
- wandb~=0.15.12
36+
- zarr~=2.16.1

.github/workflows/test.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

README.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66

77
An open source AI model and interface for Earth.
88

9-
# Getting started
10-
119
## Quickstart
1210

1311
Launch into a [JupyterLab](https://jupyterlab.readthedocs.io) environment on
1412

15-
| [Binder](https://mybinder.readthedocs.io/en/latest) | [Planetary Computer](https://planetarycomputer.microsoft.com) | [SageMaker Studio Lab](https://studiolab.sagemaker.aws) |
16-
|:--:|:--:|:--:|
17-
| [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Clay-foundation/model/main) | [![Open on Planetary Computer](https://img.shields.io/badge/Open-Planetary%20Computer-black?style=flat&logo=microsoft)](https://pccompute.westeurope.cloudapp.azure.com/compute/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2FClay-foundation%2Fmodel&urlpath=lab%2Ftree%2Fmodel%2Fplaceholder.ipynb&branch=main) | [![Open in SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/Clay-foundation/model/blob/main/placeholder.ipynb) |
13+
| [Binder](https://mybinder.readthedocs.io/en/latest) | [SageMaker Studio Lab](https://studiolab.sagemaker.aws) |
14+
|:--:|:--:|
15+
| [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Clay-foundation/model/main) | [![Open in SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/Clay-foundation/model/blob/main/docs/tutorials/clay-v1-wall-to-wall.ipynb) |
1816

1917
## Installation
2018

@@ -63,23 +61,37 @@ To check out the different options available, and look at the hyperparameter
6361
configurations, run:
6462

6563
python trainer.py --help
66-
python trainer.py test --print_config
6764

6865
To quickly test the model on one batch in the validation set:
6966

70-
python trainer.py validate --trainer.fast_dev_run=True
71-
72-
To train the model for a hundred epochs:
73-
74-
python trainer.py fit --trainer.max_epochs=100
67+
python trainer.py fit --model ClayMAEModule --data ClayDataModule --config configs/config.yaml --trainer.fast_dev_run=True
7568

76-
To generate embeddings from the pretrained model's encoder on 1024 images
77-
(stored as a GeoParquet file with spatiotemporal metadata):
69+
To train the model:
7870

79-
python trainer.py predict --ckpt_path=checkpoints/last.ckpt \
80-
--data.batch_size=1024 \
81-
--data.data_dir=s3://clay-tiles-02 \
82-
--trainer.limit_predict_batches=1
71+
python trainer.py fit --model ClayMAEModule --data ClayDataModule --config configs/config.yaml
8372

8473
More options can be found using `python trainer.py fit --help`, or at the
8574
[LightningCLI docs](https://lightning.ai/docs/pytorch/2.1.0/cli/lightning_cli.html).
75+
76+
## Contributing
77+
78+
### Writing documentation
79+
80+
Our Documentation uses [Jupyter Book](https://jupyterbook.org/intro.html).
81+
82+
Install it with:
83+
```bash
84+
pip install -U jupyter-book
85+
```
86+
87+
Then build it with:
88+
```bash
89+
jupyter-book build docs/
90+
```
91+
92+
You can preview the site locally with:
93+
```bash
94+
python -m http.server --directory _build/html
95+
```
96+
97+
There is a GitHub Action on `./github/workflows/deploy-docs.yml` that builds the site and pushes it to GitHub Pages.

classify.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Command line interface to run the neural network model!
3+
4+
From the project root directory, do:
5+
6+
python classify.py fit --config configs/classify_eurosat.yaml
7+
8+
References:
9+
- https://lightning.ai/docs/pytorch/2.1.0/cli/lightning_cli.html
10+
- https://pytorch-lightning.medium.com/introducing-lightningcli-v2-supercharge-your-training-c070d43c7dd6
11+
"""
12+
13+
from lightning.pytorch.cli import LightningCLI
14+
15+
from finetune.classify.eurosat_datamodule import EuroSATDataModule # noqa: F401
16+
from finetune.classify.eurosat_model import EuroSATClassifier # noqa: F401
17+
18+
19+
# %%
20+
def cli_main():
21+
"""
22+
Command-line inteface to run ClayMAE with ClayDataModule.
23+
"""
24+
cli = LightningCLI(EuroSATClassifier, EuroSATDataModule)
25+
return cli
26+
27+
28+
# %%
29+
if __name__ == "__main__":
30+
cli_main()
31+
32+
print("Done!")

clayground.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)