1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 23:06:58 +08:00

add finetune example & fix serial bug

This commit is contained in:
Young
2020-11-16 13:11:39 +00:00
parent 3e04ded750
commit 90d41e4022
5 changed files with 203 additions and 37 deletions

View File

@@ -8,11 +8,11 @@ import pickle
class Serializable:
"""
Serializable behaves like pickle.
But it only save the state whose name starts with `_`
But it only saves the state whose name **does not** start with `_`
"""
def __getstate__(self) -> dict:
return {k: v for k, v in self.__dict__.items() if k.startswith("_")}
return {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
def __setstate__(self, state: dict):
self.__dict__.update(state)