Closed kroegern1 closed 8 months ago
Hi @kroegern1,
This mask
from line 30 is a tensor. For batch_size
4 it looks like this:
[0., 0., 0., 0., 0., 1., 0., 0.],
[0., 0., 0., 0., 0., 0., 1., 0.],
[0., 0., 0., 0., 0., 0., 0., 1.],
[1., 0., 0., 0., 0., 0., 0., 0.],
[0., 1., 0., 0., 0., 0., 0., 0.],
[0., 0., 1., 0., 0., 0., 0., 0.],
[0., 0., 0., 1., 0., 0., 0., 0.]]
It is used to distinguish the indexes of positive and negative pairs, when calculating the hierarchical clustering loss in lines 41, 43
https://github.com/MichalZnalezniak/Contrastive-Hierarchical-Clustering/blob/main/tree_losses.py#L24C1-L43C198
mask_for_level
from line 36 is a dict and it is used for pruning, We described the pruning strategy in section 3.5 in our paper https://arxiv.org/pdf/2303.03389.pdf
Have you made any changes to the code? The error messages show that error happens in the line 36 labels = labels * ~mask_for_level
which looks really similar to line 31 labels = labels * ~mask
, but in line 36 on the main branch we have prob_features = prob_features * mask_for_level[level]
Wow great catch, thank you so much. It accidentally autocompleted when I hit tab at the end of the line: "labels = labels ~mask" which caused it to chang to "labels = labels ~mask_for_level" I'll run it again, thank you for getting back to me quickly!
Please let me know if the problem has been resolved. If it has, can we close the issue?
https://github.com/MichalZnalezniak/Contrastive-Hierarchical-Clustering/blob/2c418fcc763081e89073d83d648308d277b1fd10/tree_losses.py#L31C1-L31C28
Hello, I tried running the code but I get this error:
What is the purpose of this mask here? The mask is a dict, what is the intent?