FLORA aligner workflows have default model and cached-embedding inconsistencies
1. Default FLORAAligner passes None as the embedding model ID
Location: ontoaligner/aligner/flora/flora.py:192, ontoaligner/aligner/flora/flora.py:241-246
Current code:
model_id: Optional[str] = None,
and:
self.literals_embedding = FLORALiteralsEmbedding(
model_id=model_id,
device=device if device else 'cpu',
identity=string_identity,
emb_path=emb_path,
)
This explicitly forwards model_id=None to FLORALiteralsEmbedding, which overrides the embedding class default model:
model_id: str = "Lihuchen/pearl_small"
Observed before fix:
Creating FLORAAligner() with public defaults...
FAIL: FLORAAligner() failed with public defaults.
Error type: OSError
Error message: None is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with `hf auth login` or by passing `token=<your_token>`
Fix:
Use the same concrete default in FLORAAligner:
model_id: Optional[str] = "Lihuchen/pearl_small",
This keeps default construction valid while still allowing users to pass their own model:
FLORAAligner(model_id="custom-model-id")
Verified after fix:
PASS: FLORAAligner() constructed successfully.
Aligner: FLORAAligner
2. Cached embeddings are assigned as tuples to both graph slots
Location: ontoaligner/aligner/flora/literals.py:407-410, ontoaligner/aligner/flora/literals.py:633-646
Current code:
self.kg1_pretrained = self.load_embeddings(emb_path)
self.kg2_pretrained = self.load_embeddings(emb_path)
But load_embeddings() returns two values:
def load_embeddings(
self,
emb_path: str,
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
"""Load precomputed embeddings for two knowledge bases.
Args:
emb_path: Directory path where embedding files are saved.
"""
with open(os.path.join(emb_path, "kb1.pkl"), "rb") as f:
kb1_emb = pickle.load(f)
with open(os.path.join(emb_path, "kb2.pkl"), "rb") as f:
kb2_emb = pickle.load(f)
return kb1_emb, kb2_emb
So the current code assigns the full tuple to both attributes:
self.kg1_pretrained = (kb1_emb, kb2_emb)
self.kg2_pretrained = (kb1_emb, kb2_emb)
This breaks the documented cached-embedding workflow because each graph slot should receive its own embedding dictionary.
Fix:
Unpack the returned tuple once:
self.kg1_pretrained, self.kg2_pretrained = self.load_embeddings(emb_path)
This assigns:
self.kg1_pretrained = kb1_emb
self.kg2_pretrained = kb2_emb
instead of assigning the full (kb1_emb, kb2_emb) tuple to both.
FLORA aligner workflows have default model and cached-embedding inconsistencies
1. Default FLORAAligner passes
Noneas the embedding model IDLocation:
ontoaligner/aligner/flora/flora.py:192,ontoaligner/aligner/flora/flora.py:241-246Current code:
and:
This explicitly forwards
model_id=NonetoFLORALiteralsEmbedding, which overrides the embedding class default model:Observed before fix:
Fix:
Use the same concrete default in
FLORAAligner:This keeps default construction valid while still allowing users to pass their own model:
Verified after fix:
2. Cached embeddings are assigned as tuples to both graph slots
Location:
ontoaligner/aligner/flora/literals.py:407-410,ontoaligner/aligner/flora/literals.py:633-646Current code:
But
load_embeddings()returns two values:So the current code assigns the full tuple to both attributes:
This breaks the documented cached-embedding workflow because each graph slot should receive its own embedding dictionary.
Fix:
Unpack the returned tuple once:
This assigns:
instead of assigning the full
(kb1_emb, kb2_emb)tuple to both.