Contrastive learning is a good way to learn representations. It is similar to the way self-supervised learning is used to learn representations, but uses positive and negative examples.