Cannot do an inference

#1
by cappelaere - opened

python inference.py --data_file examples/India_900498_S2Hand.tif

/opt/anaconda3/lib/python3.12/site-packages/lightning/pytorch/cli.py:530: LightningCLI's args parameter is intended to run from within Python like if it were from the command line. To prevent mistakes it is not recommended to provide both args and command line arguments, got: sys.argv[1:]=['--data_file', 'examples/India_900498_S2Hand.tif'], args=['--config', 'config.yaml'].
usage: inference.py [-h] [-c CONFIG] [--print_config[=flags]] [--seed_everything SEED_EVERYTHING] [--trainer CONFIG]
[--trainer.accelerator.help CLASS_PATH_OR_NAME] [--trainer.accelerator ACCELERATOR]
[--trainer.strategy.help CLASS_PATH_OR_NAME] [--trainer.strategy STRATEGY] [--trainer.devices DEVICES]
[--trainer.num_nodes NUM_NODES] [--trainer.precision PRECISION] [--trainer.logger.help CLASS_PATH_OR_NAME]
[--trainer.logger LOGGER] [--trainer.callbacks.help CLASS_PATH_OR_NAME] [--trainer.callbacks CALLBACKS]
[--trainer.fast_dev_run FAST_DEV_RUN] [--trainer.max_epochs MAX_EPOCHS] [--trainer.min_epochs MIN_EPOCHS]
[--trainer.max_steps MAX_STEPS] [--trainer.min_steps MIN_STEPS] [--trainer.max_time MAX_TIME]
[--trainer.limit_train_batches LIMIT_TRAIN_BATCHES] [--trainer.limit_val_batches LIMIT_VAL_BATCHES]
[--trainer.limit_test_batches LIMIT_TEST_BATCHES] [--trainer.limit_predict_batches LIMIT_PREDICT_BATCHES]
[--trainer.overfit_batches OVERFIT_BATCHES] [--trainer.val_check_interval VAL_CHECK_INTERVAL]
[--trainer.check_val_every_n_epoch CHECK_VAL_EVERY_N_EPOCH] [--trainer.num_sanity_val_steps NUM_SANITY_VAL_STEPS]
[--trainer.log_every_n_steps LOG_EVERY_N_STEPS] [--trainer.enable_checkpointing {true,false,null}]
[--trainer.enable_progress_bar {true,false,null}] [--trainer.enable_model_summary {true,false,null}]
[--trainer.accumulate_grad_batches ACCUMULATE_GRAD_BATCHES] [--trainer.gradient_clip_val GRADIENT_CLIP_VAL]
[--trainer.gradient_clip_algorithm GRADIENT_CLIP_ALGORITHM] [--trainer.deterministic DETERMINISTIC]
[--trainer.benchmark {true,false,null}] [--trainer.inference_mode {true,false}]
[--trainer.use_distributed_sampler {true,false}] [--trainer.profiler.help CLASS_PATH_OR_NAME] [--trainer.profiler PROFILER]
[--trainer.detect_anomaly {true,false}] [--trainer.barebones {true,false}] [--trainer.plugins.help CLASS_PATH_OR_NAME]
[--trainer.plugins PLUGINS] [--trainer.sync_batchnorm {true,false}]
[--trainer.reload_dataloaders_every_n_epochs RELOAD_DATALOADERS_EVERY_N_EPOCHS]
[--trainer.default_root_dir DEFAULT_ROOT_DIR] [--trainer.model_registry MODEL_REGISTRY] [--model.help [CLASS_PATH_OR_NAME]]
--model CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE [--data.help [CLASS_PATH_OR_NAME]]
[--data CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE] [--predict_output_dir PREDICT_OUTPUT_DIR]
[--out_dtype OUT_DTYPE] [--deploy_config_file {true,false}] [--custom_modules_path CUSTOM_MODULES_PATH]
[--optimizer.help [CLASS_PATH_OR_NAME]] [--optimizer CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE]
[--lr_scheduler.help CLASS_PATH_OR_NAME] [--lr_scheduler CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE]
error: Validation failed: Key 'ModelCheckpoint.filename' is not expected

Thanks,
Pat.

Hello, I am running into the same issue when trying to run inference.

I cannot find where the Key ModelCheckpoint.filename would be definded.
torch==2.6.0
torchvision==0.21.0
terratorch==1.0.1
(Anaconda3 / Windows)

IBM-NASA Prithvi Models Family org

@cappelaere @msieder Thanks for raising this issue and sorry for the late reply. Some configs keywords changed with TerraTorch 1.0, I removed them from the this repo because they are not relevant anyway. The inference should work again now. Let me know if you have any other issues!

blumenstiel changed discussion status to closed

Hi Benedict, could you guys give us a little more information on the 3 datasets you are using for the demo? Like original image name and date to duplicate the results at scale? This would be great. Thanks. Pat.

IBM-NASA Prithvi Models Family org

Which datasets are you refering to? For this model, we only trained on Sen1Floods11. I created some example notebooks and configs here (including Sen1Floods11) that may help to reporduce this work: https://github.com/blumenstiel/TerraTorch-Examples
Note that Lightning is not deterministic, so you might get some different results within ~1%.

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment