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 typos in Tianshou tutorial #994

Merged
merged 1 commit into from
Jun 15, 2023
Merged
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
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