Skip to content

Commit c565ef5

Browse files
authored
Merge pull request #52 from OpenRL-Lab/main
update
2 parents 686219d + eb48cda commit c565ef5

File tree

26 files changed

+377
-29
lines changed

26 files changed

+377
-29
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
__pycache__/
2+
logs
3+
.pytest_cache/
4+
.coverage
5+
.coverage.*
6+
.idea/
7+
logs/
8+
.pytype/
9+
htmlcov/
10+
.vscode/
11+
.git/

.github/workflows/style_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: [3.8, 3.9]
15+
python-version: [3.8]
1616

1717
steps:
1818
- uses: actions/checkout@v3

.github/workflows/unit_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: unit_test
22

3-
on: [ push, pull_request ]
3+
on: [ pull_request ]
44

55
jobs:
66
test_unittest:
@@ -9,7 +9,7 @@ jobs:
99
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
1010
strategy:
1111
matrix:
12-
python-version: [ 3.8, 3.9 ]
12+
python-version: [ 3.8 ]
1313

1414
steps:
1515
- uses: actions/checkout@v3

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@ format:
2222
# Reformat using black
2323
black ${PYTHON_FILES} --preview
2424

25-
commit-checks: format lint
25+
commit-checks: format lint
26+
27+
docker-cpu:
28+
./scripts/build_docker.sh
29+
30+
docker-gpu:
31+
USE_GPU=True ./scripts/build_docker.sh

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
OpenRL-v0.0.8 is updated on May 4, 2023
3030

31+
The main branch is the latest version of OpenRL, which is under active development. If you just want to have a try with OpenRL, you can switch to the stable branch.
32+
3133
## 欢迎来到OpenRL
3234

