microsoft / microsoft/qlib

Tabnet model serialization error

Open
#1,021 3 comments 0 reactions 1 assignee View on GitHub

@SunsetWolf is already working on this.

Since Apr 11, 2022.

bug
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug Description

When I save the model to a file then reload it for further training, there was this error of 'too many values to unpack'.
[9248:MainThread](2022-03-28 13:45:09,824) INFO - qlib.TabNet - [pytorch_tabnet.py:160] - Pretrain... [9248:MainThread](2022-03-28 13:45:10,259) INFO - qlib.TabNet - [pytorch_tabnet.py:134] - epoch: 0 [9248:MainThread](2022-03-28 13:45:10,259) INFO - qlib.TabNet - [pytorch_tabnet.py:135] - pre-training... [9248:MainThread](2022-03-28 13:45:12,005) ERROR - qlib.workflow - [utils.py:38] - An exception has been raised[ValueError: too many values to unpack (expected 2)]. File ".\rolling_workflow.py", line 333, in <module> best_score, best_epoch, loss_type = model.fit(dataset=dataset) File "C:\Users\Hense\AppData\Roaming\Python\Python38\site-packages\qlib\contrib\model\pytorch_tabnet.py", line 161, in fit self.pretrain_fn(dataset, self.pretrain_file) File "C:\Users\Hense\AppData\Roaming\Python\Python38\site-packages\qlib\contrib\model\pytorch_tabnet.py", line 136, in pretrain_fn self.pretrain_epoch(x_train) File "C:\Users\Hense\AppData\Roaming\Python\Python38\site-packages\qlib\contrib\model\pytorch_tabnet.py", line 327, in pretrain_epoch (vec, sparse_loss) = self.tabnet_model(feature, priors) ValueError: too many values to unpack (expected 2)

To Reproduce

Steps to reproduce the behavior:

  1. save model by 'model.to_pickle()
  2. load the model by pickle
  3. train the model by model.fit()

Expected Behavior

model continue fitting.

Screenshot

image

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.

  • Qlib version: 0.8.0
  • Python version: 3.8.12
  • OS (Windows, Linux, MacOS): Windows 10 64bit
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.