Implementation:Isaac sim IsaacGymEnvs ModelAMPContinuous
| Knowledge Sources | |
|---|---|
| Domains | Reinforcement_Learning, Motion_Imitation |
| Last Updated | 2026-02-15 11:00 GMT |
Overview
ModelAMPContinuous is a model class that extends the standard A2C continuous-action model to incorporate Adversarial Motion Priors (AMP) discriminator evaluation during the forward pass, enabling style-guided reinforcement learning for physics-based character animation.
Description
The ModelAMPContinuous class inherits from ModelA2CContinuousLogStd provided by the rl_games library. It serves as the top-level model wrapper for AMP-based training, overriding the build method to construct the underlying AMP network using the registered network builder. During building, it configures observation shape, value normalization, input normalization, and value size from the provided config dictionary.
The critical functionality resides in the inner Network class, which extends ModelA2CContinuousLogStd.Network. During the forward pass, when the model is in training mode (is_train=True), the Network evaluates the discriminator on three distinct sets of AMP observations: the current agent observations (amp_obs), replayed agent observations from a replay buffer (amp_obs_replay), and demonstration observations (amp_obs_demo). These discriminator logits are stored in the result dictionary under the keys disc_agent_logit, disc_agent_replay_logit, and disc_demo_logit, respectively.
This three-way discriminator evaluation is essential for the AMP training algorithm, which uses the discriminator to provide a style reward signal. The discriminator learns to distinguish between agent-generated motions and reference demonstration motions, and the resulting logits drive the style reward that encourages the agent to produce naturalistic movement.
Usage
Use ModelAMPContinuous when training AMP-based agents that require discriminator-augmented forward passes. It is registered as the model for AMP tasks (such as HumanoidAMP) and is instantiated automatically by the rl_games framework based on the training configuration. You would not typically instantiate this class directly; instead, it is referenced in the YAML training configuration under the model name.
Code Reference
Source Location
- Repository: IsaacGymEnvs
- File: isaacgymenvs/learning/amp_models.py
- Lines: 33-74
Signature
class ModelAMPContinuous(ModelA2CContinuousLogStd):
def __init__(self, network):
def build(self, config):
class Network(ModelA2CContinuousLogStd.Network):
def __init__(self, a2c_network, **kwargs):
def forward(self, input_dict):
Import
from isaacgymenvs.learning.amp_models import ModelAMPContinuous
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| network | NetworkBuilder | Yes | The network builder instance used to construct the underlying AMP network |
| config | dict | Yes | Configuration dictionary passed to build() containing input_shape, normalize_value, normalize_input, and value_size
|
| input_dict | dict | Yes | Forward pass input containing obs, is_train, amp_obs, amp_obs_replay, and amp_obs_demo tensors |
Outputs
| Name | Type | Description |
|---|---|---|
| result | dict | Dictionary from parent A2C forward pass, augmented with disc_agent_logit, disc_agent_replay_logit, and disc_demo_logit during training |
Usage Examples
# ModelAMPContinuous is typically registered with rl_games and instantiated via config.
# Manual usage example:
from isaacgymenvs.learning.amp_models import ModelAMPContinuous
from isaacgymenvs.learning.amp_network_builder import AMPBuilder
# Create the network builder
network_builder = AMPBuilder()
network_builder.load(network_params)
# Create the model with the builder
model = ModelAMPContinuous(network_builder)
# Build the network with a config dict
config = {
'input_shape': (obs_size,),
'normalize_value': True,
'normalize_input': True,
'value_size': 1,
}
network = model.build(config)
# During training forward pass
input_dict = {
'is_train': True,
'obs': obs_tensor,
'amp_obs': amp_obs_tensor,
'amp_obs_replay': amp_obs_replay_tensor,
'amp_obs_demo': amp_demo_tensor,
}
result = network(input_dict)
disc_agent_logit = result['disc_agent_logit']
disc_demo_logit = result['disc_demo_logit']
Related Pages
- Isaac_sim_IsaacGymEnvs_AMPBuilder - The network builder that constructs the discriminator MLP used by this model
- Isaac_sim_IsaacGymEnvs_ReplayBuffer - Stores AMP observation data used for replay discriminator evaluation