unilab.algos.torch.hora

class unilab.algos.torch.hora.HoraActorModel[source]

Bases: Module

Parameters:
is_recurrent: bool = False
__init__(obs, obs_groups, obs_set, output_dim, *, shared_model=None, hidden_dims=(512, 256, 128), activation='elu', obs_normalization=False, distribution_cfg=None, priv_info_dim=None, priv_info_embed_dim=8, priv_mlp_hidden_dims=(256, 128, 8), use_student_encoder=False, proprio_hist_len=30, proprio_frame_dim=None)[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Parameters:
forward(obs, masks=None, hidden_state=None, stochastic_output=False)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:
Return type:

Tensor

reset(dones=None, hidden_state=None)[source]
Parameters:

dones (Tensor | None)

Return type:

None

get_hidden_state()[source]
detach_hidden_state(dones=None)[source]
Parameters:

dones (Tensor | None)

Return type:

None

property distribution: rsl_rl.modules.GaussianDistribution
property output_mean: Tensor
property output_std: Tensor
property output_entropy: Tensor
property output_distribution_params: tuple[Tensor, ...]
get_output_log_prob(outputs)[source]
Parameters:

outputs (Tensor)

Return type:

Tensor

get_kl_divergence(old_params, new_params)[source]
Parameters:
Return type:

Tensor

update_normalization(obs)[source]
Parameters:

obs (TensorDict)

Return type:

None

as_jit()[source]
Return type:

Module

as_onnx(verbose)[source]
Parameters:

verbose (bool)

Return type:

Module

class unilab.algos.torch.hora.HoraCriticModel[source]

Bases: Module

Parameters:
is_recurrent: bool = False
__init__(obs, obs_groups, obs_set, output_dim, *, shared_model=None, hidden_dims=(512, 256, 128), activation='elu', obs_normalization=False, priv_info_dim=None, priv_info_embed_dim=8, priv_mlp_hidden_dims=(256, 128, 8))[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Parameters:
forward(obs, masks=None, hidden_state=None, stochastic_output=False)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:
Return type:

Tensor

reset(dones=None, hidden_state=None)[source]
Parameters:

dones (Tensor | None)

Return type:

None

get_hidden_state()[source]
detach_hidden_state(dones=None)[source]
Parameters:

dones (Tensor | None)

Return type:

None

update_normalization(obs)[source]
Parameters:

obs (TensorDict)

Return type:

None

class unilab.algos.torch.hora.HoraDistillationTrainer[source]

Bases: object

Stage-2 HORA latent distillation trainer.

Parameters:
  • cfg (DictConfig)

  • device (str)

  • log_dir (str | Path)

  • teacher_checkpoint (str | Path)

  • teacher_algo_family (str)

  • teacher_metadata (dict[str, Any] | None)

  • distill_runtime_cfg (DictConfig)

__init__(env, cfg, *, device, log_dir, teacher_checkpoint, teacher_algo_family, teacher_metadata=None, distill_runtime_cfg, logger)[source]
Parameters:
  • cfg (DictConfig)

  • device (str)

  • log_dir (str | Path)

  • teacher_checkpoint (str | Path)

  • teacher_algo_family (str)

  • teacher_metadata (dict[str, Any] | None)

  • distill_runtime_cfg (DictConfig)

train()[source]
Return type:

None

save(path)[source]
Parameters:

path (str | Path)

Return type:

None

class unilab.algos.torch.hora.HoraPPO[source]

Bases: FinalObservationAwarePPO

PPO variant that constructs a shared HORA actor-critic backbone.

Parameters:
__init__(actor, critic, storage, num_learning_epochs=5, num_mini_batches=4, clip_param=0.2, gamma=0.99, lam=0.95, value_loss_coef=1.0, entropy_coef=0.01, learning_rate=0.001, max_grad_norm=1.0, optimizer='adam', use_clipped_value_loss=True, schedule='adaptive', desired_kl=0.01, normalize_advantage_per_mini_batch=False, device='cpu', rnd_cfg=None, symmetry_cfg=None, multi_gpu_cfg=None, enable_compile=False)[source]
Parameters:
static construct_algorithm(obs, env, cfg, device)[source]
Parameters:
  • obs (TensorDict)

  • env (VecEnv)

  • cfg (dict)

  • device (str)

Return type:

PPO

process_env_step(obs, rewards, dones, extras)[source]
Parameters:
Return type:

None

class unilab.algos.torch.hora.HoraSharedActorCritic[source]

Bases: Module

Shared-backbone HORA actor-critic with optional adaptation encoder.

Parameters:
__init__(obs_dim, action_dim, *, priv_info_dim, priv_info_embed_dim=8, actor_hidden_dims=(512, 256, 128), priv_mlp_hidden_dims=(256, 128, 8), activation='elu', obs_normalization=False, distribution_cfg=None, use_student_encoder=False, proprio_hist_len=30, proprio_frame_dim=None)[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Parameters:
update_normalization(obs)[source]
Parameters:

obs (TensorDict)

Return type:

None

encode_privileged_info(priv_info)[source]
Parameters:

priv_info (Tensor | None)

Return type:

Tensor

encode_proprio_history(proprio_hist)[source]
Parameters:

proprio_hist (Tensor)

Return type:

Tensor

build_core_output(obs, *, prefer_student)[source]
Parameters:
  • obs (TensorDict)

  • prefer_student (bool)

Return type:

HoraCoreOutput

trunk_latent_from_tensors(actor_obs, priv_info, *, prefer_student, proprio_hist=None)[source]

Tensor-only HORA trunk path used by APPO compiled minibatch loss.

Parameters:
Return type:

Tensor

policy_mean_from_tensors(actor_obs, priv_info, *, prefer_student, proprio_hist=None)[source]
Parameters:
Return type:

Tensor

value_from_tensors(actor_obs, priv_info, *, prefer_student, proprio_hist=None)[source]
Parameters:
Return type:

Tensor

policy_mean(obs, *, prefer_student)[source]
Parameters:
  • obs (TensorDict)

  • prefer_student (bool)

Return type:

tuple[Tensor, HoraCoreOutput]

value(obs, *, prefer_student)[source]
Parameters:
  • obs (TensorDict)

  • prefer_student (bool)

Return type:

tuple[Tensor, HoraCoreOutput]

Modules

appo

HORA-owned APPO entry helpers.

appo_learner

HORA-owned APPO learner with grouped actor and privileged observations.

appo_runner

HORA-owned APPO runner.

appo_worker

HORA-owned APPO rollout worker.

distill

distill_config

HORA distillation config and teacher-owner resolution helpers.

models

observations

HORA-owned observation helpers for teacher-policy runtime code.

ppo

rsl_rl

HORA-owned RSL-RL wrapper helpers for teacher-policy runtime.

rsl_rl_compat

Compatibility helpers for HORA's supported RSL-RL config schemas.

runtime

Config-driven runtime selection helpers for HORA teacher-policy RL.

sac

HORA-owned SAC entry helpers.

sac_learner

HORA-owned FastSAC learner.

sac_models

HORA SAC actor models.