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

Set torch device from commandline #4888

Merged
merged 7 commits into from
Jan 28, 2021
Merged

Set torch device from commandline #4888

merged 7 commits into from
Jan 28, 2021

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Jan 27, 2021

Proposed change(s)

The torch device string can now be set from the commandline. The default behavior is the same as before: it will use cuda if it's detected, or cpu otherwise. This allows overriding the default logic (e.g. force cpu even if you support cuda), or specifying a device index if e.g. you have two different GPU types.

Also logs the device type so that it's obvious which is being used.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

https://forum.unity.com/threads/ml-agent-server-build-headless-with-visual-observations-and-multiple-gpus.1042456/
#4876

Types of change(s)

  • New feature

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)

Copy link
Contributor

@dongruoping dongruoping left a comment

Choose a reason for hiding this comment

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

It would be good to also mention this option somewhere in to doc

ml-agents/mlagents/trainers/cli_utils.py Show resolved Hide resolved
Copy link
Contributor

@ervteng ervteng left a comment

Choose a reason for hiding this comment

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

:shipit:

@chriselion chriselion merged commit 82fb259 into master Jan 28, 2021
@delete-merged-branch delete-merged-branch bot deleted the torch-device-config branch January 28, 2021 17:13
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants