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 configuration example #1454

Open
wants to merge 3 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
4 changes: 2 additions & 2 deletions docs/component/rl/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ QlibRL provides an example of an implementation of a single asset order executio
# number of time indexes
total_time: 240
# start time index
default_start_time: 0
default_start_time_index: 0
# end time index
default_end_time: 240
default_end_time_index: 240
proc_data_dim: 6
num_workers: 0
queue_size: 20
Expand Down
2 changes: 1 addition & 1 deletion examples/rl/experiment_config/backtest/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ strategies:
module_path: qlib.rl.order_execution.policy
kwargs:
lr: 1.0e-4
weight_file: ./checkpoints/latest.pth
weight_file: ./checkpoints/checkpoints/latest.pth
concurrency: 5
4 changes: 2 additions & 2 deletions examples/rl/experiment_config/training/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ data:
order_dir: ./data/training_order_split
data_dir: ./data/pickle_dataframe/backtest
total_time: 240
default_start_time: 0
default_end_time: 240
default_start_time_index: 0
default_end_time_index: 240
proc_data_dim: 6
num_workers: 0
queue_size: 20
Expand Down
2 changes: 1 addition & 1 deletion examples/rl/simple_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
"simulator = SimpleSimulator(100.0, NSTEPS)\n",
"state = simulator.get_state()\n",
"obs = [{\"obs\": state_interpreter.interpret(state)}]\n",
"policy_out = policy(Batch(obs))\n",
"policy_out = policy(Batch(obs, info=None))\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the script simple_example.ipynb without encountering any errors. Could you please provide me with instructions on how to reproduce the issue you mentioned? (My tianshou version is 0.4.10)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a very long time ago, since then all the RL examples save for this notebook have been deleted from the repository, and it may have been fixed since. I recall I had the latest tianshou version at the time (0.4.11) and just ran the script before realizing this issue.

"act = float(action_interpreter.interpret(state, policy_out.act))\n",
"\n",
"simulator.step(act)\n",
Expand Down
2 changes: 1 addition & 1 deletion qlib/rl/order_execution/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def _generate_trade_decision(self, execute_result: list | None = None) -> BaseTr
obs_batch.append({"obs": self._state_interpreter.interpret(state)})

with torch.no_grad():
policy_out = self._policy(Batch(obs_batch))
policy_out = self._policy(Batch(obs_batch, info=None))
act = policy_out.act.numpy() if torch.is_tensor(policy_out.act) else policy_out.act
exec_vols = [self._action_interpreter.interpret(s, a) for s, a in zip(states, act)]

Expand Down