SJTU-Quant / MASTER

This is the official code and supplementary materials for our AAAI-2024 paper: MASTER: Market-Guided Stock Transformer for Stock Price Forecasting. MASTER is a stock transformer for stock price forecasting, which models the momentary and cross-time stock correlation and guide feature selection with market information.
96 stars 20 forks source link

AttributeError: module 'qlib.contrib.data.dataset' has no attribute 'MASTERTSDatasetH' #6

Closed king21L closed 3 days ago

king21L commented 3 weeks ago

Hello,

Thanks for the remarkable job!

I have downloaded SJTU's Qlib (your forked), installed all the packages, but it still shows the following error: File "main.py", line 51, in dataset = init_instance_by_config(config['task']["dataset"]) File "/home/miniconda3/envs/qlib38/lib/python3.8/site-packages/qlib/utils/mod.py", line 171, in init_instance_by_config klass, cls_kwargs = get_callable_kwargs(config, default_module=default_module) File "/home/miniconda3/envs/qlib38/lib/python3.8/site-packages/qlib/utils/mod.py", line 103, in get_callable_kwargs _callable = getattr(module, cls) # may raise AttributeError AttributeError: module 'qlib.contrib.data.dataset' has no attribute 'MASTERTSDatasetH'

Can you help me with the error? Looking forward to your reply!

Best Regards

LITONG99 commented 3 weeks ago

I believe the error is related to the usage of Python.

It seems that you are using the pip-installed stable qlib instead of the modified qlib located within the project file. You can locate MASTERTSDatasetH in /qlib/qlib/contrib/data/dataset.py' within your project directory instead of the /site-packages/ of your conda environment.

One possible solution is to uninstall the stable qlib in your environment and then run pip install . under your project directory. This will install the modified qlib from the source with the setup.py file. You can refer to the Readme.md in the forked repository for details.

Please note that the required environment of this repository and the forked qlib repository are different. Our repository simply utilizes the pip install qlib (stable version), while you will need to install from source for the forked qlib repository.

I hope my response is helpful.

Lastly, I believe that Qlib indeed requires some experience to use effectively. This is also why we strive to minimize the dependencies of this repository on Qlib.

:pushpin: For future questions regarding the installation and usage of Qlib, please refer to its own description and allow me to refrain from answering them. Thank you guys! :relaxed: