Skip to content

How to load MushroomRL agent trained on a GPU? #15

Answered by boris-il-forte
rey-allan asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately, you cannot do anything with the saved model. You need to load in a machine using a GPU and then move back the tensors to the CPU before saving the agent again.

You can access the torch network with the "network" attribute of the TorchApproximator and move the module on the CPU using the standard torch code. You also need to set use_cuda to false.

If you are using a mushroom Regressor (the interface that wraps the approximation class, wich is used by any rl algorithm in mushroom) you can access your networks using regressor.model.network

Otherwise, you can modify the code of mushroom-rl at this line:
https://github.com/MushroomRL/mushroom-rl/blob/b2a715221cf000417f2ad69fa6a…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rey-allan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants