Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Added shared embedding option to director model. #4763

Merged
merged 2 commits into from Sep 12, 2022
Merged

Conversation

leox1v
Copy link
Contributor

@leox1v leox1v commented Aug 22, 2022

Added an option (with flag --director-use-shared-embedding) to share the generation and classification heads of the director. Only two additional parameters are introduced to scale the logits before applying the sigmoid (for the classification).

super().__init__(opt, dictionary, **kwargs)

vocabulary_size = len(dictionary)

decoder_output_dim = self.decoder.out_dim
self.classifier_heads = nn.Linear(decoder_output_dim, vocabulary_size)
self.use_shared_embedding = use_shared_embedding
Copy link
Contributor

Choose a reason for hiding this comment

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

if use_shared_embedding is passing from opt, then you can make sure of that `self.use_shared_embedding = opt.get('use_shared_embedding', False)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment. I changed it.

@leox1v leox1v merged commit 885eb21 into main Sep 12, 2022
@leox1v leox1v deleted the shared_head_director branch September 12, 2022 18:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants