Repository for "Dolores: Deep Contextualized Knowledge Graph Embeddings" (AKBC 2020)
Steps for using contextualized KG embeddings
- Convert entities and relations to ids, e.g.
/m/09v3jyg /m/0f8l9c /film/film/release_date_s./film/film_regional_release_date/film_release_region
is converted to 0, 1, 0
, like what is done in OpenKE - Use node2vec to generate paths:
i) Input: edgelist, e.g. see train2id.edgelist
ii) Edit line 99 in node2vec/src/main.py to get random walks (paths).
iii) Hyperparameter includes: p, q, num_walks, walk_length - Pretrain ELMo-based model M
i) Edit line 40 in ./bin/train_elmo.py to accept as input the file that contains the generated training paths
ii) Hyperparameter includes: layer_num, dimension, etc. - Save the model M's parameters
- Combine the model with your downstream task model, fine-tune M's parameters, get the contextual representation, and make final predictions
i) Refer to ./bin/run_test.py
ii) Hyperparameter includes: the weights for ELMo representations from each layer