Skip to content

Commit

Permalink
Fix minor typos in Tianshou tutorial (#994)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylwil3 committed Jun 15, 2023
1 parent 33aad74 commit 986abb3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/tianshou/beginner.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To follow this tutorial, you will need to install the dependencies shown below.
```

## Code
The following code should run without any issues. The comments are designed to help you understand how to use PettingZoo with CleanRL. If you have any questions, please feel free to ask in the [Discord server](https://discord.gg/nhvKkYa6qX).
The following code should run without any issues. The comments are designed to help you understand how to use PettingZoo with Tianshou. If you have any questions, please feel free to ask in the [Discord server](https://discord.gg/nhvKkYa6qX).
```{eval-rst}
.. literalinclude:: ../../../tutorials/Tianshou/1_basic_api_usage.py
:language: python
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/tianshou/intermediate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "Tianshou: Training Agents"

# Tianshou: Training Agents

This tutorial shows how use [Tianshou](https://github.com/thu-ml/tianshou) to train a [Deep Q-Network](https://tianshou.readthedocs.io/en/master/tutorials/dqn.html) (DQN) agent to play vs a [random policy](https://tianshou.readthedocs.io/en/master/_modules/tianshou/policy/random.html) agent in the [Tic-Tac-Toe](https://pettingzoo.farama.org/environments/classic/tictactoe/) environment.
This tutorial shows how to use [Tianshou](https://github.com/thu-ml/tianshou) to train a [Deep Q-Network](https://tianshou.readthedocs.io/en/master/tutorials/dqn.html) (DQN) agent to play vs a [random policy](https://tianshou.readthedocs.io/en/master/_modules/tianshou/policy/random.html) agent in the [Tic-Tac-Toe](https://pettingzoo.farama.org/environments/classic/tictactoe/) environment.

## Environment Setup
To follow this tutorial, you will need to install the dependencies shown below. It is recommended to use a newly-created virtual environment to avoid dependency conflicts.
Expand Down
4 changes: 2 additions & 2 deletions tutorials/Tianshou/2_training_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def _get_env():

# ======== Step 4: Callback functions setup =========
def save_best_fn(policy):
model_save_path = os.path.join("log", "rps", "dqn", "policy.pth")
os.makedirs(os.path.join("log", "rps", "dqn"), exist_ok=True)
model_save_path = os.path.join("log", "ttt", "dqn", "policy.pth")
os.makedirs(os.path.join("log", "ttt", "dqn"), exist_ok=True)
torch.save(policy.policies[agents[1]].state_dict(), model_save_path)

def stop_fn(mean_rewards):
Expand Down

0 comments on commit 986abb3

Please sign in to comment.