Add README
Browse files
README.md
CHANGED
|
@@ -1,29 +1,36 @@
|
|
| 1 |
# SAC Ant Agent
|
| 2 |
|
| 3 |
-
A
|
| 4 |
|
| 5 |
## Training Details
|
| 6 |
- Algorithm: SAC
|
| 7 |
-
- Timesteps:
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
## Usage
|
| 11 |
|
| 12 |
-
```
|
| 13 |
-
pip install
|
| 14 |
-
|
| 15 |
# login to huggingFace
|
| 16 |
-
huggingface-cli login
|
| 17 |
-
```
|
| 18 |
-
|
| 19 |
|
| 20 |
-
```python
|
| 21 |
from stable_baselines3 import SAC
|
| 22 |
-
from
|
| 23 |
|
| 24 |
-
|
| 25 |
-
repo_id="
|
| 26 |
-
filename="
|
| 27 |
)
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
```
|
|
|
|
| 1 |
# SAC Ant Agent
|
| 2 |
|
| 3 |
+
A SAC agent trained on the MuJoCo Ant-v4 environment.
|
| 4 |
|
| 5 |
## Training Details
|
| 6 |
- Algorithm: SAC
|
| 7 |
+
- Timesteps: 2.4e6
|
| 8 |
+
```
|
| 9 |
+
- learning_rate=3e-4,
|
| 10 |
+
- buffer_size=1_000_000, # 经验回放缓冲区大小. 这个参数PPO没有
|
| 11 |
+
- batch_size=256, # 默认256
|
| 12 |
+
- tau=0.005, # 软更新系数
|
| 13 |
+
- gamma=0.99, # 折扣因子
|
| 14 |
+
- train_freq=1, # 每步都训练,采集多少个环境步的数据后训练一次
|
| 15 |
+
- gradient_steps=1, # 对replayBuffer中读取到的batch,进行多少次梯度下降更新
|
| 16 |
+
```
|
| 17 |
|
| 18 |
## Usage
|
| 19 |
|
| 20 |
+
```python
|
| 21 |
+
!pip install huggingface_sb3
|
|
|
|
| 22 |
# login to huggingFace
|
| 23 |
+
!huggingface-cli login
|
|
|
|
|
|
|
| 24 |
|
|
|
|
| 25 |
from stable_baselines3 import SAC
|
| 26 |
+
from huggingface_sb3 import load_from_hub
|
| 27 |
|
| 28 |
+
model_path = load_from_hub( # This function only returns the path of the cached model
|
| 29 |
+
repo_id="buffaX/sac-ant-v4",
|
| 30 |
+
filename="sac_ant.zip"
|
| 31 |
)
|
| 32 |
+
|
| 33 |
+
model = SAC.load(model_path)
|
| 34 |
+
print(model.actor)
|
| 35 |
+
print(model.critic)
|
| 36 |
```
|