unilab.logging

Rich-based training loggers shared across algorithm and training layers.

class unilab.logging.BaseTrainingLogger[source]

Bases: object

Shared lifecycle and backend logging setup for rich training loggers.

Parameters:
__init__(*, algo_name, max_iterations, num_envs, env_name, log_dir, log_backend, wandb_project, wandb_entity, wandb_name, wandb_group, wandb_job_type, wandb_tags, wandb_notes, refresh_per_second=4, tensorboard_subdir='tb', wandb_config=None)[source]
Parameters:
start(*, status='')[source]
Parameters:

status (str)

close()[source]

Release live terminal state and backend handles without printing a summary.

Return type:

None

finish(*, title='Training Summary', extra_summary='')[source]
Parameters:
  • title (str)

  • extra_summary (str)

update_ep_length(length)[source]
Parameters:

length (float)

log_save(path)[source]
Parameters:

path (str)

class unilab.logging.OffPolicyLogger[source]

Bases: BaseTrainingLogger

Rich logger for off-policy RL algorithms (SAC, TD3, etc).

Parameters:
__init__(algo_name='RL', max_iterations=1500, num_envs=4096, env_name='', obs_dim=0, action_dim=0, refresh_per_second=4, log_dir='', log_backend='tensorboard', wandb_project='unilab', wandb_entity=None, wandb_name='', wandb_group=None, wandb_job_type=None, wandb_tags=None, wandb_notes=None)[source]
Parameters:
start(*, status='Warming up...')[source]
Parameters:

status (str)

finish(*, title='Training Summary', extra_summary='')[source]
Parameters:
  • title (str)

  • extra_summary (str)

log_buffer_fill(current, target)[source]
Parameters:
update_collector_timing(timing_ms)[source]
Parameters:

timing_ms (dict[str, float])

update_done_rates(timeout_rate, terminated_rate)[source]
Parameters:
update_buffer_utilization(utilization)[source]
Parameters:

utilization (float)

update_replay_queue(current_len, max_size)[source]
Parameters:
  • current_len (int)

  • max_size (int)

update_staging_pool(current_len, max_size)[source]
Parameters:
  • current_len (int)

  • max_size (int)

set_collection_sync(enabled, env_steps_per_sync=0)[source]
Parameters:
  • enabled (bool)

  • env_steps_per_sync (int)

log_collector(total_steps, buffer_size, mean_reward=0.0)[source]
Parameters:
  • total_steps (int)

  • buffer_size (int)

  • mean_reward (float)

log_step(iteration, metrics=None, reward=None, reward_metrics=None, reward_components=None, train_time=0.0, wait_time=0.0, learner_incremental_h2d_time=0.0, weight_sync_time=0.0, extra_info=None)[source]
Parameters:
log_status(status)[source]
Parameters:

status (str)

class unilab.logging.OnPolicyLogger[source]

Bases: BaseTrainingLogger

Rich logger for on-policy RL (PPO, A2C, etc).

Parameters:
__init__(algo_name='PPO', max_iterations=1500, num_envs=4096, num_steps=24, env_name='', log_dir='', log_backend='tensorboard', wandb_project='unilab', wandb_entity=None, wandb_name='', wandb_group=None, wandb_job_type=None, wandb_tags=None, wandb_notes=None)[source]
Parameters:
start(*, status='')[source]
Parameters:

status (str)

finish(*, title='Training Summary', extra_summary='')[source]
Parameters:
  • title (str)

  • extra_summary (str)

log_step(iteration, metrics=None, reward=None, reward_components=None, collect_time=0.0, train_time=0.0)[source]
Parameters:
class unilab.logging.TraceRecorder[source]

Bases: object

Minimal Chrome trace / Perfetto event recorder.

Parameters:
__init__(process_name, *, pid=None)[source]
Parameters:
register_thread(name, *, tid=None)[source]
Parameters:
Return type:

int

add_slice(name, *, category, start_ns, end_ns, tid=None, args=None)[source]
Parameters:
Return type:

None

span(name, *, category, tid=None, args=None)[source]
Parameters:
add_counter(name, value, *, category, timestamp_ns=None, tid=None, args=None)[source]
Parameters:
Return type:

None

add_cuda_pending_span(name, *, category, cpu_begin_ns, start_event, end_event, args=None, tid=None)[source]
Parameters:
Return type:

None

flush_cuda_pending()[source]
Return type:

None

extend(events)[source]
Parameters:

events (list[dict[str, Any]])

Return type:

None

drain_events()[source]
Return type:

list[dict[str, Any]]

write_json(output_path)[source]
Parameters:

output_path (str | Path)

Return type:

Path

Modules

common

offpolicy

Rich-based training logger for off-policy RL algorithms (SAC, TD3, etc).

onpolicy

trace_event