model load from recorder.load_object() missing _fitted variable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 48.7k
- Forks
- 7.7k
- PR merge metrics
- No merged PRs in 30d
Description
🐛 Bug Description
model loaded from recorder.load_object() missing _fitted variable. Not sure whether it is caused by pickle.dump or pickle.load
To Reproduce
Steps to reproduce the behavior:
model = init_instance_by_config(task["model"]), the model can be LSTM from pytorch
with R.start(experiment_name="train_model"):
R.log_params(**flatten_dict(task))
model.fit(dataset, save_path = ".model-pytorch")
R.save_objects(trained_model=model)
recorder = R.get_recorder()
with R.start(experiment_name="backtest_analysis"):
recorder = R.get_recorder(rid, experiment_name="train_model")
model = recorder.load_object("trained_model")
# prediction
recorder = R.get_recorder()
ba_rid = recorder.id
sr = SignalRecord(model, dataset, recorder)
sr.generate()
It will return error saying _fitted not exist.
Expected Behavior
recorder.load_object should be able to load all variables in LSTM class
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.6.1.dev0
- Python version: 3.7
- OS (
Windows,Linux,MacOS): Linux - Pytorch: 1.7.1+cu101
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported flow with init_instance_by_config, model.fit, R.save_objects, recorder.load_object, and SignalRecord.generate using the stated Python and PyTorch versions. Compare the LSTM model state before saving and after loading, focusing on the missing _fitted variable and whether pickle serialization or deserialization loses it. Done means the loaded model can be passed to SignalRecord.generate without the _fitted error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100