mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
fix: fix a bug in competition metric evaluation (#407)
* fix a bug in competition metric evaluation * fix a bug * fix a bug in rag loading
This commit is contained in:
@@ -13,13 +13,15 @@ class KnowledgeBase:
|
||||
def load(self) -> None:
|
||||
if self.path is not None and self.path.exists():
|
||||
with self.path.open("rb") as f:
|
||||
self.__dict__.update(
|
||||
pickle.load(f).__dict__,
|
||||
) # TODO: because we need to align with init function, we need a less hacky way to do this
|
||||
loaded = pickle.load(f)
|
||||
if isinstance(loaded, dict):
|
||||
self.__dict__.update(loaded)
|
||||
else:
|
||||
self.__dict__.update(loaded.__dict__)
|
||||
|
||||
def dump(self) -> None:
|
||||
if self.path is not None:
|
||||
self.path.parent.mkdir(parents=True, exist_ok=True)
|
||||
pickle.dump(self, self.path.open("wb"))
|
||||
pickle.dump(self.__dict__, self.path.open("wb"))
|
||||
else:
|
||||
logger.warning("KnowledgeBase path is not set, dump failed.")
|
||||
|
||||
Reference in New Issue
Block a user