How to share the same embeddings across the multiple variables

Hi there,

How would one go about allowing multiple variables to share the same embeddings?

For example, if I were to try and predict the outcome of a car race with 6 cars, I could have “Car Brand 1”, “Car Brand 2”, “Car Brand 3”, …, as my variables, but it would make more sense that each of these variables share the same embedding matrix.

Is there a straightforward way to allow multiple columns to share the same embedding matrix (through pytorch or fastai)?

Thank you very much

2 Likes