Skip to main content

selfplay2perfect (wip)

Implementation of Play2Perfect, from Tyler Ga Wei Lum et al. of Stanford, with a Self Play element and AlphaNIST Success-Guided Sampling (SGS).

install

$ pip install selfplay2perfect

usage

import torch
from selfplay2perfect import (
    ActorCritic,
    PointCloudEncoder,
    SAPG,
    SuccessCriteria,
    PickAndPlaceCurriculum,
    MultiAgentMetaConfigSGS,
    make_single_arm,
    make_single_arm_env,
    rollout_single_arm,
    TOOL_TYPES
)

# single-arm 29-dof kuka + sharpa task across 12 tools
# ('hammer', 'screwdriver', 'marker', 'spatula', 'eraser', 'brush', 'pipette', 'mallet', 'wrench', 'chisel', 'scalpel', 'roller')

task = make_single_arm(tool = 'hammer', goal_tier = 0)
obs = task.reset(tool = 'spatula', goal_tier = 1)

# vectorized single-arm real mujoco + sim2real rl environment

env = make_single_arm_env(
    num_envs = 64,
    tool = 'wrench',
    goal_tier = 0,
    use_sim2real = True
)

obs_dict, _ = env.reset()

# alphanist sensory-fused actor-critic + sapg

agent = ActorCritic(
    dim_obs = 46,
    dim_action = 29,
    dim_priv_obs = 8,
    num_blocks = 4,
    scene_encoder = PointCloudEncoder(dim_point = 6, dim_hidden = 128, dim_embed = 96)
)

sapg = SAPG(
    agent,
    num_blocks = 4
)

# binary success criteria + hierarchical sgs curriculum

criteria = SuccessCriteria(
    pos_tolerance = 0.038,
    rot_tolerance = 2.40,
    dwell_steps = 3,
    min_finger_contacts = 2
)

curriculum = PickAndPlaceCurriculum(
    ladder_size = 55,
    native_size = 11,
    hierarchical = True
)

# multi-agent meta-sgs curriculum for adversarial self-play

meta_sgs = MultiAgentMetaConfigSGS()
batch = meta_sgs.sample(batch_size = 32)

train

# single-arm 3d pick-and-place across all 12 tools (or pass --tool=hammer --goal_tier=0)
$ uv run train_pick_place.py

# two-player 3d adversarial snatch-and-place self-play
$ uv run train_adversarial_pick_place.py

# dexterous play pretraining
$ uv run train_play.py

citations

@misc{lum2026play2perfectmattersdexterousplay,
    title   = {Play2Perfect: What Matters in Dexterous Play Pretraining for Precise Assembly?}, 
    author  = {Tyler Ga Wei Lum and Kushal Kedia and C. Karen Liu and Jeannette Bohg},
    year    = {2026},
    eprint  = {2606.26428},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2606.26428}, 
}
@misc{zhang2026alphanistemergentassemblyskills,
    title     = {AlphaNIST: Emergent Assembly Skills from Binary Task Rewards}, 
    author    = {Octi Zhang and Iretiayo Akinola and Rosario Scalise and Mateo Guaman Castro and Patrick Yin and Tobias Widmer and Miles Macklin and Chris Amevor and Dylan Turpin and Dirk Van Gelder and Jan Carius and Ankur Handa and Gavriel State and Yunrong Guo and Yashraj Narang},
    year      = {2026},
    eprint    = {2610.13354},
    archivePrefix = {arXiv},
    primaryClass = {cs.AI},
    url       = {https://arxiv.org/abs/2610.13354}, 
}
@misc{zhang2026omnireset,
    title     = {OmniReset: Success-Guided Sampling for Reinforcement Learning},
    author    = {Octi Zhang and others},
    year      = {2026},
    eprint    = {2610.12465},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url       = {https://arxiv.org/abs/2610.12465},
}
@inproceedings{singla2024sapg,
    title     = {SAPG: Split and Aggregate Policy Gradients},
    author    = {Jayesh Singla and Ananye Agarwal and Deepak Pathak},
    booktitle = {International Conference on Machine Learning (ICML)},
    year      = {2024},
    url       = {https://arxiv.org/abs/2407.20230},
}

Metadata

Release files for selfplay2perfect 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for selfplay2perfect 0.0.3
File Size Uploaded Provenance Actions
selfplay2perfect-0.0.3.tar.gz 78.9 kB Without provenance Details for selfplay2perfect-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for selfplay2perfect 0.0.3
File Interpreter ABI Platform Actions
selfplay2perfect-0.0.3-py3-none-any.whl Python 3 none any Details for selfplay2perfect-0.0.3-py3-none-any.whl

Total release size: 125.0 kB

Release files / selfplay2perfect-0.0.3.tar.gz

Download URL selfplay2perfect-0.0.3.tar.gz
Size 78.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0c998a5d42c1acd5624e9e77b01bab0ddacf24cf2cc1f7a979e323c8def1abd9
BLAKE2b-256 checksum
How to use checksums
7e37529096bf005ba3cf0f1c8e9cc2e1b039ccc3f2ef28f4345f5bbf3cff58f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / selfplay2perfect-0.0.3-py3-none-any.whl

Download URL selfplay2perfect-0.0.3-py3-none-any.whl
Size 46.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5a37181b0ece1ab2cd771d9431041e401ca83e5aaafaabf76971665d30c02a1
BLAKE2b-256 checksum
How to use checksums
30e0a74c35f906cda08f34fc123917431e603d80e1bbc68e55162b8f59560bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Security for selfplay2perfect 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page