Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix alstm models and the corresponding yaml documents #1575

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ task:
loss: mse
n_jobs: 20
GPU: 0
rnn_type: GRU
rnn_type: LSTM
dataset:
class: TSDatasetH
module_path: qlib.data.dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ task:
metric: loss
loss: mse
GPU: 0
rnn_type: GRU
rnn_type: LSTM
dataset:
class: DatasetH
module_path: qlib.data.dataset
Expand Down
3 changes: 3 additions & 0 deletions qlib/contrib/model/pytorch_alstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(
optimizer="adam",
GPU=0,
seed=None,
rnn_type="GRU",
**kwargs
):
# Set logger.
Expand Down Expand Up @@ -103,6 +104,7 @@ def __init__(
self.device,
self.use_gpu,
seed,
self.rnn_type = rnn_type
)
)

Expand All @@ -115,6 +117,7 @@ def __init__(
hidden_size=self.hidden_size,
num_layers=self.num_layers,
dropout=self.dropout,
rnn_type=self.rnn_type,
)
self.logger.info("model:\n{:}".format(self.ALSTM_model))
self.logger.info("model size: {:.4f} MB".format(count_parameters(self.ALSTM_model)))
Expand Down
3 changes: 3 additions & 0 deletions qlib/contrib/model/pytorch_alstm_ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(
n_jobs=10,
GPU=0,
seed=None,
rnn_type="GRU",
**kwargs
):
# Set logger.
Expand All @@ -77,6 +78,7 @@ def __init__(
self.device = torch.device("cuda:%d" % (GPU) if torch.cuda.is_available() and GPU >= 0 else "cpu")
self.n_jobs = n_jobs
self.seed = seed
self.rnn_type = rnn_type

self.logger.info(
"ALSTM parameters setting:"
Expand Down Expand Up @@ -122,6 +124,7 @@ def __init__(
hidden_size=self.hidden_size,
num_layers=self.num_layers,
dropout=self.dropout,
rnn_type=self.rnn_type,
)
self.logger.info("model:\n{:}".format(self.ALSTM_model))
self.logger.info("model size: {:.4f} MB".format(count_parameters(self.ALSTM_model)))
Expand Down