Skip to main content

Contrastive RL

Project description

contrastive-rl (wip)

For following a new line of research that started in 2022 from Eysenbach et al.

install

$ pip install contrastive-rl-pytorch

usage

from contrastive_rl.contrastive_rl import ContrastiveRLTrainer
from x_mlps_pytorch import MLP

encoder = MLP(16, 256, 128)

trainer = ContrastiveRLTrainer(encoder)

trajectories = torch.randn(256, 512, 16)

trainer(trajectories, 100)

# train for 100 steps and save

torch.save(encoder.state_dict(), './trained.pt')

citations

@misc{eysenbach2023contrastivelearninggoalconditionedreinforcement,
    title   = {Contrastive Learning as Goal-Conditioned Reinforcement Learning}, 
    author  = {Benjamin Eysenbach and Tianjun Zhang and Ruslan Salakhutdinov and Sergey Levine},
    year    = {2023},
    eprint  = {2206.07568},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2206.07568}, 
}
@misc{ziarko2025contrastiverepresentationstemporalreasoning,
    title   = {Contrastive Representations for Temporal Reasoning}, 
    author  = {Alicja Ziarko and Michal Bortkiewicz and Michal Zawalski and Benjamin Eysenbach and Piotr Milos},
    year    = {2025},
    eprint  = {2508.13113},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2508.13113}, 
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contrastive_rl_pytorch-0.0.2.tar.gz (370.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contrastive_rl_pytorch-0.0.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file contrastive_rl_pytorch-0.0.2.tar.gz.

File metadata

  • Download URL: contrastive_rl_pytorch-0.0.2.tar.gz
  • Upload date:
  • Size: 370.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for contrastive_rl_pytorch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5a466de6bbfc0d86b1f83fe0c61a2cf0eebcf31ff1043f79802dc53eb2620d08
MD5 1dce12984827de6cb44435c0d1fcdc35
BLAKE2b-256 8c4087fe9b35773898b8cab1aec2132a99c678ba6c934af2e2c144f89e3b2b31

See more details on using hashes here.

File details

Details for the file contrastive_rl_pytorch-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for contrastive_rl_pytorch-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8cbb5eb51384f4b8f558b474e9e1ba70b0c664d098f697b28c5981c8e67de0c8
MD5 71d8cd2923136f8ac075e5473a7ff824
BLAKE2b-256 d788cfda0aa3da932b7237fd1cdb6f94f669281fc6209ada77d78779eb883098

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page