Skip to content

Commit

Permalink
updated dgl dependency (#268)
Browse files Browse the repository at this point in the history
* updated dgl dependency

* updated dgl dependency for tests

* fix test version

Co-authored-by: Guillaume Becquin <gbecquin1@bloomberg.net>
  • Loading branch information
guillaume-be and Guillaume Becquin authored Nov 18, 2022
1 parent 1da726c commit 276c2e4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions python/dglke/dataloader/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/dglke/models/ke_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion python/dglke/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...')
Expand Down
2 changes: 1 addition & 1 deletion python/dglke/tests/test_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
4 changes: 2 additions & 2 deletions python/dglke/tests/test_topk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
test_gnn_model_topk_emb(device=0)
4 changes: 2 additions & 2 deletions tests/scripts/task_kg_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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>=0.5.0,<=0.9.1
else
pip3 uninstall dgl
pip3 install dgl-cu102==0.4.3post2
pip3 install dgl-cu102>=0.5.0,<=0.9.1
fi

pushd $KG_DIR> /dev/null
Expand Down

0 comments on commit 276c2e4

Please sign in to comment.