How models and networks work in RL Games
masterIn RL Games, there is a distinction between the Network (the actual neural architecture) and the Model (the wrapper that manages the network and its logic). Understanding this hierarchy is key to customizing architectures:
- Network Builder (
NetworkBuilder): Found inalgos_torch.network_builder(e.g.,A2CBuilder,SACBuilder). It contains a nestedNetworkclass (derived fromtorch.nn.Module) which implements theforwardfunction. This nested class takes a dictionary of tensors (like observations) and returns a tuple of tensors. - Model (
BaseModel): Found inalgos_torch.models(e.g.,ModelA2C,ModelSACContinuous). A Model contains the nestedNetworkclass and abuildfunction to instantiate it. - Algorithm usage: In standard agent/player algorithms,
self.modelrefers to the instance of the model network class, whileself.networkrefers to the instance of the model class. - Model Builder (
ModelBuilder): Located inalgos_torch.model_builder, this class manages loading models via theloadfunction based on a specified name.