Skip to content

Commit 4d166c7

Browse files
committed
add notebook yaml highlighting
1 parent c929ba2 commit 4d166c7

File tree

2 files changed

+241
-241
lines changed

2 files changed

+241
-241
lines changed

notebooks/unit3/unit3.ipynb

+76-76
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"id": "view-in-github",
7-
"colab_type": "text"
6+
"colab_type": "text",
7+
"id": "view-in-github"
88
},
99
"source": [
1010
"<a href=\"https://colab.research.google.com/github/huggingface/deep-rl-class/blob/main/notebooks/unit3.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
@@ -41,6 +41,9 @@
4141
},
4242
{
4343
"cell_type": "markdown",
44+
"metadata": {
45+
"id": "ykJiGevCMVc5"
46+
},
4447
"source": [
4548
"### 🎮 Environments: \n",
4649
"\n",
@@ -51,10 +54,7 @@
5154
"### 📚 RL-Library: \n",
5255
"\n",
5356
"- [RL-Baselines3-Zoo](https://github.com/DLR-RM/rl-baselines3-zoo)"
54-
],
55-
"metadata": {
56-
"id": "ykJiGevCMVc5"
57-
}
57+
]
5858
},
5959
{
6060
"cell_type": "markdown",
@@ -72,13 +72,13 @@
7272
},
7373
{
7474
"cell_type": "markdown",
75+
"metadata": {
76+
"id": "TsnP0rjxMn1e"
77+
},
7578
"source": [
7679
"## This notebook is from Deep Reinforcement Learning Course\n",
7780
"<img src=\"https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/notebooks/deep-rl-course-illustration.jpg\" alt=\"Deep RL Course illustration\"/>"
78-
],
79-
"metadata": {
80-
"id": "TsnP0rjxMn1e"
81-
}
81+
]
8282
},
8383
{
8484
"cell_type": "markdown",
@@ -114,12 +114,12 @@
114114
},
115115
{
116116
"cell_type": "markdown",
117-
"source": [
118-
"We're constantly trying to improve our tutorials, so **if you find some issues in this notebook**, please [open an issue on the Github Repo](https://github.com/huggingface/deep-rl-class/issues)."
119-
],
120117
"metadata": {
121118
"id": "7kszpGFaRVhq"
122-
}
119+
},
120+
"source": [
121+
"We're constantly trying to improve our tutorials, so **if you find some issues in this notebook**, please [open an issue on the Github Repo](https://github.com/huggingface/deep-rl-class/issues)."
122+
]
123123
},
124124
{
125125
"cell_type": "markdown",
@@ -142,6 +142,9 @@
142142
},
143143
{
144144
"cell_type": "markdown",
145+
"metadata": {
146+
"id": "Nc8BnyVEc3Ys"
147+
},
145148
"source": [
146149
"## An advice 💡\n",
147150
"It's better to run this colab in a copy on your Google Drive, so that **if it timeouts** you still have the saved notebook on your Google Drive and do not need to fill everything from scratch.\n",
@@ -151,87 +154,84 @@
151154
"Also, we're going to **train it for 90 minutes with 1M timesteps**. By typing `!nvidia-smi` will tell you what GPU you're using.\n",
152155
"\n",
153156
"And if you want to train more such 10 million steps, this will take about 9 hours, potentially resulting in Colab timing out. In that case, I recommend running this on your local computer (or somewhere else). Just click on: `File>Download`. "
154-
],
155-
"metadata": {
156-
"id": "Nc8BnyVEc3Ys"
157-
}
157+
]
158158
},
159159
{
160160
"cell_type": "markdown",
161+
"metadata": {
162+
"id": "PU4FVzaoM6fC"
163+
},
161164
"source": [
162165
"## Set the GPU 💪\n",
163166
"- To **accelerate the agent's training, we'll use a GPU**. To do that, go to `Runtime > Change Runtime type`\n",
164167
"\n",
165168
"<img src=\"https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/notebooks/gpu-step1.jpg\" alt=\"GPU Step 1\">"
166-
],
167-
"metadata": {
168-
"id": "PU4FVzaoM6fC"
169-
}
169+
]
170170
},
171171
{
172172
"cell_type": "markdown",
173+
"metadata": {
174+
"id": "KV0NyFdQM9ZG"
175+
},
173176
"source": [
174177
"- `Hardware Accelerator > GPU`\n",
175178
"\n",
176179
"<img src=\"https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/notebooks/gpu-step2.jpg\" alt=\"GPU Step 2\">"
177-
],
178-
"metadata": {
179-
"id": "KV0NyFdQM9ZG"
180-
}
180+
]
181181
},
182182
{
183183
"cell_type": "markdown",
184+
"metadata": {
185+
"id": "wS_cVefO-aYg"
186+
},
184187
"source": [
185188
"# Install RL-Baselines3 Zoo and its dependencies 📚\n",
186189
"\n",
187190
"If you see `ERROR: pip's dependency resolver does not currently take into account all the packages that are installed.` **this is normal and it's not a critical error** there's a conflict of version. But the packages we need are installed."
188-
],
189-
"metadata": {
190-
"id": "wS_cVefO-aYg"
191-
}
191+
]
192192
},
193193
{
194194
"cell_type": "code",
195-
"source": [
196-
"# For now we install this update of RL-Baselines3 Zoo\n",
197-
"!pip install git+https://github.com/DLR-RM/rl-baselines3-zoo@update/hf"
198-
],
195+
"execution_count": null,
199196
"metadata": {
200197
"id": "hLTwHqIWdnPb"
201198
},
202-
"execution_count": null,
203-
"outputs": []
199+
"outputs": [],
200+
"source": [
201+
"# For now we install this update of RL-Baselines3 Zoo\n",
202+
"!pip install git+https://github.com/DLR-RM/rl-baselines3-zoo@update/hf"
203+
]
204204
},
205205
{
206206
"cell_type": "markdown",
207-
"source": [
208-
"IF AND ONLY IF THE VERSION ABOVE DOES NOT EXIST ANYMORE. UNCOMMENT AND INSTALL THE ONE BELOW"
209-
],
210207
"metadata": {
211208
"id": "p0xe2sJHdtHy"
212-
}
209+
},
210+
"source": [
211+
"IF AND ONLY IF THE VERSION ABOVE DOES NOT EXIST ANYMORE. UNCOMMENT AND INSTALL THE ONE BELOW"
212+
]
213213
},
214214
{
215215
"cell_type": "code",
216-
"source": [
217-
"#!pip install rl_zoo3==2.0.0a9"
218-
],
216+
"execution_count": null,
219217
"metadata": {
220218
"id": "N0d6wy-F-f39"
221219
},
222-
"execution_count": null,
223-
"outputs": []
220+
"outputs": [],
221+
"source": [
222+
"#!pip install rl_zoo3==2.0.0a9"
223+
]
224224
},
225225
{
226226
"cell_type": "code",
227-
"source": [
228-
"!apt-get install swig cmake ffmpeg"
229-
],
227+
"execution_count": null,
230228
"metadata": {
231229
"id": "8_MllY6Om1eI"
232230
},
233-
"execution_count": null,
234-
"outputs": []
231+
"outputs": [],
232+
"source": [
233+
"!apt-get install swig cmake ffmpeg"
234+
]
235235
},
236236
{
237237
"cell_type": "markdown",
@@ -244,28 +244,28 @@
244244
},
245245
{
246246
"cell_type": "code",
247-
"source": [
248-
"!pip install gymnasium[atari]\n",
249-
"!pip install gymnasium[accept-rom-license]"
250-
],
247+
"execution_count": null,
251248
"metadata": {
252249
"id": "NsRP-lX1_2fC"
253250
},
254-
"execution_count": null,
255-
"outputs": []
251+
"outputs": [],
252+
"source": [
253+
"!pip install gymnasium[atari]\n",
254+
"!pip install gymnasium[accept-rom-license]"
255+
]
256256
},
257257
{
258258
"cell_type": "markdown",
259+
"metadata": {
260+
"id": "bTpYcVZVMzUI"
261+
},
259262
"source": [
260263
"## Create a virtual display 🔽\n",
261264
"\n",
262265
"During the notebook, we'll need to generate a replay video. To do so, with colab, **we need to have a virtual screen to be able to render the environment** (and thus record the frames). \n",
263266
"\n",
264267
"Hence the following cell will install the librairies and create and run a virtual screen 🖥"
265-
],
266-
"metadata": {
267-
"id": "bTpYcVZVMzUI"
268-
}
268+
]
269269
},
270270
{
271271
"cell_type": "code",
@@ -283,18 +283,18 @@
283283
},
284284
{
285285
"cell_type": "code",
286+
"execution_count": null,
287+
"metadata": {
288+
"id": "BE5JWP5rQIKf"
289+
},
290+
"outputs": [],
286291
"source": [
287292
"# Virtual display\n",
288293
"from pyvirtualdisplay import Display\n",
289294
"\n",
290295
"virtual_display = Display(visible=0, size=(1400, 900))\n",
291296
"virtual_display.start()"
292-
],
293-
"metadata": {
294-
"id": "BE5JWP5rQIKf"
295-
},
296-
"execution_count": null,
297-
"outputs": []
297+
]
298298
},
299299
{
300300
"cell_type": "markdown",
@@ -310,7 +310,7 @@
310310
"\n",
311311
"This is a template example:\n",
312312
"\n",
313-
"```\n",
313+
"```yaml\n",
314314
"SpaceInvadersNoFrameskip-v4:\n",
315315
" env_wrapper:\n",
316316
" - stable_baselines3.common.atari_wrappers.AtariWrapper\n",
@@ -755,12 +755,12 @@
755755
},
756756
{
757757
"cell_type": "markdown",
758-
"source": [
759-
"See you on Bonus unit 2! 🔥 "
760-
],
761758
"metadata": {
762759
"id": "Kc3udPT-RcXc"
763-
}
760+
},
761+
"source": [
762+
"See you on Bonus unit 2! 🔥 "
763+
]
764764
},
765765
{
766766
"cell_type": "markdown",
@@ -773,11 +773,13 @@
773773
}
774774
],
775775
"metadata": {
776+
"accelerator": "GPU",
776777
"colab": {
778+
"include_colab_link": true,
777779
"private_outputs": true,
778-
"provenance": [],
779-
"include_colab_link": true
780+
"provenance": []
780781
},
782+
"gpuClass": "standard",
781783
"kernelspec": {
782784
"display_name": "Python 3 (ipykernel)",
783785
"language": "python",
@@ -823,9 +825,7 @@
823825
"_Feature"
824826
],
825827
"window_display": false
826-
},
827-
"accelerator": "GPU",
828-
"gpuClass": "standard"
828+
}
829829
},
830830
"nbformat": 4,
831831
"nbformat_minor": 0

0 commit comments

Comments
 (0)