Skip to content
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

Integrate softmax cpr to the latest RecBole version #1912

Merged
merged 3 commits into from
Nov 25, 2023

Conversation

ken77921
Copy link


all_memory_W = self.dropout(self.We(all_memory))
all_memory_W = all_memory_U.unsqueeze(1)
all_memory_W = all_memory_U.expand(bsz, all_memory.size(1), seq_len, hsz)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all_memory_U here should be replaced by all_memory_W

bsz, seq_len_2 = item_seq.size()
logit_hidden_context = (projected_emb_arr[self.n_facet + self.n_facet_reranker*len(self.reranker_CAN_NUM) + i].unsqueeze(dim=2).expand(-1,-1,seq_len_2,-1) * test_item_emb[item_seq, :].unsqueeze(dim=1).expand(-1,seq_len_1,-1,-1) ).sum(dim=-1)
if test_item_bias is not None:
logit_hidden_reranker_topn += test_item_bias[item_seq].unsqueeze(dim=1).expand(-1,seq_len_1,-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logit_hidden_reranker_topn here should be logit_hidden_context

@BishopLiu
Copy link
Collaborator

@ken77921 Nice job! I've pointed out some minor mistakes in the code. Besides, you can add your personal information in the header of the model files. And it would be highly appreciated if you can complete the comments of the new parameters in the two yaml files so that the users can understand their meaning quickly. Last but not least, the test functions for these two models need to be added to the file tests/model/test_model_auto.py.

@ken77921
Copy link
Author

@BishopLiu Thanks for the corrections. I am not very sure how to test tests/model/test_model_auto.py. Please let me know if I did something wrong in that file.

@BishopLiu
Copy link
Collaborator

@ken77921 Thank you for your great contribution! I'll merge it.

@BishopLiu BishopLiu merged commit 144a480 into RUCAIBox:master Nov 25, 2023
1 of 2 checks passed
@ken77921
Copy link
Author

Thank you for merging the pull request. I have a question. Will the descriptions of GRU4RecCPR and SASRecCPR be added to the documentation (https://recbole.io/docs/user_guide/model_intro.html)?

@BishopLiu
Copy link
Collaborator

Yes, we will add it during the next version update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants