{"id":20373509,"url":"https://github.com/megengine/megrl","last_synced_at":"2026-04-20T06:32:04.902Z","repository":{"id":194215374,"uuid":"659099465","full_name":"MegEngine/MegRL","owner":"MegEngine","description":"A MegEngine implementation of 6 RL algorithms","archived":false,"fork":false,"pushed_at":"2023-06-27T11:22:43.000Z","size":174,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-15T06:50:32.013Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MegEngine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-27T06:23:11.000Z","updated_at":"2023-08-05T11:00:38.000Z","dependencies_parsed_at":"2023-09-12T10:55:25.105Z","dependency_job_id":null,"html_url":"https://github.com/MegEngine/MegRL","commit_stats":null,"previous_names":["megengine/megrl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegRL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegRL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegRL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegEngine%2FMegRL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MegEngine","download_url":"https://codeload.github.com/MegEngine/MegRL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241921824,"owners_count":20042763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T01:18:45.335Z","updated_at":"2026-04-20T06:31:59.868Z","avatar_url":"https://github.com/MegEngine.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MegRL\n\n## Introduction\n\nThis is an implementation of 6 classic RL algorithms in MegEngine. The algorithms include DQN, DDPG, PG, A2C, SAC(continuous), and SAC(discrete). These algorithms can be run in the Classic Control, Atari, and MuJoCo environments in [Gymnasium](https://gymnasium.farama.org/).\n\n## Environment\n\nBefore running the code, please install basecls[all], envpool, portalocker, h5py, numba, matplotlib, gymnasium[classic-control], gymnasium[atari], gymnasium[mujoco], AutoROM. And run:\n\n```sh\nAutoROM --accept-license \n```\n\n\n\nSee requirement.txt for the full environment.\n\n## Training\n\nYou can run \"python baserl/tools/train.py\" to train a certain RL model on a given task, e.g.\n\n```shell\npython baserl/tools/train.py -task Classic/CartPole-v1 -alg DQN -save the_name_of_log_directory --seed 1\n```\n\n\n\nWe offer many examples in the \"scripts\" directory. You can simply run\n\n```sh\nsh scripts/train_[algname]_[taskname].sh\n```\n\nto apply the algorithm \"algname\" to the task \"taskname\".\n\n\n\nYou can modify baserl/configs/[tasktype]\\_[algname]\\_cfg.py to set the hyperparameters, training scheme, log path and etc.\n\n## Evaluation\n\nSimilar to training, you can run \"python baserl/tools/eval.py\" to evaluate a trained RL model on a given task, e.g.\n\n```shell\npython baserl/tools/eval.py -task Atari/Pong -alg DQN -save the_name_of_log_directory --seed 1 --is_atari -load /path/to/the/model/checkpoint\n```\n\n\n\nPlease make sure the setting in baserl/configs/[tasktype]\\_[algname]\\_cfg.py is compatible to the trained model to be evaluated.\n\n## Acknowledgement\n\nThe code borrows heavily from [Tianshou](https://github.com/thu-ml/tianshou) by [thu-ml](https://github.com/thu-ml), which is an RL platform based on PyTorch.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegengine%2Fmegrl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegengine%2Fmegrl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegengine%2Fmegrl/lists"}