qlib
qlib copied to clipboard
MemoryError triggered when importing 'TopkDropoutStrategy' from qlib.contrib.strategy
from typing import Tuple
import pandas as pd
import qlib
from qlib.contrib.strategy import TopkDropoutStrategy
from qlib.data import D
from qlib.utils import hash_args, init_instance_by_config
if __name__ == "__main__":
qlib.init(
provider_uri=r"D:\qlib_data",
region="cn",
)
TRAIN_PERIODS: Tuple = ("2013-01-01", "2017-12-31")
VALID_PERIODS: Tuple = ("2018-01-01", "2019-12-31")
TEST_PERIODS: Tuple = ("2020-01-01", "2023-05-31")
dataset_config = {
"class": "DatasetH",
"module_path": "qlib.data.dataset",
"kwargs": {
"handler": {
"class": "Alpha158",
"module_path": "qlib.contrib.data.handler",
"kwargs": {
"start_time": TRAIN_PERIODS[0],
"end_time": TEST_PERIODS[1],
"fit_start_time": TRAIN_PERIODS[0],
"fit_end_time": TRAIN_PERIODS[1],
"instruments": "csi300",
},
},
"segments": {
"train": TRAIN_PERIODS,
"valid": VALID_PERIODS,
"test": TEST_PERIODS,
},
},
}
dataset = init_instance_by_config(dataset_config)
此时会报错
qlib版本为0.9.3
在注释掉from qlib.contrib.strategy import TopkDropoutStrategy后便不会有问题
You can try cleaning up the disk space on your system or adjusting the VM options in IntelliJ IDEA.
I am also facing the same problem. What should I do?