Skip to content

Commit d9d9119

Browse files
committed
saving functionality migrated to neer-match-utilities
1 parent 3ad9655 commit d9d9119

File tree

2 files changed

+1
-55
lines changed

2 files changed

+1
-55
lines changed

src/neer_match/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
Neural-symbolic Entity Reasoning and Matching.
44
"""
55

6-
__version__ = '0.7.35'
6+
__version__ = '0.7.36'

src/neer_match/matching_model.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -224,32 +224,6 @@ def suggest(
224224
"""
225225
return _suggest(self, left, right, count, batch_size=batch_size, **kwargs)
226226

227-
def save(self, target_directory: Path, name: str, include_optimizer: bool = True) -> None:
228-
"""Save the deep learning model to disk.
229-
230-
Saves the model architecture, weights, and optimizer state (optional),
231-
along with the similarity map.
232-
233-
Args:
234-
target_directory: The directory where the model will be saved.
235-
name: The name of the model (used as a subdirectory).
236-
include_optimizer: Whether to save the optimizer state.
237-
"""
238-
# Ensure target_directory is a Path object
239-
target_directory = Path(target_directory) / name / 'model'
240-
241-
# Ensure the directory exists
242-
target_directory.mkdir(parents=True, exist_ok=True)
243-
244-
# Save the model architecture and weights
245-
super().save(target_directory / "model.h5", include_optimizer=include_optimizer)
246-
247-
# Save the similarity map
248-
with open(target_directory / "similarity_map.pkl", "wb") as f:
249-
pickle.dump(self.similarity_map, f)
250-
251-
print(f"Model successfully saved to {target_directory}")
252-
253227
@property
254228
def similarity_map(self) -> SimilarityMap:
255229
"""Similarity Map of the Model."""
@@ -671,34 +645,6 @@ def suggest(
671645
"""
672646
return _suggest(self, left, right, count, batch_size=batch_size)
673647

674-
def save(self, target_directory: Path, name: str) -> None:
675-
"""Save the neural-symbolic model to disk.
676-
677-
Saves the record pair network, similarity map, and optimizer.
678-
679-
Args:
680-
target_directory: The directory where the model will be saved.
681-
name: The name of the model (used as a subdirectory).
682-
"""
683-
# Ensure target_directory is a Path object
684-
target_directory = Path(target_directory) / name / 'model'
685-
686-
# Ensure the directory exists
687-
target_directory.mkdir(parents=True, exist_ok=True)
688-
689-
# Save the record pair network weights
690-
self.record_pair_network.save_weights(target_directory / "record_pair_network.weights.h5")
691-
692-
# Save the similarity map
693-
with open(target_directory / "similarity_map.pkl", "wb") as f:
694-
pickle.dump(self.record_pair_network.similarity_map, f)
695-
696-
# Save the optimizer state
697-
with open(target_directory / "optimizer.pkl", "wb") as f:
698-
pickle.dump(self.optimizer.get_config(), f)
699-
700-
print(f"Model successfully saved to {target_directory}")
701-
702648
@property
703649
def similarity_map(self) -> SimilarityMap:
704650
"""Similarity Map of the Model."""

0 commit comments

Comments
 (0)