MCPcopy
hub / github.com/microsoft/qlib / to_pickle

Method to_pickle

examples/benchmarks/TFT/tft.py:296–322  ·  view source on GitHub ↗

Tensorflow model can't be dumped directly. So the data should be save separately **TODO**: Please implement the function to load the files Parameters ---------- path : Union[Path, str] the target path to be dumped

(self, path: Union[Path, str])

Source from the content-addressed store, hash-verified

294 pass
295
296 def to_pickle(self, path: Union[Path, str]):
297 """
298 Tensorflow model can't be dumped directly.
299 So the data should be save separately
300
301 **TODO**: Please implement the function to load the files
302
303 Parameters
304 ----------
305 path : Union[Path, str]
306 the target path to be dumped
307 """
308 # FIXME: implementing saving tensorflow models
309 # save tensorflow model
310 # path = Path(path)
311 # path.mkdir(parents=True)
312 # self.model.save(path)
313
314 # save qlib model wrapper
315 drop_attrs = ["model", "tf_graph", "sess", "data_formatter"]
316 orig_attr = {}
317 for attr in drop_attrs:
318 orig_attr[attr] = getattr(self, attr)
319 setattr(self, attr, None)
320 super(TFTModel, self).to_pickle(path)
321 for attr in drop_attrs:
322 setattr(self, attr, orig_attr[attr])

Callers 9

data_cache_demo.pyFile · 0.45
first_runMethod · 0.45
routineMethod · 0.45
add_strategyMethod · 0.45
prepare_dataFunction · 0.45
dump_and_load_datasetMethod · 0.45
generate_orderFunction · 0.45
_dump_pre_handlerMethod · 0.45
fitMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected