SuperSuit Documentation

repository·main·Indexed 19 days ago

https://github.com/farama-foundation/supersuit

A collection of microwrappers for preprocessing reinforcement learning environments. SuperSuit supports both Gymnasium (single-agent) and PettingZoo (multi-agent, including AECEnv and ParallelEnv) APIs, providing transformations such as color reduction and frame stacking.

Tokens
680
Snippets
4
Records
5
Agent score
17%

What's inside SuperSuit

  1. What are SuperSuit microwrappers?

    main

    SuperSuit is a collection of small functions called 'microwrappers' designed to preprocess reinforcement learning environments. These wrappers allow for quick transformations such as:

    • Color reduction: Modifying observation color spaces (e.g., converting to grayscale).
    • Frame stacking: Stacking multiple consecutive frames to provide temporal context to the agent.

    SuperSuit is compatible with:

    • Gymnasium: For single-agent environments.
    • PettingZoo: For multi-agent environments (AECEnv and ParallelEnv).

    Note: This project is currently semi-deprecated and is being maintained primarily to ensure compatibility with new versions of PettingZoo until its functionality is merged into pettingzoo.wrappers.

  2. Use SuperSuit with PettingZoo environments

    main

    SuperSuit supports multi-agent environments from PettingZoo, including both AECEnv and ParallelEnv types. You can apply the same microwrappers used for Gymnasium to these environments.

    Example: Applying color reduction and frame stacking to a PettingZoo Pistonball environment:

    from pettingzoo.butterfly import pistonball_v0
    from supersuit import color_reduction_v0, frame_stack_v1
    
    env = pistonball_v0.env()
    
    env = frame_stack_v1(color_reduction_v0(env, 'full'), 4)
  3. Use SuperSuit with Gymnasium environments

    main

    SuperSuit provides 'microwrappers' to preprocess reinforcement learning environments. For single-agent environments using Gymnasium, you can chain wrappers to modify observation spaces or frame stacking.

    Example: Converting Space Invaders to use grayscale observations and stacking the last 4 frames:

    import gymnasium
    from supersuit import color_reduction_v0, frame_stack_v1
    
    env = gymnasium.make('SpaceInvaders-v0')
    
    env = frame_stack_v1(color_reduction_v0(env, 'full'), 4)