Skip to content

Commit

Permalink
Merge pull request #369 from ASUS-AICS/simplify_model
Browse files Browse the repository at this point in the history
Remove `embed_vecs` from Model and PLTModel
  • Loading branch information
Eleven1Liu authored May 1, 2024
2 parents f33a366 + 5e7148b commit f809f9d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 7 deletions.
3 changes: 0 additions & 3 deletions libmultilabel/nn/attentionxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ def fit(self, datasets):
model_1 = PLTModel(
classes=self.classes,
word_dict=self.word_dict,
embed_vecs=self.embed_vecs,
network=network,
log_path=self.log_path,
learning_rate=self.learning_rate,
Expand Down Expand Up @@ -521,7 +520,6 @@ def __init__(
self,
classes,
word_dict,
embed_vecs,
network,
loss_function="binary_cross_entropy_with_logits",
log_path=None,
Expand All @@ -530,7 +528,6 @@ def __init__(
super().__init__(
classes=classes,
word_dict=word_dict,
embed_vecs=embed_vecs,
network=network,
loss_function=loss_function,
log_path=log_path,
Expand Down
3 changes: 0 additions & 3 deletions libmultilabel/nn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class Model(MultiLabelModel):
Args:
classes (list): List of class names.
word_dict (torchtext.vocab.Vocab): A vocab object which maps tokens to indices.
embed_vecs (torch.Tensor): The pre-trained word vectors of shape (vocab_size, embed_dim).
network (nn.Module): Network (i.e., CAML, KimCNN, or XMLCNN).
loss_function (str, optional): Loss function name (i.e., binary_cross_entropy_with_logits,
cross_entropy). Defaults to 'binary_cross_entropy_with_logits'.
Expand All @@ -193,7 +192,6 @@ def __init__(
self,
classes,
word_dict,
embed_vecs,
network,
loss_function="binary_cross_entropy_with_logits",
log_path=None,
Expand All @@ -204,7 +202,6 @@ def __init__(
ignore=["log_path"]
) # If log_path is saved, loading the checkpoint will cause an error since each experiment has unique log_path (result_dir).
self.word_dict = word_dict
self.embed_vecs = embed_vecs
self.classes = classes
self.network = network
self.configure_loss_function(loss_function)
Expand Down
1 change: 0 additions & 1 deletion libmultilabel/nn/nn_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def init_model(
model = Model(
classes=classes,
word_dict=word_dict,
embed_vecs=embed_vecs,
network=network,
log_path=log_path,
learning_rate=learning_rate,
Expand Down

0 comments on commit f809f9d

Please sign in to comment.