# Retrieve specialized weights after training with MAML

**URL:** <https://discuss.ray.io/t/retrieve-specialized-weights-after-training-with-maml/3484>\
**Category:** RLlib\
**Created:** [September 8, 2021, 1:38pm UTC](https://discuss.ray.io/t/retrieve-specialized-weights-after-training-with-maml/3484 "2021-09-08T13:38:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LorenzoFederici](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@LorenzoFederici](https://discuss.ray.io/u/LorenzoFederici)\
**Post date:** [September 8, 2021, 1:38pm UTC](https://discuss.ray.io/t/retrieve-specialized-weights-after-training-with-maml/3484/1 "2021-09-08T13:38:44Z")

</div>

Hello,  
I’m trying to train an agent using MAML on a meta-environment made up of five different tasks.  
I’m wondering if, once the training is complete, there is a way to retrive, from the trained agent, the specialized weights obtained after the last adaptation step on each single task at a given saved iteration/checkpoint.  
I know that the non-specialized weights at a given checkpoint can be easily obtained with something similar to:

```auto
agent = ray.rllib.agents.maml.MAMLTrainer(config=config, env=config["env"])
agent.restore(checkpoint)
weights = agent.get_weights()

```

but I don’t know if there is a built-in function which instead returns the specialized weights at the N adaptation step.  
Alternatively, is there a simple way to re-compute the specialized weights on the single task starting from the non-specialized ones?

I’m using RLlib library, version 1.3.0, with python 3.8.10 on a conda virtual environment.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![vishalrangras](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/vishalrangras/32/976_2.png) [@vishalrangras](https://discuss.ray.io/u/vishalrangras)\
**Post date:** [November 19, 2021, 9:29pm UTC](https://discuss.ray.io/t/retrieve-specialized-weights-after-training-with-maml/3484/2 "2021-11-19T21:29:43Z")

</div>

Just out of curiosity, why do you need the specialized weights?
