- Schola 文档
- API 文档
- 概述
- Python
- Python API 文档
- core
- extensions
- generated
- scripts
- Unreal
- Unreal API 文档
- classes
- AAbstractScholaEnvironment
- AAbstractTrainer
- ABlueprintDynamicScholaEnvironment
- ABlueprintScholaEnvironment
- ABlueprintStaticScholaEnvironment
- ABlueprintTrainer
- ADynamicScholaEnvironment
- AInferenceController
- AInferencePawn
- AStaticScholaEnvironment
- CallData
- ConstPointVisitor
- ExchangeCallData
- ExchangeRPCBackend
- ExchangeRPCWorker
- FScholaModule
- IBinaryActuatorWrapper
- IBinaryObserverWrapper
- IBlueprintBinaryActuatorWrapper
- IBlueprintBinaryObserverWrapper
- IBlueprintBoxActuatorWrapper
- IBlueprintBoxObserverWrapper
- IBlueprintDiscreteActuatorWrapper
- IBlueprintDiscreteObserverWrapper
- IBoxActuatorWrapper
- IBoxObserverWrapper
- IBrainInterface
- IComBackendInterface
- IDiscreteActuatorWrapper
- IDiscreteObserverWrapper
- IExchangeBackendInterface
- IGymConnector
- IInferenceAgent
- IModelInstanceInterface
- IModelInterface
- IPollingBackendInterface
- IProducerBackendInterface
- IRuntimeInterface
- IValidatable
- PointSerializer
- PointVisitor
- PollingRPCBackend
- PollingRPCWorker
- ProducerRPCBackend
- ProducerRPCWorker
- ProtobufSerializer
- RPCBackend
- Singleton
- UAbstractBrain
- UAbstractEnvironmentUtilityComponent
- UAbstractGymConnector
- UAbstractInteractor
- UAbstractNormalizer
- UAbstractObserver
- UAbstractPolicy
- UActionClipper
- UActuator
- UActuatorComponent
- UAgentUIDSubsystem
- UAsyncBrain
- UBTTask_AgentStep
- UBinaryActuator
- UBinaryActuatorWrapper
- UBinaryObserver
- UBinaryObserverWrapper
- UBlueprintBinaryActuator
- UBlueprintBinaryActuatorWrapper
- UBlueprintBinaryObserver
- UBlueprintBinaryObserverWrapper
- UBlueprintBoxActuator
- UBlueprintBoxActuatorWrapper
- UBlueprintBoxObserver
- UBlueprintBoxObserverWrapper
- UBlueprintDiscreteActuator
- UBlueprintDiscreteActuatorWrapper
- UBlueprintDiscreteObserver
- UBlueprintDiscreteObserverWrapper
- UBlueprintEnvironmentUtilityComponent
- UBlueprintPolicy
- UBoxActuator
- UBoxActuatorWrapper
- UBoxObserver
- UBoxObserverWrapper
- UBrainInterface
- UCPUModelWrapper
- UCPURuntimeWrapper
- UCameraObserver
- UCommunicationManager
- UDebugBinaryActuator
- UDebugBinaryObserver
- UDebugBoxActuator
- UDebugBoxObserver
- UDebugDiscreteActuator
- UDebugDiscreteObserver
- UDiscreteActuator
- UDiscreteActuatorWrapper
- UDiscreteBrain
- UDiscreteObserver
- UDiscreteObserverWrapper
- UEventObserver
- UExternalGymConnector
- UFrameStacker
- UGPUModelWrapper
- UGPURuntimeWrapper
- UGymConnector
- UHardNormalizer
- UInferenceAgent
- UInferenceComponent
- UInferencePolicy
- UInteractionComponent
- UInteractionManager
- UModelInstanceWrapper
- UMovementInputActuator
- UObservationClipper
- UPositionObserver
- UPythonGymConnector
- URayCastObserver
- URotationActuator
- URotationObserver
- UScholaManagerSubsystem
- UScholaManagerSubsystemSettings
- USensor
- UStatLoggerComponent
- USynchronousBrain
- UTeleportActuator
- UValidatable
- UVelocityObserver
- structs
- FActTickFunction
- FAction
- FAgentId
- FBinaryPoint
- FBinarySpace
- FBoxPoint
- FBoxSpace
- FBoxSpaceDimension
- FCommunicatorSettings
- FCustomTrainingSettings
- FDictPoint
- FDictSpace
- FDiscretePoint
- FDiscreteSpace
- FDynamicAgentStruct
- FEnvReset
- FEnvStep
- FEnvUpdate
- FEnvironmentDefinition
- FGenericTensorBinding
- FInferencePolicyBuffer
- FInteractionDefinition
- FLaunchableScript
- FPoint
- FPolicyDecision
- FRLlibAPPOSettings
- FRLlibCheckpointSettings
- FRLlibIMPALASettings
- FRLlibLoggingSettings
- FRLlibNetworkArchSettings
- FRLlibPPOSettings
- FRLlibResourceSettings
- FRLlibResumeSettings
- FRLlibTrainingSettings
- FSB3CheckpointSettings
- FSB3LoggingSettings
- FSB3NetworkArchSettings
- FSB3PPOSettings
- FSB3ResumeSettings
- FSB3SACSettings
- FSB3TrainingSettings
- FScriptArgBuilder
- FScriptSettings
- FSharedEnvironmentDefinition
- FSharedEnvironmentState
- FSharedTrainingDefinition
- FSpace
- FStartRequest
- FThinkTickFunction
- FTrainerAgentPair
- FTrainerConfiguration
- FTrainerDefinition
- FTrainerState
- FTrainingDefinition
- FTrainingSettings
- FTrainingState
- FTrainingStateUpdate
- FValidationResult
设置推理
本指南将解释如何在推理模式下使用您训练好的 RL 代理(即无需连接到 Python)。
将 Checkpoint 转换为 Onnx
如果您在训练期间未导出为 Onnx,则需要将 Checkpoint 转换为 Onnx。您可以使用以下脚本从 Checkpoint 创建 Onnx 模型。
python -m ./Resources/python/scripts/sb3/sb3-to-onnx.py --model-path <CHECKPOINT_PATH> --output-path <ONNX_PATH>python -m ./Resources/python/scripts/sb3/rllib-to-onnx.py --policy-checkpoint-path <CHECKPOINT_PATH> --output-path <ONNX_PATH>这些命令将创建一个标准化格式的 Onnx 模型,该格式与 Schola 兼容,可在下一节中使用。
将 Onnx 模型加载到 Unreal Engine
拥有 Onnx 模型后,您可以通过将 .onnx 文件拖放到内容浏览器中来将其导入 Unreal Engine。这将在您的项目中创建一个新的 Onnx 模型数据资源。
创建推理代理
在 Schola 中,推理代理是任何实现 Agent Interface 的对象。但是,我们也提供三个默认实现来帮助用户入门:InferenceComponent、InferencePawn 和 InferenceController。请按照以下说明准备一个 actor 或 pawn,以由您训练好的策略进行控制。
要使用推理组件,请将 UInferenceComponent 添加到您希望由训练好的策略控制的任何 actor 中。
要使用推理 Pawn,请创建一个继承自 AInferencePawn 的新 Pawn。这将创建一个可以由训练好的策略控制的 pawn。
要使用推理控制器,请创建一个 AInferenceController 的子类,并将您想要控制的 pawn 的控制器设置为您的新类。
创建推理代理后,转到详细信息面板的强化学习(Reinforcement Learning)选项卡,并将策略(Policy)下的 Onnx 模型(Onnx model)属性设置为导入 Onnx 模型到 Unreal 时创建的数据资源。