Comments (4)
Hey @eltonjohnfanboy! Sorry for late response and thanks for opening the issue. There's an issue in our callback, I'll make sure to include the fix in the upcoming release. In the meantime you can use the following script as a workaround to track the metrics:
from typing import Any, Dict, Tuple, Union
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 stable_baselines3.common.logger import HumanOutputFormat, KVWriter, Logger
from aim import Run
import numpy as np
class AimOutputFormat(KVWriter):
"""
Track key/value pairs into Aim run.
"""
def __init__(
self,
aim_run
):
self.aim_run = aim_run
def write(
self,
key_values: Dict[str, Any],
key_excluded: Dict[str, Union[str, Tuple[str, ...]]],
step: int = 0,
) -> None:
for (key, value), (_, excluded) in zip(
sorted(key_values.items()), sorted(key_excluded.items())
):
if excluded is not None and 'aim' in excluded:
continue
if isinstance(value, np.ScalarType):
if not isinstance(value, str):
tag, key = key.split('/')
if tag in ['train', 'valid']:
context = {'subset': tag}
else:
context = {'tag': tag}
self.aim_run.track(value, key, step=step, context=context)
run = Run()
loggers = Logger(
folder=None,
output_formats=[AimOutputFormat(run)],
)
environment_name = 'CartPole-v1'
env = gymnasium.make(environment_name)
env = DummyVecEnv([lambda: env])
model = PPO('MlpPolicy', env, verbose = 1)
model.set_logger(loggers)
model.learn(total_timesteps=10_000)
from aim.
Hi @mihran113, no worries at all. Thanks a lot for your work and the update! Looking forward to the upcoming release and will be using the script in the meantime. :))
from aim.
Hey @eltonjohnfanboy! The new version of aim
has been shipped (3.23.0
) which includes the fix for this issue. Please let me know if everything works as expected so I can close the issue.
from aim.
Hi @mihran113, sorry for the delayed response. Thanks for the update; it works correctly now! :))
from aim.
Related Issues (20)
- Securing Aim Remote Tracking server using SSL key and certificate HOT 4
- Aim tensorboard tracker stop logging metrics after certain number of epochs HOT 2
- AIM Client Process Termination Leaves Run in Active State HOT 3
- How is run status handled? HOT 1
- --no Option for Aim Init, Do not Clear Existing Repo if it Exists HOT 3
- Installation Issue [begineer] HOT 2
- Export svg and other formtas in parallel coordinates plot of PARAMS HOT 1
- RuntimeError: dictionary keys changed during iteration HOT 1
- Discard Aim run when exception is raised HOT 2
- Importing jax causes exception that is ignored HOT 2
- Tracking simple metrics in remote server is really slow HOT 4
- Add Relative Time To Table View in Metrics Panel
- Show All Columns in the Manage Columns Popover
- How do you get the git commit hash from a run when queried from a repository? HOT 2
- docs for `up` and `server` are mis-formatted
- Difficulty Managing Dependencies in React Projects
- TypeError raised when accessing run.active after calling run.close() HOT 1
- Accessing remote tracking server since move to http based transport server HOT 1
- Typo: `errorsRocksIOError` vs `errors.RocksIOError` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aim.