Set gpu option for rlPPOAgent actor

Hi,
Is there a way to set the gpu option for an rlPPOAgent actor?
agent = rlPPOAgent(obsInfo,actInfo,agentOpts);
critic = getCritic(agent);
critic.Options.LearnRate = 1e-3;
critic.Options.UseDevice = 'gpu';
agent = setCritic(agent,critic);
I was able to set the critic to gpu but need to know how to set it for the actor. agentOpts is rlPPOAgentOptions, which doesn't take UseDevice.
Thanks!

Réponses (1)

0 votes

What you have specified is sufficient for the critic. If you do the same for the actor you are all set - there is no additional param for the agent overall (actor and critic are two key components of the agent after all)

7 commentaires

John Doe
John Doe le 11 Mar 2021
Sorry, I meant this question for the actor, not the agent.
John Doe
John Doe le 11 Mar 2021
How would I do the same for the actor?
John Doe
John Doe le 11 Mar 2021
The confusion is because there is no actor definition at all in this:
agentOpts = rlPPOAgentOptions(...
'ExperienceHorizon',2000,...
'ClipFactor',0.2,... % how much change is allowed each step
'EntropyLossWeight',0.01,...
'MiniBatchSize',1000,...
'NumEpoch',3,...
'AdvantageEstimateMethod','gae',...
'GAEFactor',0.95,...
'SampleTime',0.1,...
'DiscountFactor',0.9);
agent = rlPPOAgent(obsInfo,actInfo,agentOpts);
critic = getCritic(agent);
critic.Options.LearnRate = 0.1;
critic.Options.UseDevice = 'gpu';
agent = setCritic(agent,critic);
John Doe
John Doe le 11 Mar 2021
this is what it's showing during training:
John Doe
John Doe le 16 Mar 2021
if this isn't possible, can we generate the actor net definition and modify things in that ourselves? I'd like to change the learn rate for it also, which might be another buried option.
John Doe
John Doe le 25 Mar 2021
I could use some guidance here to run fully on GPU. My env runs pretty slow right now
I believe I already answered this question - for the actor you need to do the same thing you did for the critic.
actor = getActor(agent);
actor.Options.UseDevice = 'gpu';
agent = setCritic(agent,actor);
If the environment itse;f is simulating slowly GPUs will not help as much. You need to check your model and identify what's slow

Connectez-vous pour commenter.

Catégories

Produits

Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by