Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -21,7 +21,7 @@ model-index:
|
|
21 |
type: OpenAI/Gym/MuJoCo-Hopper-v3
|
22 |
metrics:
|
23 |
- type: mean_reward
|
24 |
-
value:
|
25 |
name: mean_reward
|
26 |
---
|
27 |
|
@@ -53,6 +53,7 @@ wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz -O mujoco.tar.gz
|
|
53 |
tar -xf mujoco.tar.gz -C ~/.mujoco
|
54 |
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin" >> ~/.bashrc
|
55 |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin
|
|
|
56 |
pip3 install DI-engine[common_env]
|
57 |
|
58 |
```
|
@@ -76,9 +77,9 @@ import torch
|
|
76 |
|
77 |
# Pull model from files which are git cloned from huggingface
|
78 |
policy_state_dict = torch.load("pytorch_model.bin", map_location=torch.device("cpu"))
|
79 |
-
cfg = EasyDict(Config.file_to_dict("policy_config.py"))
|
80 |
# Instantiate the agent
|
81 |
-
agent = SACAgent(
|
82 |
# Continue training
|
83 |
agent.train(step=5000)
|
84 |
# Render the new agent performance
|
@@ -104,7 +105,7 @@ from huggingface_ding import pull_model_from_hub
|
|
104 |
# Pull model from Hugggingface hub
|
105 |
policy_state_dict, cfg = pull_model_from_hub(repo_id="OpenDILabCommunity/Hopper-v3-SAC")
|
106 |
# Instantiate the agent
|
107 |
-
agent = SACAgent(
|
108 |
# Continue training
|
109 |
agent.train(step=5000)
|
110 |
# Render the new agent performance
|
@@ -126,11 +127,11 @@ python3 -u train.py
|
|
126 |
```
|
127 |
**train.py**
|
128 |
```python
|
129 |
-
from ding.bonus
|
130 |
from huggingface_ding import push_model_to_hub
|
131 |
|
132 |
# Instantiate the agent
|
133 |
-
agent = SACAgent(
|
134 |
# Train the agent
|
135 |
return_ = agent.train(step=int(10000000), collector_env_num=4, evaluator_env_num=4, debug=False)
|
136 |
# Push model to huggingface hub
|
@@ -164,12 +165,14 @@ wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz -O mujoco.tar.gz
|
|
164 |
tar -xf mujoco.tar.gz -C ~/.mujoco
|
165 |
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin" >> ~/.bashrc
|
166 |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin
|
|
|
167 |
pip3 install DI-engine[common_env]
|
168 |
''',
|
169 |
usage_file_by_git_clone="./sac/hopper_sac_deploy.py",
|
170 |
usage_file_by_huggingface_ding="./sac/hopper_sac_download.py",
|
171 |
train_file="./sac/hopper_sac.py",
|
172 |
-
repo_id="OpenDILabCommunity/Hopper-v3-SAC"
|
|
|
173 |
)
|
174 |
|
175 |
```
|
@@ -194,10 +197,11 @@ exp_config = {
|
|
194 |
'cfg_type': 'BaseEnvManagerDict'
|
195 |
},
|
196 |
'stop_value': 6000,
|
|
|
197 |
'env_id': 'Hopper-v3',
|
198 |
'collector_env_num': 8,
|
199 |
'evaluator_env_num': 8,
|
200 |
-
'
|
201 |
},
|
202 |
'policy': {
|
203 |
'model': {
|
@@ -251,9 +255,10 @@ exp_config = {
|
|
251 |
'render_freq': -1,
|
252 |
'mode': 'train_iter'
|
253 |
},
|
|
|
254 |
'cfg_type': 'InteractionSerialEvaluatorDict',
|
255 |
-
'
|
256 |
-
'
|
257 |
}
|
258 |
},
|
259 |
'other': {
|
@@ -299,14 +304,14 @@ exp_config = {
|
|
299 |
- **Configuration:** [config link](https://huggingface.co/OpenDILabCommunity/Hopper-v3-SAC/blob/main/policy_config.py)
|
300 |
- **Demo:** [video](https://huggingface.co/OpenDILabCommunity/Hopper-v3-SAC/blob/main/replay.mp4)
|
301 |
<!-- Provide the size information for the model. -->
|
302 |
-
- **Parameters total size:**
|
303 |
-
- **Last Update Date:** 2023-
|
304 |
|
305 |
## Environments
|
306 |
<!-- Address questions around what environment the model is intended to be trained and deployed at, including the necessary information needed to be provided for future users. -->
|
307 |
- **Benchmark:** OpenAI/Gym/MuJoCo
|
308 |
- **Task:** Hopper-v3
|
309 |
- **Gym version:** 0.25.1
|
310 |
-
- **DI-engine version:** v0.4.
|
311 |
-
- **PyTorch version:**
|
312 |
- **Doc**: [DI-engine-docs Environments link](https://di-engine-docs.readthedocs.io/en/latest/13_envs/mujoco.html)
|
|
|
21 |
type: OpenAI/Gym/MuJoCo-Hopper-v3
|
22 |
metrics:
|
23 |
- type: mean_reward
|
24 |
+
value: 3899.4 +/- 362.09
|
25 |
name: mean_reward
|
26 |
---
|
27 |
|
|
|
53 |
tar -xf mujoco.tar.gz -C ~/.mujoco
|
54 |
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin" >> ~/.bashrc
|
55 |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin
|
56 |
+
pip3 install "cython<3"
|
57 |
pip3 install DI-engine[common_env]
|
58 |
|
59 |
```
|
|
|
77 |
|
78 |
# Pull model from files which are git cloned from huggingface
|
79 |
policy_state_dict = torch.load("pytorch_model.bin", map_location=torch.device("cpu"))
|
80 |
+
cfg = EasyDict(Config.file_to_dict("policy_config.py").cfg_dict)
|
81 |
# Instantiate the agent
|
82 |
+
agent = SACAgent(env_id="Hopper-v3", exp_name="Hopper-v3-SAC", cfg=cfg.exp_config, policy_state_dict=policy_state_dict)
|
83 |
# Continue training
|
84 |
agent.train(step=5000)
|
85 |
# Render the new agent performance
|
|
|
105 |
# Pull model from Hugggingface hub
|
106 |
policy_state_dict, cfg = pull_model_from_hub(repo_id="OpenDILabCommunity/Hopper-v3-SAC")
|
107 |
# Instantiate the agent
|
108 |
+
agent = SACAgent(env_id="Hopper-v3", exp_name="Hopper-v3-SAC", cfg=cfg.exp_config, policy_state_dict=policy_state_dict)
|
109 |
# Continue training
|
110 |
agent.train(step=5000)
|
111 |
# Render the new agent performance
|
|
|
127 |
```
|
128 |
**train.py**
|
129 |
```python
|
130 |
+
from ding.bonus import SACAgent
|
131 |
from huggingface_ding import push_model_to_hub
|
132 |
|
133 |
# Instantiate the agent
|
134 |
+
agent = SACAgent(env_id="Hopper-v3", exp_name="Hopper-v3-SAC")
|
135 |
# Train the agent
|
136 |
return_ = agent.train(step=int(10000000), collector_env_num=4, evaluator_env_num=4, debug=False)
|
137 |
# Push model to huggingface hub
|
|
|
165 |
tar -xf mujoco.tar.gz -C ~/.mujoco
|
166 |
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin" >> ~/.bashrc
|
167 |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mjpro210/bin:~/.mujoco/mujoco210/bin
|
168 |
+
pip3 install "cython<3"
|
169 |
pip3 install DI-engine[common_env]
|
170 |
''',
|
171 |
usage_file_by_git_clone="./sac/hopper_sac_deploy.py",
|
172 |
usage_file_by_huggingface_ding="./sac/hopper_sac_download.py",
|
173 |
train_file="./sac/hopper_sac.py",
|
174 |
+
repo_id="OpenDILabCommunity/Hopper-v3-SAC",
|
175 |
+
create_repo=False
|
176 |
)
|
177 |
|
178 |
```
|
|
|
197 |
'cfg_type': 'BaseEnvManagerDict'
|
198 |
},
|
199 |
'stop_value': 6000,
|
200 |
+
'n_evaluator_episode': 8,
|
201 |
'env_id': 'Hopper-v3',
|
202 |
'collector_env_num': 8,
|
203 |
'evaluator_env_num': 8,
|
204 |
+
'env_wrapper': 'mujoco_default'
|
205 |
},
|
206 |
'policy': {
|
207 |
'model': {
|
|
|
255 |
'render_freq': -1,
|
256 |
'mode': 'train_iter'
|
257 |
},
|
258 |
+
'figure_path': None,
|
259 |
'cfg_type': 'InteractionSerialEvaluatorDict',
|
260 |
+
'stop_value': 6000,
|
261 |
+
'n_episode': 8
|
262 |
}
|
263 |
},
|
264 |
'other': {
|
|
|
304 |
- **Configuration:** [config link](https://huggingface.co/OpenDILabCommunity/Hopper-v3-SAC/blob/main/policy_config.py)
|
305 |
- **Demo:** [video](https://huggingface.co/OpenDILabCommunity/Hopper-v3-SAC/blob/main/replay.mp4)
|
306 |
<!-- Provide the size information for the model. -->
|
307 |
+
- **Parameters total size:** 1642.06 KB
|
308 |
+
- **Last Update Date:** 2023-09-21
|
309 |
|
310 |
## Environments
|
311 |
<!-- Address questions around what environment the model is intended to be trained and deployed at, including the necessary information needed to be provided for future users. -->
|
312 |
- **Benchmark:** OpenAI/Gym/MuJoCo
|
313 |
- **Task:** Hopper-v3
|
314 |
- **Gym version:** 0.25.1
|
315 |
+
- **DI-engine version:** v0.4.9
|
316 |
+
- **PyTorch version:** 2.0.1+cu117
|
317 |
- **Doc**: [DI-engine-docs Environments link](https://di-engine-docs.readthedocs.io/en/latest/13_envs/mujoco.html)
|