Fix label att parametrization #74
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates the handling of label attention configuration and tokenizer saving in the
torchTextClassifierscodebase. The main changes simplify and clarify how label attention is configured and instantiated, and ensure compatibility with the tokenizer saving method.Label Attention Configuration Updates:
ModelConfigclass now usesn_heads_label_attention(an integer) instead of the previouslabel_attention_configobject, and makesnum_classesa required field. This simplifies configuration and ensures that the number of classes is always specified.n_heads_label_attentionis set, rather than checking for a full config object.TextEmbedderConfig, a newLabelAttentionConfigis created on the fly usingn_heads_label_attentionandnum_classesfrom the model config, instead of passing through a possibly pre-existing config object.label_attention_configfrom a dictionary, since label attention is now configured vian_heads_label_attention.Tokenizer Saving:
save_pretrainedmethod instead ofsave, ensuring compatibility with Hugging Face-style tokenizers.