rslearn 0.0.16__py3-none-any.whl → 0.0.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rslearn/config/dataset.py +6 -0
- rslearn/lightning_cli.py +10 -3
- rslearn/models/olmoearth_pretrain/model.py +2 -5
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/METADATA +58 -25
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/RECORD +10 -10
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/WHEEL +0 -0
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/entry_points.txt +0 -0
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/licenses/LICENSE +0 -0
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/licenses/NOTICE +0 -0
- {rslearn-0.0.16.dist-info → rslearn-0.0.17.dist-info}/top_level.txt +0 -0
rslearn/config/dataset.py
CHANGED
|
@@ -244,6 +244,9 @@ class BandSetConfig(BaseModel):
|
|
|
244
244
|
"use `{'class_path': '...', 'init_args': {...}}` instead.",
|
|
245
245
|
DeprecationWarning,
|
|
246
246
|
)
|
|
247
|
+
logger.warning(
|
|
248
|
+
"BandSet.format uses legacy format; support will be removed after 2026-03-01."
|
|
249
|
+
)
|
|
247
250
|
|
|
248
251
|
legacy_name_to_class_path = {
|
|
249
252
|
"image_tile": "rslearn.utils.raster_format.ImageTileRasterFormat",
|
|
@@ -409,6 +412,9 @@ class DataSourceConfig(BaseModel):
|
|
|
409
412
|
"use `{'class_path': '...', 'init_args': {...}, ...}` instead.",
|
|
410
413
|
DeprecationWarning,
|
|
411
414
|
)
|
|
415
|
+
logger.warning(
|
|
416
|
+
"Data source configuration uses legacy format; support will be removed after 2026-03-01."
|
|
417
|
+
)
|
|
412
418
|
|
|
413
419
|
# Split the dict into the base config that is in the pydantic model, and the
|
|
414
420
|
# source-specific options that should be moved to init_args dict.
|
rslearn/lightning_cli.py
CHANGED
|
@@ -215,7 +215,11 @@ class RslearnLightningCLI(LightningCLI):
|
|
|
215
215
|
# actually know which one is the best.
|
|
216
216
|
best_checkpoint = None
|
|
217
217
|
best_epochs = None
|
|
218
|
-
|
|
218
|
+
|
|
219
|
+
# Avoid error in case project_dir doesn't exist.
|
|
220
|
+
fnames = project_dir.iterdir() if project_dir.exists() else []
|
|
221
|
+
|
|
222
|
+
for option in fnames:
|
|
219
223
|
if not option.name.endswith(".ckpt"):
|
|
220
224
|
continue
|
|
221
225
|
|
|
@@ -325,8 +329,11 @@ class RslearnLightningCLI(LightningCLI):
|
|
|
325
329
|
}
|
|
326
330
|
)
|
|
327
331
|
c.trainer.callbacks.append(upload_wandb_callback)
|
|
328
|
-
|
|
329
|
-
|
|
332
|
+
elif c.trainer.logger:
|
|
333
|
+
logger.warning(
|
|
334
|
+
"Model management is enabled and logging should be off, but the model config specifies a logger. "
|
|
335
|
+
+ "The logger should be removed from the model config, since it will not be automatically disabled."
|
|
336
|
+
)
|
|
330
337
|
|
|
331
338
|
if subcommand == "fit":
|
|
332
339
|
# Set the checkpoint directory to match the project directory.
|
|
@@ -153,11 +153,8 @@ class OlmoEarth(torch.nn.Module):
|
|
|
153
153
|
# Load the checkpoint.
|
|
154
154
|
if not random_initialization:
|
|
155
155
|
train_module_dir = checkpoint_upath / "model_and_optim"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
logger.info(f"loaded OlmoEarth encoder from {train_module_dir}")
|
|
159
|
-
else:
|
|
160
|
-
logger.info(f"could not find OlmoEarth encoder at {train_module_dir}")
|
|
156
|
+
load_model_and_optim_state(str(train_module_dir), model)
|
|
157
|
+
logger.info(f"loaded OlmoEarth encoder from {train_module_dir}")
|
|
161
158
|
|
|
162
159
|
return model
|
|
163
160
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rslearn
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.17
|
|
4
4
|
Summary: A library for developing remote sensing datasets and models
|
|
5
5
|
Author: OlmoEarth Team
|
|
6
6
|
License: Apache License
|
|
@@ -343,10 +343,12 @@ directory `/path/to/dataset` and corresponding configuration file at
|
|
|
343
343
|
"bands": ["R", "G", "B"]
|
|
344
344
|
}],
|
|
345
345
|
"data_source": {
|
|
346
|
-
"
|
|
347
|
-
"
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
"class_path": "rslearn.data_sources.gcp_public_data.Sentinel2",
|
|
347
|
+
"init_args": {
|
|
348
|
+
"index_cache_dir": "cache/sentinel2/",
|
|
349
|
+
"sort_by": "cloud_cover",
|
|
350
|
+
"use_rtree_index": false
|
|
351
|
+
}
|
|
350
352
|
}
|
|
351
353
|
}
|
|
352
354
|
}
|
|
@@ -453,8 +455,10 @@ automate this process. Update the dataset `config.json` with a new layer:
|
|
|
453
455
|
}],
|
|
454
456
|
"resampling_method": "nearest",
|
|
455
457
|
"data_source": {
|
|
456
|
-
"
|
|
457
|
-
"
|
|
458
|
+
"class_path": "rslearn.data_sources.local_files.LocalFiles",
|
|
459
|
+
"init_args": {
|
|
460
|
+
"src_dir": "file:///path/to/world_cover_tifs/"
|
|
461
|
+
}
|
|
458
462
|
}
|
|
459
463
|
}
|
|
460
464
|
},
|
|
@@ -516,8 +520,7 @@ model:
|
|
|
516
520
|
data:
|
|
517
521
|
class_path: rslearn.train.data_module.RslearnDataModule
|
|
518
522
|
init_args:
|
|
519
|
-
|
|
520
|
-
path: /path/to/dataset/
|
|
523
|
+
path: ${DATASET_PATH}
|
|
521
524
|
# This defines the layers that should be read for each window.
|
|
522
525
|
# The key ("image" / "targets") is what the data will be called in the model,
|
|
523
526
|
# while the layers option specifies which layers will be read.
|
|
@@ -615,7 +618,9 @@ trainer:
|
|
|
615
618
|
...
|
|
616
619
|
- class_path: rslearn.train.prediction_writer.RslearnWriter
|
|
617
620
|
init_args:
|
|
618
|
-
|
|
621
|
+
# We need to include this argument, but it will be overridden with the dataset
|
|
622
|
+
# path from data.init_args.path.
|
|
623
|
+
path: placeholder
|
|
619
624
|
output_layer: output
|
|
620
625
|
```
|
|
621
626
|
|
|
@@ -768,24 +773,43 @@ This will produce PNGs in the vis directory. The visualizations are produced by
|
|
|
768
773
|
SegmentationTask and overriding the visualize function.
|
|
769
774
|
|
|
770
775
|
|
|
771
|
-
###
|
|
776
|
+
### Checkpoint and Logging Management
|
|
777
|
+
|
|
778
|
+
Above, we needed to configure the checkpoint directory in the model config (the
|
|
779
|
+
`dirpath` option under `lightning.pytorch.callbacks.ModelCheckpoint`), and explicitly
|
|
780
|
+
specify the checkpoint path when applying the model. Additionally, metrics are logged
|
|
781
|
+
to the local filesystem and not well organized.
|
|
772
782
|
|
|
773
|
-
We can
|
|
783
|
+
We can instead let rslearn automatically manage checkpoints, along with logging to
|
|
784
|
+
Weights & Biases. To do so, we add project_name, run_name, and management_dir options
|
|
785
|
+
to the model config. The project_name corresponds to the W&B project, and the run name
|
|
786
|
+
corresponds to the W&B name. The management_dir is a directory to store project data;
|
|
787
|
+
rslearn determines a per-project directory at `{management_dir}/{project_name}/{run_name}/`
|
|
788
|
+
and uses it to store checkpoints.
|
|
774
789
|
|
|
775
790
|
```yaml
|
|
791
|
+
model:
|
|
792
|
+
# ...
|
|
793
|
+
data:
|
|
794
|
+
# ...
|
|
776
795
|
trainer:
|
|
777
796
|
# ...
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
name: version_00
|
|
797
|
+
project_name: land_cover_model
|
|
798
|
+
run_name: version_00
|
|
799
|
+
# This sets the option via the MANAGEMENT_DIR environment variable.
|
|
800
|
+
management_dir: ${MANAGEMENT_DIR}
|
|
783
801
|
```
|
|
784
802
|
|
|
785
|
-
Now,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
803
|
+
Now, set the `MANAGEMENT_DIR` environment variable and run `model fit`:
|
|
804
|
+
|
|
805
|
+
```
|
|
806
|
+
export MANAGEMENT_DIR=./project_data
|
|
807
|
+
rslearn model fit --config land_cover_model.yaml
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
The training and validation loss and accuracy metric should now be logged to W&B. The
|
|
811
|
+
accuracy metric is provided by SegmentationTask, and additional metrics can be enabled
|
|
812
|
+
by passing the relevant init_args to the task, e.g. mean IoU and F1:
|
|
789
813
|
|
|
790
814
|
```yaml
|
|
791
815
|
class_path: rslearn.train.tasks.segmentation.SegmentationTask
|
|
@@ -796,6 +820,13 @@ passing the relevant init_args to the task, e.g. mean IoU and F1:
|
|
|
796
820
|
enable_f1_metric: true
|
|
797
821
|
```
|
|
798
822
|
|
|
823
|
+
When calling `model test` and `model predict` with management_dir set, rslearn will
|
|
824
|
+
automatically load the best checkpoint from the project directory, or raise an error if
|
|
825
|
+
no existing checkpoint exists. This behavior can be overridden with the
|
|
826
|
+
`--load_checkpoint_mode` and `--load_checkpoint_required` options (see `--help` for
|
|
827
|
+
details). Logging will be enabled during fit but not test/predict, and this can also
|
|
828
|
+
be overridden, using `--log_mode`.
|
|
829
|
+
|
|
799
830
|
|
|
800
831
|
### Inputting Multiple Sentinel-2 Images
|
|
801
832
|
|
|
@@ -818,10 +849,12 @@ query_config section. This can replace the sentinel2 layer:
|
|
|
818
849
|
"bands": ["R", "G", "B"]
|
|
819
850
|
}],
|
|
820
851
|
"data_source": {
|
|
821
|
-
"
|
|
822
|
-
"
|
|
823
|
-
|
|
824
|
-
|
|
852
|
+
"class_path": "rslearn.data_sources.gcp_public_data.Sentinel2",
|
|
853
|
+
"init_args": {
|
|
854
|
+
"index_cache_dir": "cache/sentinel2/",
|
|
855
|
+
"sort_by": "cloud_cover",
|
|
856
|
+
"use_rtree_index": false
|
|
857
|
+
},
|
|
825
858
|
"query_config": {
|
|
826
859
|
"max_matches": 3
|
|
827
860
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
rslearn/__init__.py,sha256=fFmAen3vxZyosEfPbG0W46IttujYGVxzrGkJ0YutmmY,73
|
|
2
2
|
rslearn/arg_parser.py,sha256=GNlJncO6Ck_dCNrcg7z_SSG61I-2gKn3Ix2tAxIk9CI,1428
|
|
3
3
|
rslearn/const.py,sha256=FUCfsvFAs-QarEDJ0grdy0C1HjUjLpNFYGo5I2Vpc5Y,449
|
|
4
|
-
rslearn/lightning_cli.py,sha256=
|
|
4
|
+
rslearn/lightning_cli.py,sha256=Cihdf3dOQ17b_n4432Y6LmCQ5XFDghW4rGb4fqw-b6g,17525
|
|
5
5
|
rslearn/log_utils.py,sha256=unD9gShiuO7cx5Nnq8qqVQ4qrbOOwFVgcHxN5bXuiAo,941
|
|
6
6
|
rslearn/main.py,sha256=0g1SRO975eC9DTzKqJnwlWHgVo2Pvotyr72KoJBgjew,29060
|
|
7
7
|
rslearn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
rslearn/template_params.py,sha256=Vop0Ha-S44ctCa9lvSZRjrMETznJZlR5y_gJrVIwrPg,791
|
|
9
9
|
rslearn/config/__init__.py,sha256=a8xTvYSnpfIzniHgcnSeob5jo5PVBfacpakA_150MME,434
|
|
10
|
-
rslearn/config/dataset.py,sha256=
|
|
10
|
+
rslearn/config/dataset.py,sha256=3YLNST5cDz1CV3dnsZs4DM8sAdisfJ2c891Hxwz-lJE,21404
|
|
11
11
|
rslearn/data_sources/__init__.py,sha256=zzuZUxrlEIw84YpD2I0HJvCoLDB29LbmnKTXiJykzGU,660
|
|
12
12
|
rslearn/data_sources/aws_landsat.py,sha256=0ZQtmd2NCnvLy4vFSB1AlmoguJbiQB_e_T4eS1tnW9Q,20443
|
|
13
13
|
rslearn/data_sources/aws_open_data.py,sha256=lrHnMJTH3NAaRdNjxwCIxSq8rq90IvV4ho-qAG6Hdgc,29348
|
|
@@ -86,7 +86,7 @@ rslearn/models/galileo/__init__.py,sha256=QQa0C29nuPRva0KtGiMHQ2ZB02n9SSwj_wqTKP
|
|
|
86
86
|
rslearn/models/galileo/galileo.py,sha256=jUHA64YvVC3Fz5fevc_9dFJfZaINODRDrhSGLIiOZcw,21115
|
|
87
87
|
rslearn/models/galileo/single_file_galileo.py,sha256=l5tlmmdr2eieHNH-M7rVIvcptkv0Fuk3vKXFW691ezA,56143
|
|
88
88
|
rslearn/models/olmoearth_pretrain/__init__.py,sha256=AjRvbjBdadCdPh-EdvySH76sVAQ8NGQaJt11Tsn1D5I,36
|
|
89
|
-
rslearn/models/olmoearth_pretrain/model.py,sha256=
|
|
89
|
+
rslearn/models/olmoearth_pretrain/model.py,sha256=F-Y3y1trL0W6qlM81Xhj3Avh23ommvDlE1XWtDIeJDE,10515
|
|
90
90
|
rslearn/models/olmoearth_pretrain/norm.py,sha256=rHjFyWkpNLYMx9Ow7TsU-jGm9Sjx7FVf0p4R__ohx2c,3266
|
|
91
91
|
rslearn/models/panopticon_data/sensors/drone.yaml,sha256=xqWS-_QMtJyRoWXJm-igoSur9hAmCFdqkPin8DT5qpw,431
|
|
92
92
|
rslearn/models/panopticon_data/sensors/enmap.yaml,sha256=b2j6bSgYR2yKR9DRm3SPIzSVYlHf51ny_p-1B4B9sB4,13431
|
|
@@ -153,10 +153,10 @@ rslearn/utils/spatial_index.py,sha256=eomJAUgzmjir8j9HZnSgQoJHwN9H0wGTjmJkMkLLfs
|
|
|
153
153
|
rslearn/utils/sqlite_index.py,sha256=YGOJi66544e6JNtfSft6YIlHklFdSJO2duxQ4TJ2iu4,2920
|
|
154
154
|
rslearn/utils/time.py,sha256=2ilSLG94_sxLP3y5RSV5L5CG8CoND_dbdzYEHVtN-I8,387
|
|
155
155
|
rslearn/utils/vector_format.py,sha256=4ZDYpfBLLxguJkiIaavTagiQK2Sv4Rz9NumbHlq-3Lw,15041
|
|
156
|
-
rslearn-0.0.
|
|
157
|
-
rslearn-0.0.
|
|
158
|
-
rslearn-0.0.
|
|
159
|
-
rslearn-0.0.
|
|
160
|
-
rslearn-0.0.
|
|
161
|
-
rslearn-0.0.
|
|
162
|
-
rslearn-0.0.
|
|
156
|
+
rslearn-0.0.17.dist-info/licenses/LICENSE,sha256=_99ZWPoLdlUbqZoSC5DF4ihiNwl5rTEmBaq2fACecdg,11352
|
|
157
|
+
rslearn-0.0.17.dist-info/licenses/NOTICE,sha256=wLPr6rwV_jCg-xEknNGwhnkfRfuoOE9MZ-lru2yZyLI,5070
|
|
158
|
+
rslearn-0.0.17.dist-info/METADATA,sha256=dBncVtE7Sr-dA8OVrODDbV16SSg7GkSs0kDuhHO7drI,37853
|
|
159
|
+
rslearn-0.0.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
160
|
+
rslearn-0.0.17.dist-info/entry_points.txt,sha256=doTBQ57NT7nq-dgYGgTTw6mafcGWb_4PWYtYR4rGm50,46
|
|
161
|
+
rslearn-0.0.17.dist-info/top_level.txt,sha256=XDKo90WBH8P9RQumHxo0giLJsoufT4r9odv-WE6Ahk4,8
|
|
162
|
+
rslearn-0.0.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|