--- tags: - ML-Agents-SnowballTarget - ppo - deep-reinforcement-learning - reinforcement-learning - ml-agents model-index: - name: PPO results: - task: type: reinforcement-learning name: reinforcement-learning dataset: name: ML-Agents-SnowballTarget type: ML-Agents-SnowballTarget metrics: - type: mean_reward value: 26.02 +/- 2.14 name: mean_reward verified: false --- # **PPO** Agent playing **ML-Agents-SnowballTarget** This is a trained model of a **PPO** agent playing **ML-Agents-SnowballTarget** using Unity ML-Agents. ## Usage Download model and play it: ```python from mlagents_envs.environment import UnityEnvironment from mlagents_envs.base_env import ActionTuple import numpy as np # Load the environment env = UnityEnvironment(file_name="path/to/SnowballTarget") # Reset the environment env.reset() behavior_names = list(env.behavior_specs) spec = env.behavior_specs[behavior_names[0]] # Load your trained model # (You'll need to implement model loading based on your training framework) # Run the environment decision_steps, terminal_steps = env.get_steps(behavior_names[0]) while True: # Get observations obs = decision_steps.obs[0] # Get action from your model # action = your_model.predict(obs) # Step the environment action_tuple = ActionTuple(discrete=np.array([[action]])) env.set_actions(behavior_names[0], action_tuple) env.step() decision_steps, terminal_steps = env.get_steps(behavior_names[0]) if len(terminal_steps) > 0: break env.close()