Pulting86 commited on
Commit
e7a0a03
verified
1 Parent(s): 33726f8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -25
README.md CHANGED
@@ -7,29 +7,103 @@ tags:
7
  - ML-Agents-SoccerTwos
8
  ---
9
 
10
- # **poca** Agent playing **SoccerTwos**
11
- This is a trained model of a **poca** agent playing **SoccerTwos**
12
- using the [Unity ML-Agents Library](https://github.com/Unity-Technologies/ml-agents).
13
-
14
- ## Usage (with ML-Agents)
15
- The Documentation: https://unity-technologies.github.io/ml-agents/ML-Agents-Toolkit-Documentation/
16
-
17
- We wrote a complete tutorial to learn to train your first agent using ML-Agents and publish it to the Hub:
18
- - A *short tutorial* where you teach Huggy the Dog 馃惗 to fetch the stick and then play with him directly in your
19
- browser: https://huggingface.co/learn/deep-rl-course/unitbonus1/introduction
20
- - A *longer tutorial* to understand how works ML-Agents:
21
- https://huggingface.co/learn/deep-rl-course/unit5/introduction
22
-
23
- ### Resume the training
24
- ```bash
25
- mlagents-learn <your_configuration_file_path.yaml> --run-id=<run_id> --resume
26
- ```
27
-
28
- ### Watch your Agent play
29
- You can watch your agent **playing directly in your browser**
30
-
31
- 1. If the environment is part of ML-Agents official environments, go to https://huggingface.co/unity
32
- 2. Step 1: Find your model_id: Pulting86/ML-Agents-SoccerTwos
33
- 3. Step 2: Select your *.nn /*.onnx file
34
- 4. Click on Watch the agent play 馃憖
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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