Skip to content

Dynamically Setting out_dim Based on LightningDataModule in LightningCLI #20602

Discussion options

You must be logged in to vote

You have two options:

  1. [preferred] In the data module, change the setup method so that if it is called multiple time, only the first run does the required logic. Then change the num_of_labels property so that it calls setup before accessing the _num_of_labels attribute.
  2. Create a link applied on instantiation with source the entire data instance (instead of an attribute of it) and a compute_fn that first runs setup and then accesses the num_of_labels property.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aditya0by0
Comment options

Answer selected by aditya0by0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment