Repository URL to install this package:
|
Version:
0.0.26 ▾
|
torch-wrapper
/
aim.py
|
|---|
"""Modifies Aim's built-in logger ``aim.Run``"""
import string
import secrets
from datetime import datetime
from aim import Run as _BaseRun
from aim import Repo
from typing import Optional, Union
def generate_run_hash():
today = datetime.today()
# time = today.strftime('%m%d%H%M%S')
time = today.strftime('%m%d%H%M')
# rand = ''.join(secrets.choice(string.ascii_uppercase) for _ in range(6))
rand = secrets.token_hex(4)
return time + rand
class Run(_BaseRun):
def __init__(self, run_hash: Optional[str] = None, repo: Optional[Union[str, 'Repo']] = None, **run_kwargs):
"""
Parameters
----------
run_hash : hash for this run
repo
run_kwargs : other keyword arguments for ``aim.Run``.
"""
if run_hash is None:
run_hash = generate_run_hash()
super(Run, self).__init__(run_hash=run_hash, repo=repo, **run_kwargs)