3335
[English](./README_en.md) | [中文文档](https://openrl-docs.readthedocs.io/zh/latest/) | [Documentation](https://openrl-docs.readthedocs.io/en/latest/)
@@ -58,12 +60,14 @@ OpenRL-Lab将持续维护和更新OpenRL,欢迎大家加入我们的[开源社
5860
- [欢迎来到OpenRL](#欢迎来到openrl)
5961
- [目录](#目录)
6062
- [安装](#安装)
63+
- [使用Docker](#使用docker)
6164
- [快速上手](#快速上手)
6265
- [Gallery](#Gallery)
6366
- [使用OpenRL的项目](#使用OpenRL的项目)
6467
- [反馈和贡献](#反馈和贡献)
6568
- [维护人员](#维护人员)
6669
- [支持者](#支持者)
70+
- [↳ Contributors](#-contributors)
6771
- [↳ Stargazers](#-stargazers)
6872
- [↳ Forkers](#-forkers)
6973
- [Citing OpenRL](#citing-openrl)
@@ -82,9 +86,9 @@ pip install openrl
8286
conda install -c openrl openrl
8387
```
8488

85-
用户也可以从源码安装OpenRL:
89+
想要修改源码的用户也可以从源码安装OpenRL:
8690
```bash
87-
git clone https://github.com/OpenRL-Lab/openrl && cd openrl
91+
git clone https://github.com/OpenRL-Lab/openrl.git && cd openrl
8892
pip install -e .
8993
```
9094

@@ -93,6 +97,36 @@ pip install -e .
9397
openrl --version
9498
```
9599

100+
## 使用Docker
101+
102+
OpenRL目前也提供了包含显卡支持和非显卡支持的Docker镜像。
103+
如果用户的电脑上没有英伟达显卡,则可以通过以下命令获取不包含显卡插件的镜像:
104+
```bash
105+
sudo docker pull openrllab/openrl-cpu
106+
```
107+
108+
如果用户想要通过显卡加速训练,则可以通过以下命令获取:
109+
```bash
110+
sudo docker pull openrllab/openrl
111+
```
112+
113+
镜像拉取成功后,用户可以通过以下命令运行OpenRL的Docker镜像:
114+
```bash
115+
# 不带显卡加速
116+
sudo docker run -it openrllab/openrl-cpu
117+
# 带显卡加速
118+
sudo docker run -it --gpus all --net host openrllab/openrl
119+
```
120+
121+
进入Docker镜像后,用户可以通过以下命令查看OpenRL的版本然后运行测例:
122+
```bash
123+
# 查看Docker镜像中OpenRL的版本
124+
openrl --version
125+
# 运行测例
126+
openrl --mode train --env CartPole-v1
127+
```
128+
129+
96130
## 快速上手
97131

98132
OpenRL为强化学习入门用户提供了简单易用的接口,
@@ -189,6 +223,12 @@ OpenRL框架目前还在持续开发和文档建设,欢迎加入我们让该
189223

190224
## 支持者
191225

226+
### ↳ Contributors
227+
228+
<a href="https://github.com/OpenRL-Lab/openrl/graphs/contributors">
229+
<img src="https://contrib.rocks/image?repo=OpenRL-Lab/openrl" />
230+
</a>
231+
192232
### &#8627; Stargazers
193233

194234
[![Stargazers repo roster for @OpenRL-Lab/openrl](https://reporoster.com/stars/OpenRL-Lab/openrl)](https://github.com/OpenRL-Lab/openrl/stargazers)

README_en.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
OpenRL-v0.0.8 is updated on May 4, 2023
3030

31+
The main branch is the latest version of OpenRL, which is under active development. If you just want to have a try with OpenRL, you can switch to the stable branch.
32+
3133
## Welcome to OpenRL
3234

3335
[中文介绍](./README.md) | [Documentation](https://openrl-docs.readthedocs.io/en/latest/) | [中文文档](https://openrl-docs.readthedocs.io/zh/latest/)
@@ -77,12 +79,14 @@ For more information about OpenRL, please refer to the [documentation](https://o
7779
- [Welcome to OpenRL](#welcome-to-openrl)
7880
- [Outline](#outline)
7981
- [Installation](#installation)
82+
- [Use Docker](#use-docker)
8083
- [Quick Start](#quick-start)
8184
- [Gallery](#gallery)
8285
- [Projects Using OpenRL](#projects-using-openrl)
8386
- [Feedback and Contribution](#feedback-and-contribution)
8487
- [Maintainers](#maintainers)
8588
- [Supporters](#supporters)
89+
- [&#8627; Contributors](#-contributors)
8690
- [&#8627; Stargazers](#-stargazers)
8791
- [&#8627; Forkers](#-forkers)
8892
- [Citing OpenRL](#citing-openrl)
@@ -103,10 +107,10 @@ If users are using Anaconda or Miniconda, they can also install OpenRL via conda
103107
conda install -c openrl openrl
104108
```
105109

106-
Users can also install OpenRL from source code:
110+
Users who want to modify the source code can also install OpenRL from the source code:
107111

108112
```bash
109-
git clone https://github.com/OpenRL-Lab/openrl && cd openrl
113+
git clone https://github.com/OpenRL-Lab/openrl.git && cd openrl
110114
pip install -e .
111115
```
112116

@@ -116,6 +120,35 @@ After installation, users can check the version of OpenRL through command line:
116120
openrl --version
117121
```
118122

123+
## Use Docker
124+
125+
OpenRL currently provides Docker images with and without GPU support.
126+
If the user's computer does not have an NVIDIA GPU, they can obtain an image without the GPU plugin using the following command:
127+
```bash
128+
sudo docker pull openrllab/openrl-cpu
129+
```
130+
131+
If the user wants to accelerate training with a GPU, they can obtain it using the following command:
132+
```bash
133+
sudo docker pull openrllab/openrl
134+
```
135+
136+
After successfully pulling the image, users can run OpenRL's Docker image using the following commands:
137+
```bash
138+
# Without GPU acceleration
139+
sudo docker run -it openrllab/openrl-cpu
140+
# With GPU acceleration
141+
sudo docker run -it --gpus all --net host openrllab/openrl
142+
```
143+
144+
Once inside the Docker container, users can check OpenRL's version and then run test cases using these commands:
145+
```bash
146+
# Check OpenRL version in Docker container
147+
openrl --version
148+
# Run test case
149+
openrl --mode train --env CartPole-v1
150+
```
151+
119152
## Quick Start
120153

121154
OpenRL provides a simple and easy-to-use interface for beginners in reinforcement learning.
@@ -213,6 +246,12 @@ to apply for joining the OpenRL team).
213246

214247
## Supporters
215248

249+
### &#8627; Contributors
250+
251+
<a href="https://github.com/OpenRL-Lab/openrl/graphs/contributors">
252+
<img src="https://contrib.rocks/image?repo=OpenRL-Lab/openrl" />
253+
</a>
254+
216255
### &#8627; Stargazers
217256

218257
[![Stargazers repo roster for @OpenRL-Lab/openrl](https://reporoster.com/stars/OpenRL-Lab/openrl)](https://github.com/OpenRL-Lab/openrl/stargazers)

docker/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG PARENT_IMAGE
2+
FROM $PARENT_IMAGE
3+
4+
WORKDIR /openrl
5+
6+
ADD setup.py setup.py
7+
ADD openrl openrl
8+
ADD README.md README.md
9+
10+
ENV VENV /root/venv
11+
12+
RUN \
13+
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
14+
15+
RUN \
16+
python3 -m pip install --upgrade pip --no-cache-dir && \
17+
python3 -m pip install --no-cache-dir . && \
18+
python3 -m pip install --no-cache-dir ".[nlp]" && \
19+
rm -rf $HOME/.cache/pip
20+
21+
ENV PATH=$VENV/bin:$PATH
22+
23+
CMD /bin/bash

examples/cartpole/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## How to Use
2+
3+
Users can train CartPole via:
4+
5+
```shell
6+
python train_ppo.py
7+
```

examples/cartpole/train_ppo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def train():
1919
return agent
2020

2121

22-
def test(agent):
22+
def evaluation(agent):
2323
# 开始测试环境
2424
env = make("CartPole-v1", render_mode="group_human", env_num=9, asynchronous=True)
2525
agent.set_env(env)
@@ -37,4 +37,4 @@ def test(agent):
3737

3838
if __name__ == "__main__":
3939
agent = train()
40-
test(agent)
40+
evaluation(agent)

examples/mpe/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## How to Use
2+
3+
Users can train MPE via:
4+
5+
```shell
6+
python train_ppo.py --config mpe_ppo.yaml
7+
```

0 commit comments

Comments
 (0)