piskvorky/gensim
在 GitHub 查看model.trainables.update_weights executes even when no new vocabulary is added
Open
#2,025 建立於 2018年4月10日
Hacktoberfestbugdifficulty easyimpact LOW
倉庫指標
- Star
- (15,144 star)
- PR 合併指標
- (30 天內沒有已合併 PR)
描述
This one is not a major issue, but I think it is important to fix in order to avoid confusion.
Even when there is no new vocabulary, model.trainables.update_weights takes a while to execute (with no effect on the model) because it doesn't check whether gained_vocab is greater than zero or not.
should be replaced by:
gained_vocab = len(wv.vocab) - len(wv.vectors)
if gained_vocab <= 0:
raise RuntimeError(
"There is no new vocabulary added. "
"If you want to update the weights with a new vocabulary, please first update model.vocab"
)