New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialize multi_label_threshold for classification models #2368
Conversation
@@ -145,6 +146,7 @@ def _init_model_with_state_dict(state): | |||
label_dictionary=state["label_dictionary"], | |||
label_type=state["label_type"], | |||
multi_label=state["multi_label"], | |||
multi_label_threshold=0.5 if "multi_label_threshold" not in state.keys() else state["multi_label_threshold"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of default 0.5
the defaults can be read from the class:
super_defaults = inspect.signature(super(TextPairClassifier, self).__init__)
multi_label_threshold_default = super_defaults.parameters['multi_label_threshold'].default
and then use multi_label_threshold_default
instead of 0.5
.
@@ -101,6 +102,7 @@ def _init_model_with_state_dict(state): | |||
label_dictionary=state["label_dictionary"], | |||
label_type=label_type, | |||
multi_label=state["multi_label"], | |||
multi_label_threshold=0.5 if "multi_label_threshold" not in state.keys() else state["multi_label_threshold"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of default 0.5
the defaults can be read from the class:
super_defaults = inspect.signature(super(TextClassifier, self).__init__)
multi_label_threshold_default = super_defaults.parameters['multi_label_threshold'].default
and then use multi_label_threshold_default
instead of 0.5
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool didn't know about this!
@yosipk thanks for adding this! |
Closes #2367