PathmindAI / nativerl

Train reinforcement learning agents using AnyLogic or Python-based simulations
Apache License 2.0
19 stars 4 forks source link

Pathmind Sim fails to train missing `get_metrics` #453

Closed slinlee closed 2 years ago

slinlee commented 2 years ago

Error for missing get_metrics

  File "/app/work/pathmind_training/callbacks.py", line 44, in on_episode_end
    metrics = worker.env.getMetrics().tolist()
  File "/app/work/pathmind_training/environments.py", line 335, in getMetrics
    return np.array(self.nativeEnv.getMetrics(0))
  File "/app/work/pathmind_training/environments.py", line 445, in getMetrics
    if self.simulation.get_metrics(agent_id):
AttributeError: 'MouseAndCheese' object has no attribute 'get_metrics'

https://github.com/PathmindAI/pathmind-api/issues/10#issuecomment-948370448

I'll be looking at this in the morning, but I'm tagging @maxpumperla incase he has time to look at it.

You can test it from the dev webapp, which has observations for Pathmind simulations now: webapp: https://dev.devpathmind.com

api: https://api.dev.devpathmind.com

slinlee commented 2 years ago

Should be fixed with #450 . I'll close after testing.

maxpumperla commented 2 years ago

@slinlee yeah, exactly. Sorry, but we kinda had to break something and this was the easiest way to straighten up the API.

A workaround is to use pathmind==0.1 of course. With more time we could have deprecated get_metrics gracefully, e.g. by checking if hasattr(simulation, "get_metrics") etc. But since we have to fix this anyway, let's just go ahead and merge #450 whenever you think we're good to go there.

slinlee commented 2 years ago

fixed with #450