Skip to content

Commit 992b48c

Browse files
committed
call data methods from cli through compute_fn
1 parent f253446 commit 992b48c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

chebai/cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,19 @@ def add_arguments_to_parser(self, parser: LightningArgumentParser):
3939
parser (LightningArgumentParser): Argument parser instance.
4040
"""
4141

42+
def call_data_methods(data):
43+
if data._num_of_labels is None:
44+
data.prepare_data()
45+
data.setup()
46+
return data.num_of_labels
47+
4248
parser.link_arguments(
43-
"data.num_of_labels", "model.init_args.out_dim", apply_on="instantiate"
49+
"data",
50+
"model.init_args.out_dim",
51+
apply_on="instantiate",
52+
compute_fn=call_data_methods,
4453
)
54+
4555
parser.link_arguments(
4656
"data.feature_vector_size",
4757
"model.init_args.input_dim",

0 commit comments

Comments
 (0)