Skip to content

Conversation

@aditya0by0
Copy link
Member

✅ Summary of the Issue

When using LightningCLI, we pass --model.input_dim and --model.out_dim implicitly via parser.link_arguments() (e.g. linking from data.feature_vector_size and data.num_of_labels).

However, these values appear as null in the generated model_checkpoint.ckpt file, even though they are correctly assigned at runtime.

🔍 Root Cause

This is due to the fact that:

LightningCLI saves the hparams file before linked arguments are computed and applied.

As a result, any parameters set via parser.link_arguments(...) (such as input_dim, out_dim, etc.) are not yet populated when the configuration is saved — leading to them showing up as null in hparams.

✅ What This PR Does

  • Explicitly adds input_dim and out_dim to self.hparams to ensure they are captured at runtime, even if linked.

@sfluegel05
Copy link
Collaborator

After merging the dev branch (which passes the unittests) into this branch (which also passes the unittests), the tests suddenly fail with the same error as in #99

@sfluegel05 sfluegel05 merged commit 258e65a into dev Jul 14, 2025
6 checks passed
@aditya0by0 aditya0by0 deleted the fix/save_out_dim_to_checkpoint branch July 14, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants