Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenWizard2015 committed Jun 10, 2024
1 parent aa0b509 commit 078d4aa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Core/CModelWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ def load(self, folder=None, postfix='', embeddings=False):
self._model.load_weights(path)
if embeddings:
embeddings = np.load(path.replace('.h5', '-embeddings.npz'))
for nm in self._embeddings.keys(): # recreate embeddings
for nm, emb in self._embeddings.items():
w = embeddings[nm]
emb = L.Embedding(w.shape[0], w.shape[1])
emb.build((None, 1))
emb.set_weights([w])
self._embeddings[nm] = emb # replace
if not emb.built: emb.build((None, w.shape[0]))
emb.set_weights([w]) # replace embeddings
continue
return

Expand Down

0 comments on commit 078d4aa

Please sign in to comment.