aimhubio / aim

Aim 💫 — An easy-to-use & supercharged open-source experiment tracker.
https://aimstack.io
Apache License 2.0
4.93k stars 297 forks source link

[BUG] Stable-Baselines3 integration not working #3174

Open eltonjohnfanboy opened 4 days ago

eltonjohnfanboy commented 4 days ago

🐛 Bug

Hi there! I've been trying to use AIM to track metrics for Stable-Baselines3 project. I've been trying to use the AimCallback (https://aimstack.readthedocs.io/en/latest/quick_start/integrations.html) with Stable-Baselines3 to monitor logs and metrics as the model learns. However, I've run into an issue where the AIM run isn't tracking any metrics at all. Specifically, I'm interested in tracking metrics such as explained_variance and loss. Despite this, when I check the metrics tab, no metrics are displayed.

Screenshot 2024-06-24 at 13 15 48

To reproduce

import os
import gymnasium
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3.common.evaluation import evaluate_policy
from aim.sb3 import AimCallback

environment_name = 'CartPole-v1'
env = gymnasium.make(environment_name)

env = DummyVecEnv([lambda: env])
model = PPO('MlpPolicy', env, verbose = 1)

model.learn(total_timesteps=10_000, callback=AimCallback(repo='.', experiment_name='example_experiment'))

Am I doing anything wrong? I'm following the steps indicated in AIM documentation, but no metrics are getting tracked (https://aimstack.readthedocs.io/en/latest/quick_start/integrations.html)

Thanks a lot!