cogment / cogment-verse

Research platform for Human-in-the-loop learning (HILL) & Multi-Agent Reinforcement Learning (MARL)
https://cogment.ai/cogment_verse
Apache License 2.0
76 stars 14 forks source link

Fix model iteration during deserialization #162

Closed wduguay-air closed 1 year ago

wduguay-air commented 1 year ago

Bug:

The current model iteration number was serialized with the model, then put back into the Model instance during deserialization. This way, the proper model iteration is retrieved from the model registry, but the model iteration was never incremented.

Fix:

Remove the model iteration from the serialized model_user_data. Instead, retrieve the model iteration info from the model_registry and set it in the model instance.

Moved the model retrieval logic to a classmethod of the Model class because it was getting cumbersome to repeat this exact same logic in all actor implementations.

Other changes:

Add the model.eval() call in all actor impl, after model retrieval, for consistency across actor implementations.