KGATE 0.2.6__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kgate-0.2.6 → kgate-0.2.8}/PKG-INFO +1 -1
- {kgate-0.2.6 → kgate-0.2.8}/pyproject.toml +1 -1
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/kgate.py +4 -4
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/knowledgegraph.py +4 -1
- {kgate-0.2.6 → kgate-0.2.8}/LICENSE +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/README.md +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/__init__.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/config_template.toml +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/decoders/__init__.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/decoders/bilinear.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/decoders/convolutional.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/decoders/translational.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/encoders.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/evaluators.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/grid_search.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/inference.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/preprocessing.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/samplers.py +0 -0
- {kgate-0.2.6 → kgate-0.2.8}/src/kgate/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: KGATE
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Knowledge Graph Autoencoder Training Environment, bridging PyG encoders and TorchKGE decoders.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: Knowledge Graph,Knowledge Graph Embedding,Autoencoder,Machine Learning,Link Prediction
|
|
@@ -567,13 +567,13 @@ class Architect(Model):
|
|
|
567
567
|
)
|
|
568
568
|
|
|
569
569
|
# If we find an identical config we resume training from it, otherwise we clean the checkpoints directory.
|
|
570
|
-
existing_config_path: Path = Path(self.config["output_directory"]).joinpath("
|
|
570
|
+
existing_config_path: Path = Path(self.config["output_directory"]).joinpath("kgate_config.toml")
|
|
571
571
|
if existing_config_path.exists():
|
|
572
572
|
existing_config = parse_config(str(existing_config_path), {})
|
|
573
573
|
if existing_config == self.config:
|
|
574
574
|
all_checkpoints = glob(f"{self.checkpoints_dir}/checkpoint_*.pt")
|
|
575
575
|
checkpoint_file = checkpoint_file or Path(max(all_checkpoints, key=os.path.getctime))
|
|
576
|
-
logging.info("Found previous run with the same
|
|
576
|
+
logging.info("Found previous run with the same configuration in the output folder... ")
|
|
577
577
|
elif self.checkpoints_dir.exists() and len(os.listdir(self.checkpoints_dir)) > 0:
|
|
578
578
|
shutil.rmtree(self.checkpoints_dir)
|
|
579
579
|
|
|
@@ -581,9 +581,7 @@ class Architect(Model):
|
|
|
581
581
|
|
|
582
582
|
trainer.add_event_handler(Events.EPOCH_COMPLETED, self.log_metrics_to_csv)
|
|
583
583
|
trainer.add_event_handler(Events.EPOCH_COMPLETED, self.clean_memory)
|
|
584
|
-
trainer.add_event_handler(Events.EPOCH_COMPLETED(every=self.eval_interval), self.evaluate)
|
|
585
584
|
trainer.add_event_handler(Events.EPOCH_COMPLETED, self.update_scheduler)
|
|
586
|
-
trainer.add_event_handler(Events.EPOCH_COMPLETED(every=self.eval_interval), early_stopping)
|
|
587
585
|
|
|
588
586
|
trainer.add_event_handler(Events.COMPLETED, self.on_training_completed)
|
|
589
587
|
|
|
@@ -640,6 +638,8 @@ class Architect(Model):
|
|
|
640
638
|
atomic=True
|
|
641
639
|
)
|
|
642
640
|
|
|
641
|
+
trainer.add_event_handler(Events.EPOCH_COMPLETED(every=self.eval_interval), self.evaluate)
|
|
642
|
+
trainer.add_event_handler(Events.EPOCH_COMPLETED(every=self.eval_interval), early_stopping)
|
|
643
643
|
trainer.add_event_handler(
|
|
644
644
|
Events.EPOCH_COMPLETED(every=self.eval_interval),
|
|
645
645
|
checkpoint_best_handler,
|
|
@@ -101,7 +101,10 @@ class KnowledgeGraph(Dataset):
|
|
|
101
101
|
|
|
102
102
|
if df is None:
|
|
103
103
|
self.n_nodes = cat([self.head_idx, self.tail_idx]).unique().size(0)
|
|
104
|
-
|
|
104
|
+
# The mapping is done on the absolute index of nodes. However, subgraphs don't have all the nodes
|
|
105
|
+
# Thus, we must initialize the tensor at -1 to avoid downstream issue with the node_type 0 being
|
|
106
|
+
# broadcasted to missing nodes in subgraphs.
|
|
107
|
+
self.node_types = torch.ones(self.n_nodes, dtype=torch.long).neg()
|
|
105
108
|
|
|
106
109
|
for tri_type in self.triples.unique():
|
|
107
110
|
h_t, t_t = self.triple_types[tri_type][0], self.triple_types[tri_type][2]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|