mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #47] attention on the text #45
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @haofanwang on GitHub (Feb 21, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/47
Given a sentence, is it possible to know which words receive more attention? In practice, I found that CLIP focused on several keywords in the sentence.
@jongwook commented on GitHub (Feb 21, 2021):
See #18
@haofanwang commented on GitHub (Feb 21, 2021):
Hi, @jongwook, I modified the code based on the suggestion, so I got the weight from the multihead-attention layer. But it is a tensor with shape (batch_size, target sequence length, source sequence length) = (1, 77, 77). How do I visualize this matrix to show the importance of each word?
@haofanwang commented on GitHub (Feb 21, 2021):
solved.
@jongwook commented on GitHub (Feb 21, 2021):
Glad to know that it sorted out! I haven't actually tried visualizing the attention map, and it's very intriguing to see. Thanks for making a notebook for this :D