From cc118ea5720d77ece8d2ca975e31998961ea0df4 Mon Sep 17 00:00:00 2001 From: Guillaume Becquin Date: Tue, 18 Oct 2022 12:54:52 +0100 Subject: [PATCH 1/3] updated dgl dependency --- python/dglke/dataloader/sampler.py | 4 ++-- python/dglke/models/ke_model.py | 2 +- python/dglke/partition.py | 2 +- python/dglke/tests/test_score.py | 2 +- python/dglke/tests/test_topk.py | 4 ++-- tests/scripts/task_kg_test.sh | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/dglke/dataloader/sampler.py b/python/dglke/dataloader/sampler.py index 38ff2034..2e46bfd3 100644 --- a/python/dglke/dataloader/sampler.py +++ b/python/dglke/dataloader/sampler.py @@ -335,7 +335,7 @@ def ConstructGraph(dataset, args): n_entities = dataset.n_entities coo = sp.sparse.coo_matrix((np.ones(len(src)), (src, dst)), shape=[n_entities, n_entities]) - g = dgl.DGLGraph(coo, readonly=True, multigraph=True, sort_csr=True) + g = dgl._deprecate.graph.DGLGraph(coo, readonly=True, multigraph=True, sort_csr=True) g.edata['tid'] = F.tensor(etype_id, F.int64) if args.has_edge_importance: e_impts = F.tensor(dataset.train[3], F.float32) @@ -418,7 +418,7 @@ def create_sampler(self, batch_size, neg_sample_size=2, neg_chunk_size=None, mod exclude_positive=exclude_positive, return_false_neg=False) -class ChunkNegEdgeSubgraph(dgl.DGLGraph): +class ChunkNegEdgeSubgraph(dgl._deprecate.graph.DGLGraph): """Wrapper for negative graph Parameters diff --git a/python/dglke/models/ke_model.py b/python/dglke/models/ke_model.py index f17f1040..f01000f8 100644 --- a/python/dglke/models/ke_model.py +++ b/python/dglke/models/ke_model.py @@ -84,7 +84,7 @@ def attach_graph(self, g, etid_field='tid', ntid_filed='ntid'): """ self._etid_field = etid_field self._ntid_filed = ntid_filed - assert isinstance(g, dgl.DGLGraph) + assert isinstance(g, dgl._deprecate.graph.DGLGraph) self._g = g def load(self, model_path): diff --git a/python/dglke/partition.py b/python/dglke/partition.py index 9743d83a..0ed15ed9 100644 --- a/python/dglke/partition.py +++ b/python/dglke/partition.py @@ -111,7 +111,7 @@ def main(): src, etype_id, dst = dataset.train coo = sp.sparse.coo_matrix((np.ones(len(src)), (src, dst)), shape=[dataset.n_entities, dataset.n_entities]) - g = dgl.DGLGraph(coo, readonly=True, multigraph=True, sort_csr=True) + g = dgl._deprecate.graph.DGLGraph(coo, readonly=True, multigraph=True, sort_csr=True) g.edata['tid'] = F.tensor(etype_id, F.int64) print('partition graph...') diff --git a/python/dglke/tests/test_score.py b/python/dglke/tests/test_score.py index 5915e365..1c16fe68 100644 --- a/python/dglke/tests/test_score.py +++ b/python/dglke/tests/test_score.py @@ -50,7 +50,7 @@ class dotdict(dict): def generate_rand_graph(n, func_name): arr = (sp.sparse.random(n, n, density=0.1, format='coo') != 0).astype(np.int64) - g = dgl.DGLGraph(arr, readonly=True) + g = dgl._deprecate.graph.DGLGraph(arr, readonly=True) num_rels = 10 entity_emb = F.uniform((g.number_of_nodes(), 10), F.float32, F.cpu(), 0, 1) if func_name == 'RotatE': diff --git a/python/dglke/tests/test_topk.py b/python/dglke/tests/test_topk.py index 945bfc3c..986612fc 100644 --- a/python/dglke/tests/test_topk.py +++ b/python/dglke/tests/test_topk.py @@ -562,7 +562,7 @@ def check_topk_score2(score_model, exclude_mode): th.full((num_entity*2,), 2, dtype=th.long), th.full((num_entity*2,), 3, dtype=th.long)], dim=0) - g = dgl.graph((src, dst)) + g = dgl._deprecate.graph.DGLGraph((src, dst)) g.edata['tid'] = etype _check_topk_score2(score_model, g, num_entity, num_rels, exclude_mode) @@ -1261,4 +1261,4 @@ def test_gnn_model_topk_emb(device='cpu'): test_rescal_model_topk_emb(device=0) #test_transr_model_topk_emb() test_rotate_model_topk_emb(device=0) - test_gnn_model_topk_emb(device=0) \ No newline at end of file + test_gnn_model_topk_emb(device=0) diff --git a/tests/scripts/task_kg_test.sh b/tests/scripts/task_kg_test.sh index d4f702a7..cb5c54e4 100644 --- a/tests/scripts/task_kg_test.sh +++ b/tests/scripts/task_kg_test.sh @@ -34,10 +34,10 @@ conda activate ${DGLBACKEND}-ci # test if [ "$2" == "cpu" ]; then pip3 uninstall dgl - pip3 install dgl==0.4.3post2 + pip3 install dgl else pip3 uninstall dgl - pip3 install dgl-cu102==0.4.3post2 + pip3 install dgl-cu102 fi pushd $KG_DIR> /dev/null From 0e2ed2622dc3281d69b6daa9fd464f0f52ad8abc Mon Sep 17 00:00:00 2001 From: gbecquin1 Date: Mon, 7 Nov 2022 09:47:21 +0000 Subject: [PATCH 2/3] updated dgl dependency for tests --- tests/scripts/task_kg_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/task_kg_test.sh b/tests/scripts/task_kg_test.sh index cb5c54e4..5f48d192 100644 --- a/tests/scripts/task_kg_test.sh +++ b/tests/scripts/task_kg_test.sh @@ -36,8 +36,8 @@ if [ "$2" == "cpu" ]; then pip3 uninstall dgl pip3 install dgl else - pip3 uninstall dgl - pip3 install dgl-cu102 + pip3 uninstall dgl>=0.5.0,<=0.9.1 + pip3 install dgl-cu102>=0.5.0,<=0.9.1 fi pushd $KG_DIR> /dev/null From b1b4e5f4f7134e84e06456d914c5796b4bd5fdb4 Mon Sep 17 00:00:00 2001 From: gbecquin1 Date: Thu, 17 Nov 2022 09:11:00 +0000 Subject: [PATCH 3/3] fix test version --- tests/scripts/task_kg_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/task_kg_test.sh b/tests/scripts/task_kg_test.sh index 5f48d192..471d34e9 100644 --- a/tests/scripts/task_kg_test.sh +++ b/tests/scripts/task_kg_test.sh @@ -34,9 +34,9 @@ conda activate ${DGLBACKEND}-ci # test if [ "$2" == "cpu" ]; then pip3 uninstall dgl - pip3 install dgl + pip3 install dgl>=0.5.0,<=0.9.1 else - pip3 uninstall dgl>=0.5.0,<=0.9.1 + pip3 uninstall dgl pip3 install dgl-cu102>=0.5.0,<=0.9.1 fi