Update README.md
Browse files
README.md
CHANGED
@@ -7,29 +7,103 @@ tags:
|
|
7 |
- ML-Agents-SoccerTwos
|
8 |
---
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
7 |
- ML-Agents-SoccerTwos
|
8 |
---
|
9 |
|
10 |
+
# ML-Agents SoccerTwos Training
|
11 |
+
|
12 |
+
Este repositorio contiene los pasos necesarios para entrenar un agente en el entorno `SoccerTwos` utilizando Unity ML-Agents.
|
13 |
+
|
14 |
+
## Requisitos
|
15 |
+
|
16 |
+
- Python 3.7 o superior
|
17 |
+
- Unity ML-Agents
|
18 |
+
- TensorFlow
|
19 |
+
- Acceso al entorno `SoccerTwos` (archivo `.zip` descargable)
|
20 |
+
|
21 |
+
## Instalaci贸n
|
22 |
+
|
23 |
+
1. **Clona el repositorio de ML-Agents:**
|
24 |
+
|
25 |
+
```bash
|
26 |
+
git clone --depth 1 https://github.com/Unity-Technologies/ml-agents
|
27 |
+
|
28 |
+
2. **Instala los paquetes necesarios:**
|
29 |
+
|
30 |
+
Dir铆gete a la carpeta clonada y ejecuta:
|
31 |
+
```bash
|
32 |
+
cd ml-agents
|
33 |
+
pip3 install -e ./ml-agents-envs
|
34 |
+
pip3 install -e ./ml-agents
|
35 |
+
|
36 |
+
## Configuraci贸n del entorno de entrenamiento
|
37 |
+
|
38 |
+
1. **Crea la carpeta para el entrenamiento:**
|
39 |
+
```bash
|
40 |
+
mkdir -p ./train-soccer
|
41 |
+
|
42 |
+
2. **Descarga el entorno SoccerTwos:**
|
43 |
+
|
44 |
+
Utiliza el siguiente script para descargar el archivo .zip del entorno y extraerlo:
|
45 |
+
|
46 |
+
```bash
|
47 |
+
import gdown
|
48 |
+
file_id = '1KuqBKYiXiICU4kNMqEzhgyuPF5_45CL'
|
49 |
+
gdown.download(f'https://drive.google.com/uc?export=download&id={file_id}', './train-soccer/SoccerTwos.zip', quiet=False)
|
50 |
+
Extrae el archivo:
|
51 |
+
|
52 |
+
unzip -d ./train-soccer ./train-soccer/SoccerTwos.zip
|
53 |
+
|
54 |
+
3. **Cambia los permisos del archivo extra铆do:**
|
55 |
+
|
56 |
+
```bash
|
57 |
+
chmod -R 755 ./train-soccer/SoccerTwos/SoccerTwos.x86_64
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
## Configuraci贸n de par谩metros de entrenamiento
|
62 |
+
|
63 |
+
Crea un archivo YAML con los par谩metros de entrenamiento. Un ejemplo es el siguiente:
|
64 |
+
|
65 |
+
|
66 |
+
behaviors:
|
67 |
+
SoccerTwos:
|
68 |
+
trainer_type: poca
|
69 |
+
hyperparameters:
|
70 |
+
batch_size: 4096
|
71 |
+
buffer_size: 40960
|
72 |
+
learning_rate: 0.0002
|
73 |
+
beta: 0.01
|
74 |
+
epsilon: 0.15
|
75 |
+
lambd: 0.92
|
76 |
+
num_epoch: 5
|
77 |
+
learning_rate_schedule: linear
|
78 |
+
network_settings:
|
79 |
+
normalize: true
|
80 |
+
hidden_units: 1024
|
81 |
+
num_layers: 3
|
82 |
+
vis_encode_type: simple
|
83 |
+
reward_signals:
|
84 |
+
extrinsic:
|
85 |
+
gamma: 0.995
|
86 |
+
strength: 1.0
|
87 |
+
keep_checkpoints: 10
|
88 |
+
max_steps: 1000000
|
89 |
+
time_horizon: 1200
|
90 |
+
summary_freq: 5000
|
91 |
+
self_play:
|
92 |
+
save_steps: 50000
|
93 |
+
team_change: 300000
|
94 |
+
swap_steps: 3000
|
95 |
+
play_against_latest_model_ratio: 0.6
|
96 |
+
initial_elo: 1200.0
|
97 |
+
|
98 |
+
Y guardarlo en la carpeta 'train-soccer'
|
99 |
+
|
100 |
+
with open('./train-soccer/SoccerTwos.yaml', 'w') as file:
|
101 |
+
file.write(yaml_content)
|
102 |
+
|
103 |
+
|
104 |
+
## Entrenamiento del agente
|
105 |
+
|
106 |
+
Inicia el entrenamiento con el siguiente comando:
|
107 |
+
|
108 |
+
mlagents-learn ./train-soccer/SoccerTwos.yaml --env=./train-soccer/SoccerTwos/SoccerTwos.x86_64 --run-id="SoccerTwosNew" --no-graphics --force
|
109 |
|