clab / clab/dynet

Errors in saving trained models

Open
#1,368 7 comments 0 reactions 0 assignees View on GitHub
moderate bug
Dominant language
C++
Stars
3.4k
Forks
701
PR merge metrics
No merged PRs in 30d

Description

Hi, when running
```
cbow = CBOWClassifier()
trainer = dy.AdagradTrainer(cbow.model) #where mode is a parameter collection
loss = cbow.get_loss(train_set[0], True)
loss_value = loss.value()
loss.backward()
trainer.update()
cbow.model.save("best_tmp.model")

cbow = CBOWClassifier()
cbow.model.populate("best_tmp.model")
```

The out is unreadable and the load fails.
While commenting out the `trainer.update()` line makes the save/load work

```
cbow = CBOWClassifier()
trainer = dy.AdagradTrainer(cbow.model)
loss = cbow.get_loss(train_set[0], True)
loss_value = loss.value()
loss.backward()
#trainer.update()
cbow.model.save("best_tmp.model")

cbow = CBOWClassifier()
cbow.model.populate("best_tmp.model")
```

Using DyNet 2.0.3 trough jupyter notebook
There are no error msgs the kernel just disconnect and reconnect back after few minutes(!?)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the DyNet 2.0.3 snippet in a Jupyter notebook, comparing behavior with and without AdagradTrainer.update(). Start from the CBOWClassifier model.save and model.populate calls; done means saving after the update produces readable output, reloads successfully, and does not disconnect the kernel.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.