omnirl-framework 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- omnirl_framework-0.1.0/LICENSE +201 -0
- omnirl_framework-0.1.0/PKG-INFO +371 -0
- omnirl_framework-0.1.0/README.md +343 -0
- omnirl_framework-0.1.0/omnirl/__init__.py +1 -0
- omnirl_framework-0.1.0/omnirl/algorithms/__init__.py +1 -0
- omnirl_framework-0.1.0/omnirl/algorithms/a2c/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/a2c/learner.py +319 -0
- omnirl_framework-0.1.0/omnirl/algorithms/a2c/policy.py +100 -0
- omnirl_framework-0.1.0/omnirl/algorithms/c51_dqn/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/c51_dqn/learner.py +276 -0
- omnirl_framework-0.1.0/omnirl/algorithms/c51_dqn/policy.py +94 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ddpg/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ddpg/learner.py +271 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ddpg/policy.py +91 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ddqn/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ddqn/learner.py +231 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ddqn/policy.py +84 -0
- omnirl_framework-0.1.0/omnirl/algorithms/dqn/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/dqn/learner.py +229 -0
- omnirl_framework-0.1.0/omnirl/algorithms/dqn/policy.py +84 -0
- omnirl_framework-0.1.0/omnirl/algorithms/dueling_dqn/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/dueling_dqn/learner.py +231 -0
- omnirl_framework-0.1.0/omnirl/algorithms/dueling_dqn/policy.py +84 -0
- omnirl_framework-0.1.0/omnirl/algorithms/impala/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/impala/learner.py +334 -0
- omnirl_framework-0.1.0/omnirl/algorithms/impala/policy.py +109 -0
- omnirl_framework-0.1.0/omnirl/algorithms/per_dqn/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/per_dqn/learner.py +239 -0
- omnirl_framework-0.1.0/omnirl/algorithms/per_dqn/policy.py +84 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ppo/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ppo/learner.py +377 -0
- omnirl_framework-0.1.0/omnirl/algorithms/ppo/policy.py +109 -0
- omnirl_framework-0.1.0/omnirl/algorithms/qr_dqn/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/qr_dqn/learner.py +253 -0
- omnirl_framework-0.1.0/omnirl/algorithms/qr_dqn/policy.py +88 -0
- omnirl_framework-0.1.0/omnirl/algorithms/sac/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/sac/learner.py +409 -0
- omnirl_framework-0.1.0/omnirl/algorithms/sac/policy.py +114 -0
- omnirl_framework-0.1.0/omnirl/algorithms/td3/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/td3/learner.py +322 -0
- omnirl_framework-0.1.0/omnirl/algorithms/td3/policy.py +91 -0
- omnirl_framework-0.1.0/omnirl/algorithms/tqc/__init__.py +8 -0
- omnirl_framework-0.1.0/omnirl/algorithms/tqc/learner.py +403 -0
- omnirl_framework-0.1.0/omnirl/algorithms/tqc/policy.py +95 -0
- omnirl_framework-0.1.0/omnirl/buffers/__init__.py +7 -0
- omnirl_framework-0.1.0/omnirl/buffers/prioritized_replay_buffer.py +161 -0
- omnirl_framework-0.1.0/omnirl/buffers/replay_buffer.py +116 -0
- omnirl_framework-0.1.0/omnirl/buffers/rollout_buffer.py +146 -0
- omnirl_framework-0.1.0/omnirl/envs/__init__.py +1 -0
- omnirl_framework-0.1.0/omnirl/envs/gymnasium/__init__.py +14 -0
- omnirl_framework-0.1.0/omnirl/envs/gymnasium/adapter.py +38 -0
- omnirl_framework-0.1.0/omnirl/envs/gymnasium/builder.py +16 -0
- omnirl_framework-0.1.0/omnirl/envs/gymnasium/collection.py +54 -0
- omnirl_framework-0.1.0/omnirl/envs/gymnasium/evaluation.py +115 -0
- omnirl_framework-0.1.0/omnirl/envs/gymnasium/spec.py +47 -0
- omnirl_framework-0.1.0/omnirl/envs/vizdoom/__init__.py +14 -0
- omnirl_framework-0.1.0/omnirl/envs/vizdoom/adapter.py +74 -0
- omnirl_framework-0.1.0/omnirl/envs/vizdoom/builder.py +59 -0
- omnirl_framework-0.1.0/omnirl/envs/vizdoom/collection.py +67 -0
- omnirl_framework-0.1.0/omnirl/envs/vizdoom/evaluation.py +121 -0
- omnirl_framework-0.1.0/omnirl/envs/vizdoom/spec.py +21 -0
- omnirl_framework-0.1.0/omnirl/networks/__init__.py +27 -0
- omnirl_framework-0.1.0/omnirl/networks/actors.py +116 -0
- omnirl_framework-0.1.0/omnirl/networks/base/__init__.py +7 -0
- omnirl_framework-0.1.0/omnirl/networks/base/cnn.py +54 -0
- omnirl_framework-0.1.0/omnirl/networks/base/mlp.py +26 -0
- omnirl_framework-0.1.0/omnirl/networks/base/resnet.py +123 -0
- omnirl_framework-0.1.0/omnirl/networks/critics.py +298 -0
- omnirl_framework-0.1.0/omnirl/runtime/__init__.py +7 -0
- omnirl_framework-0.1.0/omnirl/runtime/evaluator.py +57 -0
- omnirl_framework-0.1.0/omnirl/runtime/file_writer.py +83 -0
- omnirl_framework-0.1.0/omnirl/runtime/logger.py +16 -0
- omnirl_framework-0.1.0/omnirl/runtime/runner.py +428 -0
- omnirl_framework-0.1.0/omnirl/runtime/sampler.py +66 -0
- omnirl_framework-0.1.0/omnirl/runtime/weight_store.py +29 -0
- omnirl_framework-0.1.0/omnirl/utils/__init__.py +5 -0
- omnirl_framework-0.1.0/omnirl/utils/seed.py +18 -0
- omnirl_framework-0.1.0/omnirl_framework.egg-info/PKG-INFO +371 -0
- omnirl_framework-0.1.0/omnirl_framework.egg-info/SOURCES.txt +91 -0
- omnirl_framework-0.1.0/omnirl_framework.egg-info/dependency_links.txt +1 -0
- omnirl_framework-0.1.0/omnirl_framework.egg-info/requires.txt +4 -0
- omnirl_framework-0.1.0/omnirl_framework.egg-info/top_level.txt +1 -0
- omnirl_framework-0.1.0/pyproject.toml +44 -0
- omnirl_framework-0.1.0/requirements/base.txt +4 -0
- omnirl_framework-0.1.0/setup.cfg +4 -0
- omnirl_framework-0.1.0/tests/test_gymnasium_env.py +57 -0
- omnirl_framework-0.1.0/tests/test_integration.py +63 -0
- omnirl_framework-0.1.0/tests/test_networks.py +378 -0
- omnirl_framework-0.1.0/tests/test_rlcard_env.py +180 -0
- omnirl_framework-0.1.0/tests/test_runtime.py +361 -0
- omnirl_framework-0.1.0/tests/test_structure.py +202 -0
- omnirl_framework-0.1.0/tests/test_sumo_env.py +355 -0
- omnirl_framework-0.1.0/tests/test_vizdoom.py +321 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omnirl-framework
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A distributed reinforcement learning framework.
|
|
5
|
+
Author-email: Huang Chenbiao <a1057951125@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/MBer123/omnirl
|
|
8
|
+
Project-URL: Repository, https://github.com/MBer123/omnirl
|
|
9
|
+
Project-URL: Issues, https://github.com/MBer123/omnirl/issues
|
|
10
|
+
Keywords: reinforcement-learning,distributed-computing,ray,pytorch
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: <3.13,>=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy<2.6,>=2.2
|
|
24
|
+
Requires-Dist: PyYAML<7,>=6.0
|
|
25
|
+
Requires-Dist: ray<2.57,>=2.54
|
|
26
|
+
Requires-Dist: torch<2.14,>=2.10
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# OmniRL
|
|
30
|
+
|
|
31
|
+
English | [简体中文](README.zh-CN.md)
|
|
32
|
+
|
|
33
|
+
OmniRL is a distributed reinforcement learning framework built on Python, Ray, and PyTorch. It provides a common runtime for asynchronous sampling, replay and rollout storage, distributed learning, versioned weight synchronization, evaluation, logging, and checkpoint recovery. The framework includes 13 value-based and actor-critic algorithms for discrete and continuous control.
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
Environment Collection ──► Samplers ──► Memory ──► Learners ──► WeightStore
|
|
39
|
+
▲ │
|
|
40
|
+
└───────── Algorithm Policy ◄─────────┘
|
|
41
|
+
|
|
42
|
+
Environment Evaluation ◄── Evaluators ◄── Algorithm Policy ◄── WeightStore
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- `omnirl.runtime` orchestrates Ray actors for sampling, learning, evaluation, and versioned weight synchronization.
|
|
46
|
+
- `omnirl.buffers` provides rollout, replay, and prioritized replay storage.
|
|
47
|
+
- `omnirl.algorithms` contains algorithm-specific learners and inference policies.
|
|
48
|
+
- `omnirl.networks` contains reusable network architectures for value-based and actor-critic algorithms.
|
|
49
|
+
- `omnirl.envs` owns environment construction, specifications, collection and evaluation loops, and metric aggregation.
|
|
50
|
+
|
|
51
|
+
Every algorithm package exposes the same `Learner`, `Policy`, and `Memory` interface. The runtime connects these components to the selected environment backend, keeping algorithm and environment implementations independent.
|
|
52
|
+
|
|
53
|
+
## Implemented Algorithms
|
|
54
|
+
|
|
55
|
+
| Algorithm | Family | Action space |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| ✅ [Deep Q-Network (DQN)](https://arxiv.org/abs/1312.5602) | Value-based, off-policy | Discrete |
|
|
58
|
+
| ✅ [Double Deep Q-Network (DDQN)](https://arxiv.org/abs/1509.06461) | Value-based, off-policy | Discrete |
|
|
59
|
+
| ✅ [Dueling Double Deep Q-Network (Dueling DQN)](https://arxiv.org/abs/1511.06581) | Value-based, off-policy | Discrete |
|
|
60
|
+
| ✅ [Prioritized Experience Replay Deep Q-Network (PER-DQN)](https://arxiv.org/abs/1511.05952) | Value-based, off-policy | Discrete |
|
|
61
|
+
| ✅ [Categorical 51-Atom Deep Q-Network (C51)](https://arxiv.org/abs/1707.06887) | Distributional value-based, off-policy | Discrete |
|
|
62
|
+
| ✅ [Quantile Regression Deep Q-Network (QR-DQN)](https://arxiv.org/abs/1710.10044) | Distributional value-based, off-policy | Discrete |
|
|
63
|
+
| ✅ [Advantage Actor-Critic (A2C)](https://arxiv.org/abs/1602.01783) | Actor-critic, on-policy | Discrete / Continuous |
|
|
64
|
+
| ✅ [Proximal Policy Optimization (PPO)](https://arxiv.org/abs/1707.06347) | Actor-critic, on-policy | Discrete / Continuous |
|
|
65
|
+
| ✅ [Importance Weighted Actor-Learner Architectures (IMPALA)](https://arxiv.org/abs/1802.01561) | Actor-critic, off-policy | Discrete / Continuous |
|
|
66
|
+
| ✅ [Deep Deterministic Policy Gradient (DDPG)](https://arxiv.org/abs/1509.02971) | Actor-critic, off-policy | Continuous |
|
|
67
|
+
| ✅ [Twin Delayed Deep Deterministic Policy Gradient (TD3)](https://arxiv.org/abs/1802.09477) | Actor-critic, off-policy | Continuous |
|
|
68
|
+
| ✅ [Soft Actor-Critic (SAC)](https://arxiv.org/abs/1801.01290) | Actor-critic, off-policy | Discrete / Continuous |
|
|
69
|
+
| ✅ [Truncated Quantile Critics (TQC)](https://arxiv.org/abs/2005.04269) | Distributional actor-critic, off-policy | Continuous |
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
OmniRL supports Python 3.10–3.12. Create a virtual environment:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m venv .venv
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Activate it on Windows:
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
.\.venv\Scripts\Activate.ps1
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
On Linux and macOS:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
source .venv/bin/activate
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Install OmniRL and its shared dependencies:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
python -m pip install --upgrade pip
|
|
95
|
+
pip install -e .
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Install the required environment backend:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Gymnasium
|
|
102
|
+
pip install -r requirements/gymnasium.txt
|
|
103
|
+
|
|
104
|
+
# RLCard
|
|
105
|
+
pip install -r requirements/rlcard.txt
|
|
106
|
+
|
|
107
|
+
# SUMO
|
|
108
|
+
pip install -r requirements/sumo.txt
|
|
109
|
+
|
|
110
|
+
# ViZDoom
|
|
111
|
+
pip install -r requirements/vizdoom.txt
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Each backend requirements file includes `base.txt` and can be installed directly in a fresh environment.
|
|
115
|
+
|
|
116
|
+
For GPU training, install the PyTorch build that matches the operating system and CUDA runtime, then verify CUDA availability:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python -c "import torch; print(torch.cuda.is_available())"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Getting Started
|
|
123
|
+
|
|
124
|
+
An OmniRL run uses two YAML files:
|
|
125
|
+
|
|
126
|
+
- The runner configuration defines the environment, Ray worker counts, device, seed, checkpoints, and logging.
|
|
127
|
+
- The agent configuration defines the algorithm module and its learner, memory, policy, and network parameters.
|
|
128
|
+
|
|
129
|
+
Start a single-machine PPO run on `LunarLander-v3`:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python run.py --mode train --runner-config experiments/algorithm_validation/lunar_lander/ppo-0/train.yaml --agent-config experiments/algorithm_validation/lunar_lander/ppo-0/ppo.yaml
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`run.py` connects to an existing Ray cluster when available; otherwise, it starts a local Ray runtime. For multi-node execution, start the head node:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
ray start --head --port=6379
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Join each worker, then launch `run.py` from the head node:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
ray start --address=<head-ip>:6379
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
When `runner.load_checkpoint` is `true`, restarting the same training command resumes from `checkpoint.ckpt` in `runner.ckpt_dir`.
|
|
148
|
+
|
|
149
|
+
### Outputs
|
|
150
|
+
|
|
151
|
+
Each run writes the following artifacts to `runner.ckpt_dir`:
|
|
152
|
+
|
|
153
|
+
- `checkpoint.ckpt`: complete learner and optimizer state for resuming training.
|
|
154
|
+
- `agent_<version>.pth`: exported policy weights.
|
|
155
|
+
- `log.csv`: runtime, evaluation, and learner metrics.
|
|
156
|
+
- `run_config.yaml`: merged runner and algorithm configuration used by the run.
|
|
157
|
+
|
|
158
|
+
## Evaluation
|
|
159
|
+
|
|
160
|
+
Set `runner.ckpt_dir` and `runner.eval_model` in the matching `test.yaml`, then run:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
python run.py --mode test --runner-config experiments/algorithm_validation/lunar_lander/ppo-0/test.yaml --agent-config experiments/algorithm_validation/lunar_lander/ppo-0/ppo.yaml
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The selected environment backend defines the evaluation metrics. The total number of evaluated episodes is `runner.num_evaluators * runner.num_episodes`.
|
|
167
|
+
|
|
168
|
+
When a backend supports interactive rendering, set `env.render_mode` to `human` and `runner.num_evaluators` to `1` in the test configuration.
|
|
169
|
+
|
|
170
|
+
## Adding an Algorithm
|
|
171
|
+
|
|
172
|
+
Create a package under `omnirl/algorithms/<name>/` that exports the shared runtime interface:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from .learner import Learner
|
|
176
|
+
from .policy import Policy
|
|
177
|
+
from omnirl.buffers import ReplayBuffer as Memory
|
|
178
|
+
|
|
179
|
+
__all__ = ["Learner", "Memory", "Policy"]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The implementation should provide:
|
|
183
|
+
|
|
184
|
+
- `Learner`: a Ray actor that implements learning, checkpointing, and versioned weight access. Existing learners can be used as interface examples.
|
|
185
|
+
- `Policy`: a local inference class with deterministic `choose_action` and exploratory `sample_action` methods.
|
|
186
|
+
- `Memory`: one of the buffers in `omnirl.buffers`, or a compatible new Ray actor.
|
|
187
|
+
- Network definitions under `omnirl.networks` when the algorithm needs a new architecture.
|
|
188
|
+
- An agent YAML whose `agent.module` points to `omnirl.algorithms.<name>` and whose `modules` section supplies the constructor parameters.
|
|
189
|
+
|
|
190
|
+
The environment backend and distributed runtime do not need to be changed. Add module-interface and learner-update tests before adding the algorithm to the table above.
|
|
191
|
+
|
|
192
|
+
## Adding an Environment Backend
|
|
193
|
+
|
|
194
|
+
Create a package under `omnirl/envs/<name>/` that exports:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
EnvAdapter
|
|
198
|
+
build_env
|
|
199
|
+
get_env_spec
|
|
200
|
+
CollectionLoop
|
|
201
|
+
EvaluationLoop
|
|
202
|
+
aggregate_evaluations
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`get_env_spec` describes observation shape and dtype, action dimensions and bounds, and default evaluation metrics. `CollectionLoop` turns policy decisions into rollout data, while `EvaluationLoop` and `aggregate_evaluations` produce environment-specific metrics.
|
|
206
|
+
|
|
207
|
+
Set the backend module in a runner configuration:
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
env:
|
|
211
|
+
module: omnirl.envs.gymnasium
|
|
212
|
+
id: CartPole-v1
|
|
213
|
+
render_mode: null
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`module` selects the backend; the remaining `env` mapping is passed through unchanged.
|
|
217
|
+
|
|
218
|
+
Algorithms and runtime actors communicate only through this interface, so neither needs backend-specific imports or configuration fields.
|
|
219
|
+
|
|
220
|
+
## Experiments
|
|
221
|
+
|
|
222
|
+
The `experiments` directory contains four reproducible suites:
|
|
223
|
+
|
|
224
|
+
| Suite | Purpose | Runs |
|
|
225
|
+
| --- | --- | ---: |
|
|
226
|
+
| Algorithm validation | Compare all 13 implemented algorithms across discrete and continuous control tasks. | 48 |
|
|
227
|
+
| Sampler scaling | Compare 1, 2, 4, and 8 asynchronous samplers for IMPALA over three seeds. | 12 |
|
|
228
|
+
| Evaluator scaling | Compare 1, 2, 4, and 8 evaluator actors on a fixed SUMO workload over three seeds. | 12 |
|
|
229
|
+
| Environment integration | Validate three non-Gymnasium environment protocols with PPO. | 9 |
|
|
230
|
+
| **Total** | | **81** |
|
|
231
|
+
|
|
232
|
+
Training runs use isolated directories under `results/` and enable checkpoint recovery.
|
|
233
|
+
|
|
234
|
+
### Algorithm validation
|
|
235
|
+
|
|
236
|
+
Every environment/algorithm combination uses seeds 0, 1, and 2:
|
|
237
|
+
|
|
238
|
+
| Environment | Algorithms | Seeds |
|
|
239
|
+
| --- | --- | --- |
|
|
240
|
+
| `LunarLander-v3` | A2C, C51, DDQN, DQN, Dueling DQN, IMPALA, PER-DQN, PPO, QR-DQN | 0, 1, 2 |
|
|
241
|
+
| `BipedalWalker-v3` | A2C, DDPG, IMPALA, PPO, SAC, TD3, TQC | 0, 1, 2 |
|
|
242
|
+
|
|
243
|
+
Rollout-based algorithms use 10 samplers and train for 24,415 updates. Replay-based algorithms use one sampler and a replay ratio of 1; LunarLander runs use a batch size of 128, while BipedalWalker runs use a batch size of 256, and both train for 250,000 updates. Each evaluation aggregates 50 episodes from two evaluator workers.
|
|
244
|
+
|
|
245
|
+
Train and evaluate one run:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
python run.py --mode train --runner-config experiments/algorithm_validation/bipedal_walker/ppo-0/train.yaml --agent-config experiments/algorithm_validation/bipedal_walker/ppo-0/ppo.yaml
|
|
249
|
+
python run.py --mode test --runner-config experiments/algorithm_validation/bipedal_walker/ppo-0/test.yaml --agent-config experiments/algorithm_validation/bipedal_walker/ppo-0/ppo.yaml
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Checkpoints, logs, and merged run configurations are written under `results/algorithm_validation/<environment>/<algorithm>-<seed>`.
|
|
253
|
+
|
|
254
|
+
<p align="center">
|
|
255
|
+
<img src="docs/images/lunar-lander-on-policy.png" alt="LunarLander-v3 on-policy algorithm validation" width="32%">
|
|
256
|
+
<img src="docs/images/lunar-lander-off-policy-1.png" alt="LunarLander-v3 off-policy-1 algorithm validation" width="32%">
|
|
257
|
+
<img src="docs/images/lunar-lander-off-policy-2.png" alt="LunarLander-v3 off-policy-2 algorithm validation" width="32%">
|
|
258
|
+
</p>
|
|
259
|
+
|
|
260
|
+
<p align="center"><em>LunarLander-v3: on-policy (left), off-policy-1 (center), and off-policy-2 (right) algorithm validation.</em></p>
|
|
261
|
+
|
|
262
|
+
<p align="center">
|
|
263
|
+
<img src="docs/images/bipedal-walker-on-policy.png" alt="BipedalWalker-v3 on-policy algorithm validation" width="32%">
|
|
264
|
+
<img src="docs/images/bipedal-walker-off-policy.png" alt="BipedalWalker-v3 off-policy algorithm validation" width="32%">
|
|
265
|
+
</p>
|
|
266
|
+
|
|
267
|
+
<p align="center"><em>BipedalWalker-v3: on-policy (left) and off-policy (right) algorithm validation.</em></p>
|
|
268
|
+
|
|
269
|
+
### Sampler scaling
|
|
270
|
+
|
|
271
|
+
This suite varies only the number of asynchronous IMPALA samplers. The training batch, learner count, environment, and total sample count remain fixed. IMPALA uses V-trace to correct for policy lag between samplers and the learner.
|
|
272
|
+
|
|
273
|
+
| Setting | Value |
|
|
274
|
+
| --- | --- |
|
|
275
|
+
| Algorithm | IMPALA |
|
|
276
|
+
| Environment | `LunarLander-v3` |
|
|
277
|
+
| Learners | 1 GPU learner |
|
|
278
|
+
| Samplers | 1, 2, 4, 8 |
|
|
279
|
+
| Seeds | 0, 1, 2 |
|
|
280
|
+
| Samples per run | 5,120,000 |
|
|
281
|
+
| Evaluation | 25 episodes |
|
|
282
|
+
|
|
283
|
+
Run the `impala-s<samplers>-<seed>` configurations sequentially to avoid resource contention:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
python run.py --mode train --runner-config experiments/sampler_scaling/lunar_lander/impala-s1-0/train.yaml --agent-config experiments/sampler_scaling/lunar_lander/impala-s1-0/impala.yaml
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The figures report the three-seed mean and standard deviation of wall-clock time, speedup relative to one sampler, and return versus wall-clock time.
|
|
290
|
+
|
|
291
|
+
<p align="center">
|
|
292
|
+
<img src="docs/images/impala-sampler-runtime.png" alt="IMPALA sampler runtime on LunarLander-v3" width="32%">
|
|
293
|
+
<img src="docs/images/impala-sampler-speedup.png" alt="IMPALA sampler speedup on LunarLander-v3" width="32%">
|
|
294
|
+
<img src="docs/images/impala-return-time.png" alt="IMPALA return versus wall-clock time on LunarLander-v3" width="32%">
|
|
295
|
+
</p>
|
|
296
|
+
|
|
297
|
+
<p align="center"><em>IMPALA wall-clock time (left), speedup relative to one sampler (center), and return versus wall-clock time (right).</em></p>
|
|
298
|
+
|
|
299
|
+
### Evaluator scaling
|
|
300
|
+
|
|
301
|
+
This suite varies only the number of evaluator actors while keeping the algorithm, trained checkpoint, environment, and total evaluation workload fixed.
|
|
302
|
+
|
|
303
|
+
| Setting | Value |
|
|
304
|
+
| --- | --- |
|
|
305
|
+
| Algorithm | PPO |
|
|
306
|
+
| Environment | SUMO single intersection |
|
|
307
|
+
| Checkpoints | `agent_500.pth` from the matching environment-integration seed |
|
|
308
|
+
| Evaluators | 1, 2, 4, 8 |
|
|
309
|
+
| Seeds | 0, 1, 2 |
|
|
310
|
+
| Episodes per run | 40 |
|
|
311
|
+
| Episodes per evaluator | 40, 20, 10, 5 respectively |
|
|
312
|
+
|
|
313
|
+
Run the `ppo-e<evaluators>-<seed>` configurations sequentially:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
python run.py --mode test --runner-config experiments/evaluator_scaling/sumo/single_intersection/ppo-e1-0/test.yaml --agent-config experiments/evaluator_scaling/sumo/single_intersection/ppo-e1-0/ppo.yaml
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
The configurations reuse the trained checkpoints under `results/environment_integration/sumo/single_intersection/ppo-<seed>`. The figures report the three-seed mean and standard deviation of wall-clock time and speedup relative to one evaluator.
|
|
320
|
+
|
|
321
|
+
<p align="center">
|
|
322
|
+
<img src="docs/images/ppo-evaluator-runtime.png" alt="PPO evaluator runtime on SUMO" width="32%">
|
|
323
|
+
<img src="docs/images/ppo-evaluator-speedup.png" alt="PPO evaluator speedup on SUMO" width="32%">
|
|
324
|
+
</p>
|
|
325
|
+
|
|
326
|
+
<p align="center"><em>SUMO evaluation wall-clock time (left) and paired speedup relative to one evaluator (right).</em></p>
|
|
327
|
+
|
|
328
|
+
### Environment integration
|
|
329
|
+
|
|
330
|
+
Environment backends encapsulate native interaction protocols, episode lifecycle, seeding, rendering, and domain-specific metrics. The runtime and algorithms depend only on the shared environment specification, collection loop, and evaluation interface, allowing the same PPO implementation to run unchanged across all three benchmarks.
|
|
331
|
+
|
|
332
|
+
| Backend | Benchmark | Backend-owned integration | Evaluation metrics | Samples per seed |
|
|
333
|
+
| --- | --- | --- | --- | ---: |
|
|
334
|
+
| `omnirl.envs.sumo` | SUMO single intersection | SUMO-RL/TraCI lifecycle, traffic-signal observations and fixed-horizon trip data | Delay, trip time, waiting time, queue length | 1,024,000 |
|
|
335
|
+
| `omnirl.envs.vizdoom` | ViZDoom Defend the Center | RGB frames, game tics and discrete button combinations | Kills, survival time, shots, shooting precision | 2,048,000 |
|
|
336
|
+
| `omnirl.envs.rlcard` | RLCard Blackjack | Active-player state, legal actions and terminal payoff | Win, draw and loss rates | 1,024,000 |
|
|
337
|
+
|
|
338
|
+
All three benchmarks use PPO with seeds 0, 1, and 2. Each backend reports domain-specific metrics rather than a mandatory generic `return_mean`.
|
|
339
|
+
|
|
340
|
+
Configurations are under `experiments/environment_integration/<backend>/<task>/ppo-<seed>`. Each run writes checkpoints, the merged configuration, and a `log.csv` containing runtime statistics and backend metrics under `results/environment_integration`.
|
|
341
|
+
|
|
342
|
+
The final training-time evaluations provide a compact snapshot of the recorded results:
|
|
343
|
+
|
|
344
|
+
| Benchmark | Training signal shown | Final value across three seeds |
|
|
345
|
+
| --- | --- | ---: |
|
|
346
|
+
| SUMO single intersection | Average waiting time (lower is better) | 39.45 ± 1.13 s |
|
|
347
|
+
| ViZDoom Defend the Center | Average kills per episode (higher is better) | 14.15 ± 1.34 |
|
|
348
|
+
| RLCard Blackjack | Win rate (higher is better) | 42.54% ± 0.21 pp |
|
|
349
|
+
|
|
350
|
+
Values are the mean ± sample standard deviation of the final logged evaluation for seeds 0, 1, and 2. In each plot, the solid line is the mean and the shaded region is one standard deviation.
|
|
351
|
+
|
|
352
|
+
<p align="center">
|
|
353
|
+
<img src="docs/images/sumo.png" alt="PPO training on the SUMO single-intersection environment" width="32%">
|
|
354
|
+
<img src="docs/images/vizdoom.png" alt="PPO training on the ViZDoom Defend the Center environment" width="32%">
|
|
355
|
+
<img src="docs/images/rlcard.png" alt="PPO training on the RLCard Blackjack environment" width="32%">
|
|
356
|
+
</p>
|
|
357
|
+
|
|
358
|
+
<p align="center"><em>SUMO average waiting time (left), ViZDoom average kills (center), and RLCard win rate (right).</em></p>
|
|
359
|
+
|
|
360
|
+
## Notes
|
|
361
|
+
|
|
362
|
+
- When training on CPU, set `device.learner` to `cpu` and keep `runner.num_learners` at `1`.
|
|
363
|
+
- Size `runner.num_samplers`, `runner.num_evaluators`, and `runner.num_learners` for the available hardware. As a starting point, keep their sum below 90% of the available CPU threads.
|
|
364
|
+
- Run the test suite with `python -m unittest discover -s tests -v`.
|
|
365
|
+
- OmniRL is a research framework. Multi-seed correctness reports and scaling results should be treated as experimental evidence rather than production guarantees.
|
|
366
|
+
|
|
367
|
+
## License
|
|
368
|
+
|
|
369
|
+
Copyright 2026 Huang Chenbiao (MBer123).
|
|
370
|
+
|
|
371
|
+
OmniRL is licensed under the [Apache License 2.0](LICENSE).
|