DAPrompt
DAPrompt copied to clipboard
The loss for contrastive learning over domains
Thanks for your very interesting research.
I have some questions about the code of L402 in trainers/dapl.py
https://github.com/LeapLabTHU/DAPrompt/blob/f24b0c16c06b585104ba97615f89cd5df4def872/trainers/dapl.py#L402
The original paper states that contrastive learning helps transfer learning. But, to my understanding, in the above code, this operation does not perform contrastive learning over multi-domain and it seems to simply perform contrastive learning over single-domain.
To perform contrastive learning over multi-domain, I think I need to change the code in the following, right?
loss_x = F.cross_entropy(output_x[:, :-self.n_cls], label)