KGATE 0.2.4__tar.gz → 0.2.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: KGATE
3
- Version: 0.2.4
3
+ Version: 0.2.6
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "KGATE"
3
- version = "0.2.4"
3
+ version = "0.2.6"
4
4
  description = "Knowledge Graph Autoencoder Training Environment, bridging PyG encoders and TorchKGE decoders."
5
5
  authors = [
6
6
  {name = "Benjamin Loire", email = "benjamin.loire@univ-amu.fr"},
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  from glob import glob
3
+ import shutil
3
4
  from inspect import signature
4
5
  from pathlib import Path
5
6
  from torchkge import KnowledgeGraph
@@ -10,7 +11,7 @@ from torch import tensor, long, stack, Tensor
10
11
  from torch.nn import Parameter
11
12
  from torch.nn.functional import normalize
12
13
  from torch.utils.data import DataLoader
13
- from .utils import parse_config, load_knowledge_graph, set_random_seeds, find_best_model, merge_kg, init_embedding, plot_learning_curves
14
+ from .utils import parse_config, load_knowledge_graph, set_random_seeds, find_best_model, merge_kg, init_embedding, plot_learning_curves, save_config
14
15
  from .preprocessing import prepare_knowledge_graph, SUPPORTED_SEPARATORS
15
16
  from .encoders import *
16
17
  from .decoders import *
@@ -574,7 +575,7 @@ class Architect(Model):
574
575
  checkpoint_file = checkpoint_file or Path(max(all_checkpoints, key=os.path.getctime))
575
576
  logging.info("Found previous run with the same parameters in the output folder... ")
576
577
  elif self.checkpoints_dir.exists() and len(os.listdir(self.checkpoints_dir)) > 0:
577
- self.checkpoints_dir.unlink()
578
+ shutil.rmtree(self.checkpoints_dir)
578
579
 
579
580
  # trainer.add_event_handler(Events.EPOCH_STARTED, self.encoder_pass)
580
581
 
@@ -645,6 +646,8 @@ class Architect(Model):
645
646
  to_save
646
647
  )
647
648
 
649
+ save_config(self.config)
650
+
648
651
  if checkpoint_file is not None:
649
652
  if Path(checkpoint_file).is_file():
650
653
  logging.info(f"Resuming training from checkpoint: {checkpoint_file}")
@@ -96,7 +96,7 @@ def save_config(config:dict, filename:Path | None = None):
96
96
 
97
97
  config_path = filename or Path(config["output_directory"]).joinpath("kgate_config.toml")
98
98
 
99
- with open(config_path, "w") as f:
99
+ with open(config_path, "wb") as f:
100
100
  tomli_w.dump(config,f)
101
101
 
102
102
  def load_knowledge_graph(pickle_filename: Path) -> Tuple[KnowledgeGraph, KnowledgeGraph, KnowledgeGraph]:
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