You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.
There are metrics that rely on the datamodule. For example, text classification requires the model knowing the number of classes which is tied to the dataset.
After discussion with @carmocca we've agreed on proposal 2. From Carlos:
classLitAutoModelTextClassificationTransformer(LitAutoModelTransformer):
@propertydefnum_classes():
returnself.trainer.datamodule.num_classesdefself.configure_metrics():
self.metric1=metric(self.num_classes)
defon_fit_start(self):
self.configure_metrics()
classSomeoneElsesDataModule(LitTransformerDataModule):
@propertydefC():
# this user chose to set num_classes as C
...
# If necessary, one could create this "adapter" without rewriting configure_metricsclassAdaptedTransformer(LitAutoModelTextClassificationTransformer):
@propertydefnum_classes():
returnself.trainer.datamodule.C
Closed with #17. The above has been added but not in it's entirety. We still have data config args passed from the datamodule for autoconfig to load num_labels for example.
There are metrics that rely on the datamodule. For example, text classification requires the model knowing the number of classes which is tied to the dataset.
This is currently passed as below:
Where
data_module.data_model_kwargs
is:This isn't very easy to grok imo. The kwargs can be anything, making it hard to tell what is being passed to the module in the first place.
Potential solution 1
Pass the data module to the model (I don't think save_hyperparameter works in this instance though):
Potential solution 2
Initialize metrics when we know we can since the trainer now contains a reference to the dataset:
We could add this hook within the base class and expose initialize_metrics with the datamodule, for example.
The text was updated successfully, but these errors were encountered: