Part 2 - Deep Convolutional Q-Learning¶
Installing system dependencies for VizDoom¶
In [1]:
Copied!
!sudo apt-get update
!sudo apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev libopenal-dev timidity libwildmidi-dev unzip
!sudo apt-get install libboost-all-dev
!apt-get install liblua5.1-dev
!sudo apt-get install cmake libboost-all-dev libgtk2.0-dev libsdl2-dev python-numpy git
!git clone https://github.com/shakenes/vizdoomgym.git
!python3 -m pip install -e vizdoomgym/
!pip install pillow
# !pip install scipy==1.1.0
# dependencies issues
!pip install scipy==1.6.0
!sudo apt-get update
!sudo apt-get install build-essential zlib1g-dev libsdl2-dev libjpeg-dev nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev libopenal-dev timidity libwildmidi-dev unzip
!sudo apt-get install libboost-all-dev
!apt-get install liblua5.1-dev
!sudo apt-get install cmake libboost-all-dev libgtk2.0-dev libsdl2-dev python-numpy git
!git clone https://github.com/shakenes/vizdoomgym.git
!python3 -m pip install -e vizdoomgym/
!pip install pillow
# !pip install scipy==1.1.0
# dependencies issues
!pip install scipy==1.6.0
0% [Working]
Get:1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]
0% [Waiting for headers] [Waiting for headers] [1 InRelease 0 B/3,626 B 0%] [Co
0% [Waiting for headers] [Waiting for headers] [Connected to developer.download
0% [1 InRelease gpgv 3,626 B] [Waiting for headers] [Waiting for headers] [Wait
Ign:2 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease
0% [1 InRelease gpgv 3,626 B] [Waiting for headers] [Waiting for headers] [Wait
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease [1,581 B]
0% [1 InRelease gpgv 3,626 B] [Waiting for headers] [Waiting for headers] [Wait
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
0% [1 InRelease gpgv 3,626 B] [Waiting for headers] [5 InRelease 14.2 kB/88.7 k
Hit:6 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 Release
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:8 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease
Get:9 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Hit:10 http://ppa.launchpad.net/cran/libgit2/ubuntu bionic InRelease
Get:11 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 Packages [1,038 kB]
Hit:12 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease
Hit:14 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Get:15 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [3,067 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [3,493 kB]
Get:17 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,563 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,338 kB]
Fetched 11.8 MB in 3s (3,498 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
libjpeg-dev is already the newest version (8c-2ubuntu8).
libjpeg-dev set to manually installed.
cmake is already the newest version (3.10.2-1ubuntu2.18.04.2).
git is already the newest version (1:2.17.1-1ubuntu0.13).
libbz2-dev is already the newest version (1.0.6-8.1ubuntu0.2).
libbz2-dev set to manually installed.
tar is already the newest version (1.29b-2ubuntu0.3).
unzip is already the newest version (6.0-21ubuntu1.2).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-0ubuntu2.2).
zlib1g-dev set to manually installed.
The following package was automatically installed and is no longer required:
libnvidia-common-460
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
autoconf automake autopoint autotools-dev debhelper dh-autoreconf
dh-strip-nondeterminism file freepats gettext gettext-base gir1.2-atk-1.0
gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 gir1.2-ibus-1.0
gir1.2-pango-1.0 intltool-debian libarchive-cpio-perl libarchive-zip-perl
libatk1.0-dev libaudio2 libcairo-script-interpreter2 libcairo2-dev
libcapnp-0.6.1 libdbus-1-dev libfile-stripnondeterminism-perl libfluidsynth1
libgail-common libgail18 libgdk-pixbuf2.0-dev libgtk2.0-0 libgtk2.0-bin
libgtk2.0-common libibus-1.0-5 libibus-1.0-dev libmagic-mgc libmagic1
libmail-sendmail-perl libmirclient-dev libmirclient9 libmircommon-dev
libmircommon7 libmircookie-dev libmircookie2 libmircore-dev libmircore1
libmirprotobuf3 libpango1.0-dev libpangoxft-1.0-0 libpixman-1-dev
libprotobuf-dev libprotobuf-lite10 libpulse-dev libpulse-mainloop-glib0
libsigsegv2 libsndio-dev libsys-hostname-long-perl libtimedate-perl libtool
libudev-dev libwildmidi-config libwildmidi2 libxcb-shm0-dev
libxcomposite-dev libxcursor-dev libxi-dev libxinerama-dev libxkbcommon-dev
libxml2-utils libxrandr-dev libxv-dev m4 po-debconf timidity-daemon
x11proto-composite-dev x11proto-input-dev x11proto-randr-dev
x11proto-xinerama-dev
Suggested packages:
autoconf-archive gnu-standards autoconf-doc dh-make dwz gettext-doc
libasprintf-dev libgettextpo-dev nas libcairo2-doc fluidr3mono-gm-soundfont
| timgm6mb-soundfont | fluid-soundfont-gm gvfs libgtk2.0-doc imagemagick
libpango1.0-doc libtool-doc gcj-jdk m4-doc libmail-box-perl
fluid-soundfont-gm fluid-soundfont-gs pmidi
The following NEW packages will be installed:
autoconf automake autopoint autotools-dev debhelper dh-autoreconf
dh-strip-nondeterminism file freepats gettext gettext-base gir1.2-atk-1.0
gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-gtk-2.0 gir1.2-ibus-1.0
gir1.2-pango-1.0 intltool-debian libarchive-cpio-perl libarchive-zip-perl
libatk1.0-dev libaudio2 libcairo-script-interpreter2 libcairo2-dev
libcapnp-0.6.1 libdbus-1-dev libfile-stripnondeterminism-perl
libfluidsynth-dev libfluidsynth1 libgail-common libgail18
libgdk-pixbuf2.0-dev libgme-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common
libgtk2.0-dev libibus-1.0-5 libibus-1.0-dev libmagic-mgc libmagic1
libmail-sendmail-perl libmirclient-dev libmirclient9 libmircommon-dev
libmircommon7 libmircookie-dev libmircookie2 libmircore-dev libmircore1
libmirprotobuf3 libopenal-dev libpango1.0-dev libpangoxft-1.0-0
libpixman-1-dev libprotobuf-dev libprotobuf-lite10 libpulse-dev
libpulse-mainloop-glib0 libsdl2-dev libsigsegv2 libsndio-dev
libsys-hostname-long-perl libtimedate-perl libtool libudev-dev
libwildmidi-config libwildmidi-dev libwildmidi2 libxcb-shm0-dev
libxcomposite-dev libxcursor-dev libxi-dev libxinerama-dev libxkbcommon-dev
libxml2-utils libxrandr-dev libxv-dev m4 nasm po-debconf timidity
timidity-daemon x11proto-composite-dev x11proto-input-dev x11proto-randr-dev
x11proto-xinerama-dev
0 upgraded, 87 newly installed, 0 to remove and 9 not upgraded.
Need to get 45.4 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.4 [22.1 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext-base amd64 0.19.8.1-6ubuntu0.3 [113 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsigsegv2 amd64 2.12-1 [14.7 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 autopoint all 0.19.8.1-6ubuntu0.3 [426 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtool all 2.4.6-2 [194 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-autoreconf all 17 [15.8 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive-zip-perl all 1.60-1ubuntu0.1 [84.6 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 libfile-stripnondeterminism-perl all 0.040-1.1~build1 [13.8 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-strip-nondeterminism all 0.040-1.1~build1 [5,208 B]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext amd64 0.19.8.1-6ubuntu0.3 [1,293 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic/main amd64 intltool-debian all 0.35.0+20060710.4 [24.9 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 po-debconf all 1.0.20 [232 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 debhelper all 11.1.6ubuntu2 [902 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic/universe amd64 freepats all 20060219-1 [29.0 MB]
Get:22 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-atk-1.0 amd64 2.28.1-1 [17.8 kB]
Get:23 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-freedesktop amd64 1.56.1-1 [9,080 B]
Get:24 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gdkpixbuf-2.0 amd64 2.36.11-2 [7,748 B]
Get:25 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-common all 2.24.32-1ubuntu1 [125 kB]
Get:26 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpangoxft-1.0-0 amd64 1.40.14-1ubuntu0.1 [15.0 kB]
Get:27 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-pango-1.0 amd64 1.40.14-1ubuntu0.1 [21.6 kB]
Get:28 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-0 amd64 2.24.32-1ubuntu1 [1,769 kB]
Get:29 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gtk-2.0 amd64 2.24.32-1ubuntu1 [172 kB]
Get:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libibus-1.0-5 amd64 1.5.17-3ubuntu5.3 [133 kB]
Get:31 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-ibus-1.0 amd64 1.5.17-3ubuntu5.3 [66.5 kB]
Get:32 http://archive.ubuntu.com/ubuntu bionic/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B]
Get:33 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatk1.0-dev amd64 2.28.1-1 [79.9 kB]
Get:34 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaudio2 amd64 1.9.4-6 [50.3 kB]
Get:35 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo-script-interpreter2 amd64 1.15.10-2ubuntu0.1 [53.5 kB]
Get:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpixman-1-dev amd64 0.34.0-2ubuntu0.1 [244 kB]
Get:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxcb-shm0-dev amd64 1.13-2~ubuntu18.04 [6,684 B]
Get:38 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo2-dev amd64 1.15.10-2ubuntu0.1 [626 kB]
Get:39 http://archive.ubuntu.com/ubuntu bionic/main amd64 libcapnp-0.6.1 amd64 0.6.1-1ubuntu1 [658 kB]
Get:40 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdbus-1-dev amd64 1.12.2-1ubuntu1.4 [165 kB]
Get:41 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libfluidsynth1 amd64 1.1.9-1 [137 kB]
Get:42 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libfluidsynth-dev amd64 1.1.9-1 [19.7 kB]
Get:43 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail18 amd64 2.24.32-1ubuntu1 [14.2 kB]
Get:44 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgail-common amd64 2.24.32-1ubuntu1 [112 kB]
Get:45 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdk-pixbuf2.0-dev amd64 2.36.11-2 [46.8 kB]
Get:46 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgme-dev amd64 0.6.2-1 [5,796 B]
Get:47 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-bin amd64 2.24.32-1ubuntu1 [7,536 B]
Get:48 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpango1.0-dev amd64 1.40.14-1ubuntu0.1 [288 kB]
Get:49 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xinerama-dev all 2018.4-4 [2,628 B]
Get:50 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxinerama-dev amd64 2:1.1.3-1 [8,404 B]
Get:51 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-input-dev all 2018.4-4 [2,620 B]
Get:52 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxi-dev amd64 2:1.7.9-1 [186 kB]
Get:53 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-randr-dev all 2018.4-4 [2,620 B]
Get:54 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxrandr-dev amd64 2:1.5.1-1 [24.0 kB]
Get:55 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcursor-dev amd64 1:1.1.15-1 [26.5 kB]
Get:56 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-composite-dev all 1:2018.4-4 [2,620 B]
Get:57 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcomposite-dev amd64 1:0.4.4-2 [9,136 B]
Get:58 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxml2-utils amd64 2.9.4+dfsg1-6.1ubuntu1.7 [35.9 kB]
Get:59 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgtk2.0-dev amd64 2.24.32-1ubuntu1 [2,652 kB]
Get:60 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libibus-1.0-dev amd64 1.5.17-3ubuntu5.3 [145 kB]
Get:61 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB]
Get:62 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB]
Get:63 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmircore1 amd64 0.31.1-0ubuntu1 [26.5 kB]
Get:64 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmircommon7 amd64 0.31.1-0ubuntu1 [73.9 kB]
Get:65 http://archive.ubuntu.com/ubuntu bionic/main amd64 libprotobuf-lite10 amd64 3.0.0-9.1ubuntu1 [97.7 kB]
Get:66 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmirprotobuf3 amd64 0.31.1-0ubuntu1 [127 kB]
Get:67 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmirclient9 amd64 0.31.1-0ubuntu1 [199 kB]
Get:68 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmircore-dev amd64 0.31.1-0ubuntu1 [21.7 kB]
Get:69 http://archive.ubuntu.com/ubuntu bionic/main amd64 libprotobuf-dev amd64 3.0.0-9.1ubuntu1 [959 kB]
Get:70 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxkbcommon-dev amd64 0.8.2-1~ubuntu18.04.1 [150 kB]
Get:71 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmircommon-dev amd64 0.31.1-0ubuntu1 [13.9 kB]
Get:72 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmircookie2 amd64 0.31.1-0ubuntu1 [19.7 kB]
Get:73 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmircookie-dev amd64 0.31.1-0ubuntu1 [4,392 B]
Get:74 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmirclient-dev amd64 0.31.1-0ubuntu1 [47.8 kB]
Get:75 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopenal-dev amd64 1:1.18.2-2 [20.9 kB]
Get:76 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-mainloop-glib0 amd64 1:11.1-1ubuntu7.11 [22.1 kB]
Get:77 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpulse-dev amd64 1:11.1-1ubuntu7.11 [81.5 kB]
Get:78 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsndio-dev amd64 1.1.0-3 [13.3 kB]
Get:79 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libudev-dev amd64 237-3ubuntu10.56 [19.1 kB]
Get:80 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxv-dev amd64 2:1.0.11-1 [32.5 kB]
Get:81 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsdl2-dev amd64 2.0.8+dfsg1-1ubuntu1.18.04.4 [683 kB]
Get:82 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libwildmidi-config all 0.4.2-1 [7,212 B]
Get:83 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libwildmidi2 amd64 0.4.2-1 [55.8 kB]
Get:84 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libwildmidi-dev amd64 0.4.2-1 [86.4 kB]
Get:85 http://archive.ubuntu.com/ubuntu bionic/universe amd64 nasm amd64 2.13.02-0.1 [359 kB]
Get:86 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timidity amd64 2.13.2-41 [585 kB]
Get:87 http://archive.ubuntu.com/ubuntu bionic/universe amd64 timidity-daemon all 2.13.2-41 [5,984 B]
Fetched 45.4 MB in 5s (9,276 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 87.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Selecting previously unselected package libmagic-mgc.
(Reading database ... 123991 files and directories currently installed.)
Preparing to unpack .../00-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...
Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package libmagic1:amd64.
Preparing to unpack .../01-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...
Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package file.
Preparing to unpack .../02-file_1%3a5.32-2ubuntu0.4_amd64.deb ...
Unpacking file (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package gettext-base.
Preparing to unpack .../03-gettext-base_0.19.8.1-6ubuntu0.3_amd64.deb ...
Unpacking gettext-base (0.19.8.1-6ubuntu0.3) ...
Selecting previously unselected package libsigsegv2:amd64.
Preparing to unpack .../04-libsigsegv2_2.12-1_amd64.deb ...
Unpacking libsigsegv2:amd64 (2.12-1) ...
Selecting previously unselected package m4.
Preparing to unpack .../05-m4_1.4.18-1_amd64.deb ...
Unpacking m4 (1.4.18-1) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../06-autoconf_2.69-11_all.deb ...
Unpacking autoconf (2.69-11) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../07-autotools-dev_20180224.1_all.deb ...
Unpacking autotools-dev (20180224.1) ...
Selecting previously unselected package automake.
Preparing to unpack .../08-automake_1%3a1.15.1-3ubuntu2_all.deb ...
Unpacking automake (1:1.15.1-3ubuntu2) ...
Selecting previously unselected package autopoint.
Preparing to unpack .../09-autopoint_0.19.8.1-6ubuntu0.3_all.deb ...
Unpacking autopoint (0.19.8.1-6ubuntu0.3) ...
Selecting previously unselected package libtool.
Preparing to unpack .../10-libtool_2.4.6-2_all.deb ...
Unpacking libtool (2.4.6-2) ...
Selecting previously unselected package dh-autoreconf.
Preparing to unpack .../11-dh-autoreconf_17_all.deb ...
Unpacking dh-autoreconf (17) ...
Selecting previously unselected package libarchive-zip-perl.
Preparing to unpack .../12-libarchive-zip-perl_1.60-1ubuntu0.1_all.deb ...
Unpacking libarchive-zip-perl (1.60-1ubuntu0.1) ...
Selecting previously unselected package libfile-stripnondeterminism-perl.
Preparing to unpack .../13-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb ...
Unpacking libfile-stripnondeterminism-perl (0.040-1.1~build1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../14-libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package dh-strip-nondeterminism.
Preparing to unpack .../15-dh-strip-nondeterminism_0.040-1.1~build1_all.deb ...
Unpacking dh-strip-nondeterminism (0.040-1.1~build1) ...
Selecting previously unselected package gettext.
Preparing to unpack .../16-gettext_0.19.8.1-6ubuntu0.3_amd64.deb ...
Unpacking gettext (0.19.8.1-6ubuntu0.3) ...
Selecting previously unselected package intltool-debian.
Preparing to unpack .../17-intltool-debian_0.35.0+20060710.4_all.deb ...
Unpacking intltool-debian (0.35.0+20060710.4) ...
Selecting previously unselected package po-debconf.
Preparing to unpack .../18-po-debconf_1.0.20_all.deb ...
Unpacking po-debconf (1.0.20) ...
Selecting previously unselected package debhelper.
Preparing to unpack .../19-debhelper_11.1.6ubuntu2_all.deb ...
Unpacking debhelper (11.1.6ubuntu2) ...
Selecting previously unselected package freepats.
Preparing to unpack .../20-freepats_20060219-1_all.deb ...
Unpacking freepats (20060219-1) ...
Selecting previously unselected package gir1.2-atk-1.0:amd64.
Preparing to unpack .../21-gir1.2-atk-1.0_2.28.1-1_amd64.deb ...
Unpacking gir1.2-atk-1.0:amd64 (2.28.1-1) ...
Selecting previously unselected package gir1.2-freedesktop:amd64.
Preparing to unpack .../22-gir1.2-freedesktop_1.56.1-1_amd64.deb ...
Unpacking gir1.2-freedesktop:amd64 (1.56.1-1) ...
Selecting previously unselected package gir1.2-gdkpixbuf-2.0:amd64.
Preparing to unpack .../23-gir1.2-gdkpixbuf-2.0_2.36.11-2_amd64.deb ...
Unpacking gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...
Selecting previously unselected package libgtk2.0-common.
Preparing to unpack .../24-libgtk2.0-common_2.24.32-1ubuntu1_all.deb ...
Unpacking libgtk2.0-common (2.24.32-1ubuntu1) ...
Selecting previously unselected package libpangoxft-1.0-0:amd64.
Preparing to unpack .../25-libpangoxft-1.0-0_1.40.14-1ubuntu0.1_amd64.deb ...
Unpacking libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...
Selecting previously unselected package gir1.2-pango-1.0:amd64.
Preparing to unpack .../26-gir1.2-pango-1.0_1.40.14-1ubuntu0.1_amd64.deb ...
Unpacking gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...
Selecting previously unselected package libgtk2.0-0:amd64.
Preparing to unpack .../27-libgtk2.0-0_2.24.32-1ubuntu1_amd64.deb ...
Unpacking libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...
Selecting previously unselected package gir1.2-gtk-2.0.
Preparing to unpack .../28-gir1.2-gtk-2.0_2.24.32-1ubuntu1_amd64.deb ...
Unpacking gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...
Selecting previously unselected package libibus-1.0-5:amd64.
Preparing to unpack .../29-libibus-1.0-5_1.5.17-3ubuntu5.3_amd64.deb ...
Unpacking libibus-1.0-5:amd64 (1.5.17-3ubuntu5.3) ...
Selecting previously unselected package gir1.2-ibus-1.0:amd64.
Preparing to unpack .../30-gir1.2-ibus-1.0_1.5.17-3ubuntu5.3_amd64.deb ...
Unpacking gir1.2-ibus-1.0:amd64 (1.5.17-3ubuntu5.3) ...
Selecting previously unselected package libarchive-cpio-perl.
Preparing to unpack .../31-libarchive-cpio-perl_0.10-1_all.deb ...
Unpacking libarchive-cpio-perl (0.10-1) ...
Selecting previously unselected package libatk1.0-dev:amd64.
Preparing to unpack .../32-libatk1.0-dev_2.28.1-1_amd64.deb ...
Unpacking libatk1.0-dev:amd64 (2.28.1-1) ...
Selecting previously unselected package libaudio2:amd64.
Preparing to unpack .../33-libaudio2_1.9.4-6_amd64.deb ...
Unpacking libaudio2:amd64 (1.9.4-6) ...
Selecting previously unselected package libcairo-script-interpreter2:amd64.
Preparing to unpack .../34-libcairo-script-interpreter2_1.15.10-2ubuntu0.1_amd64.deb ...
Unpacking libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...
Selecting previously unselected package libpixman-1-dev:amd64.
Preparing to unpack .../35-libpixman-1-dev_0.34.0-2ubuntu0.1_amd64.deb ...
Unpacking libpixman-1-dev:amd64 (0.34.0-2ubuntu0.1) ...
Selecting previously unselected package libxcb-shm0-dev:amd64.
Preparing to unpack .../36-libxcb-shm0-dev_1.13-2~ubuntu18.04_amd64.deb ...
Unpacking libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...
Selecting previously unselected package libcairo2-dev:amd64.
Preparing to unpack .../37-libcairo2-dev_1.15.10-2ubuntu0.1_amd64.deb ...
Unpacking libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...
Selecting previously unselected package libcapnp-0.6.1:amd64.
Preparing to unpack .../38-libcapnp-0.6.1_0.6.1-1ubuntu1_amd64.deb ...
Unpacking libcapnp-0.6.1:amd64 (0.6.1-1ubuntu1) ...
Selecting previously unselected package libdbus-1-dev:amd64.
Preparing to unpack .../39-libdbus-1-dev_1.12.2-1ubuntu1.4_amd64.deb ...
Unpacking libdbus-1-dev:amd64 (1.12.2-1ubuntu1.4) ...
Selecting previously unselected package libfluidsynth1:amd64.
Preparing to unpack .../40-libfluidsynth1_1.1.9-1_amd64.deb ...
Unpacking libfluidsynth1:amd64 (1.1.9-1) ...
Selecting previously unselected package libfluidsynth-dev:amd64.
Preparing to unpack .../41-libfluidsynth-dev_1.1.9-1_amd64.deb ...
Unpacking libfluidsynth-dev:amd64 (1.1.9-1) ...
Selecting previously unselected package libgail18:amd64.
Preparing to unpack .../42-libgail18_2.24.32-1ubuntu1_amd64.deb ...
Unpacking libgail18:amd64 (2.24.32-1ubuntu1) ...
Selecting previously unselected package libgail-common:amd64.
Preparing to unpack .../43-libgail-common_2.24.32-1ubuntu1_amd64.deb ...
Unpacking libgail-common:amd64 (2.24.32-1ubuntu1) ...
Selecting previously unselected package libgdk-pixbuf2.0-dev.
Preparing to unpack .../44-libgdk-pixbuf2.0-dev_2.36.11-2_amd64.deb ...
Unpacking libgdk-pixbuf2.0-dev (2.36.11-2) ...
Selecting previously unselected package libgme-dev:amd64.
Preparing to unpack .../45-libgme-dev_0.6.2-1_amd64.deb ...
Unpacking libgme-dev:amd64 (0.6.2-1) ...
Selecting previously unselected package libgtk2.0-bin.
Preparing to unpack .../46-libgtk2.0-bin_2.24.32-1ubuntu1_amd64.deb ...
Unpacking libgtk2.0-bin (2.24.32-1ubuntu1) ...
Selecting previously unselected package libpango1.0-dev.
Preparing to unpack .../47-libpango1.0-dev_1.40.14-1ubuntu0.1_amd64.deb ...
Unpacking libpango1.0-dev (1.40.14-1ubuntu0.1) ...
Selecting previously unselected package x11proto-xinerama-dev.
Preparing to unpack .../48-x11proto-xinerama-dev_2018.4-4_all.deb ...
Unpacking x11proto-xinerama-dev (2018.4-4) ...
Selecting previously unselected package libxinerama-dev:amd64.
Preparing to unpack .../49-libxinerama-dev_2%3a1.1.3-1_amd64.deb ...
Unpacking libxinerama-dev:amd64 (2:1.1.3-1) ...
Selecting previously unselected package x11proto-input-dev.
Preparing to unpack .../50-x11proto-input-dev_2018.4-4_all.deb ...
Unpacking x11proto-input-dev (2018.4-4) ...
Selecting previously unselected package libxi-dev:amd64.
Preparing to unpack .../51-libxi-dev_2%3a1.7.9-1_amd64.deb ...
Unpacking libxi-dev:amd64 (2:1.7.9-1) ...
Selecting previously unselected package x11proto-randr-dev.
Preparing to unpack .../52-x11proto-randr-dev_2018.4-4_all.deb ...
Unpacking x11proto-randr-dev (2018.4-4) ...
Selecting previously unselected package libxrandr-dev:amd64.
Preparing to unpack .../53-libxrandr-dev_2%3a1.5.1-1_amd64.deb ...
Unpacking libxrandr-dev:amd64 (2:1.5.1-1) ...
Selecting previously unselected package libxcursor-dev:amd64.
Preparing to unpack .../54-libxcursor-dev_1%3a1.1.15-1_amd64.deb ...
Unpacking libxcursor-dev:amd64 (1:1.1.15-1) ...
Selecting previously unselected package x11proto-composite-dev.
Preparing to unpack .../55-x11proto-composite-dev_1%3a2018.4-4_all.deb ...
Unpacking x11proto-composite-dev (1:2018.4-4) ...
Selecting previously unselected package libxcomposite-dev:amd64.
Preparing to unpack .../56-libxcomposite-dev_1%3a0.4.4-2_amd64.deb ...
Unpacking libxcomposite-dev:amd64 (1:0.4.4-2) ...
Selecting previously unselected package libxml2-utils.
Preparing to unpack .../57-libxml2-utils_2.9.4+dfsg1-6.1ubuntu1.7_amd64.deb ...
Unpacking libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.7) ...
Selecting previously unselected package libgtk2.0-dev.
Preparing to unpack .../58-libgtk2.0-dev_2.24.32-1ubuntu1_amd64.deb ...
Unpacking libgtk2.0-dev (2.24.32-1ubuntu1) ...
Selecting previously unselected package libibus-1.0-dev:amd64.
Preparing to unpack .../59-libibus-1.0-dev_1.5.17-3ubuntu5.3_amd64.deb ...
Unpacking libibus-1.0-dev:amd64 (1.5.17-3ubuntu5.3) ...
Selecting previously unselected package libsys-hostname-long-perl.
Preparing to unpack .../60-libsys-hostname-long-perl_1.5-1_all.deb ...
Unpacking libsys-hostname-long-perl (1.5-1) ...
Selecting previously unselected package libmail-sendmail-perl.
Preparing to unpack .../61-libmail-sendmail-perl_0.80-1_all.deb ...
Unpacking libmail-sendmail-perl (0.80-1) ...
Selecting previously unselected package libmircore1:amd64.
Preparing to unpack .../62-libmircore1_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmircore1:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libmircommon7:amd64.
Preparing to unpack .../63-libmircommon7_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmircommon7:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libprotobuf-lite10:amd64.
Preparing to unpack .../64-libprotobuf-lite10_3.0.0-9.1ubuntu1_amd64.deb ...
Unpacking libprotobuf-lite10:amd64 (3.0.0-9.1ubuntu1) ...
Selecting previously unselected package libmirprotobuf3:amd64.
Preparing to unpack .../65-libmirprotobuf3_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmirprotobuf3:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libmirclient9:amd64.
Preparing to unpack .../66-libmirclient9_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmirclient9:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libmircore-dev:amd64.
Preparing to unpack .../67-libmircore-dev_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmircore-dev:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libprotobuf-dev:amd64.
Preparing to unpack .../68-libprotobuf-dev_3.0.0-9.1ubuntu1_amd64.deb ...
Unpacking libprotobuf-dev:amd64 (3.0.0-9.1ubuntu1) ...
Selecting previously unselected package libxkbcommon-dev:amd64.
Preparing to unpack .../69-libxkbcommon-dev_0.8.2-1~ubuntu18.04.1_amd64.deb ...
Unpacking libxkbcommon-dev:amd64 (0.8.2-1~ubuntu18.04.1) ...
Selecting previously unselected package libmircommon-dev:amd64.
Preparing to unpack .../70-libmircommon-dev_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmircommon-dev:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libmircookie2:amd64.
Preparing to unpack .../71-libmircookie2_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmircookie2:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libmircookie-dev:amd64.
Preparing to unpack .../72-libmircookie-dev_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmircookie-dev:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libmirclient-dev:amd64.
Preparing to unpack .../73-libmirclient-dev_0.31.1-0ubuntu1_amd64.deb ...
Unpacking libmirclient-dev:amd64 (0.31.1-0ubuntu1) ...
Selecting previously unselected package libopenal-dev:amd64.
Preparing to unpack .../74-libopenal-dev_1%3a1.18.2-2_amd64.deb ...
Unpacking libopenal-dev:amd64 (1:1.18.2-2) ...
Selecting previously unselected package libpulse-mainloop-glib0:amd64.
Preparing to unpack .../75-libpulse-mainloop-glib0_1%3a11.1-1ubuntu7.11_amd64.deb ...
Unpacking libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...
Selecting previously unselected package libpulse-dev:amd64.
Preparing to unpack .../76-libpulse-dev_1%3a11.1-1ubuntu7.11_amd64.deb ...
Unpacking libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...
Selecting previously unselected package libsndio-dev:amd64.
Preparing to unpack .../77-libsndio-dev_1.1.0-3_amd64.deb ...
Unpacking libsndio-dev:amd64 (1.1.0-3) ...
Selecting previously unselected package libudev-dev:amd64.
Preparing to unpack .../78-libudev-dev_237-3ubuntu10.56_amd64.deb ...
Unpacking libudev-dev:amd64 (237-3ubuntu10.56) ...
Selecting previously unselected package libxv-dev:amd64.
Preparing to unpack .../79-libxv-dev_2%3a1.0.11-1_amd64.deb ...
Unpacking libxv-dev:amd64 (2:1.0.11-1) ...
Selecting previously unselected package libsdl2-dev:amd64.
Preparing to unpack .../80-libsdl2-dev_2.0.8+dfsg1-1ubuntu1.18.04.4_amd64.deb ...
Unpacking libsdl2-dev:amd64 (2.0.8+dfsg1-1ubuntu1.18.04.4) ...
Selecting previously unselected package libwildmidi-config.
Preparing to unpack .../81-libwildmidi-config_0.4.2-1_all.deb ...
Unpacking libwildmidi-config (0.4.2-1) ...
Selecting previously unselected package libwildmidi2:amd64.
Preparing to unpack .../82-libwildmidi2_0.4.2-1_amd64.deb ...
Unpacking libwildmidi2:amd64 (0.4.2-1) ...
Selecting previously unselected package libwildmidi-dev.
Preparing to unpack .../83-libwildmidi-dev_0.4.2-1_amd64.deb ...
Unpacking libwildmidi-dev (0.4.2-1) ...
Selecting previously unselected package nasm.
Preparing to unpack .../84-nasm_2.13.02-0.1_amd64.deb ...
Unpacking nasm (2.13.02-0.1) ...
Selecting previously unselected package timidity.
Preparing to unpack .../85-timidity_2.13.2-41_amd64.deb ...
Unpacking timidity (2.13.2-41) ...
Selecting previously unselected package timidity-daemon.
Preparing to unpack .../86-timidity-daemon_2.13.2-41_all.deb ...
Unpacking timidity-daemon (2.13.2-41) ...
Setting up libdbus-1-dev:amd64 (1.12.2-1ubuntu1.4) ...
Setting up libxcursor-dev:amd64 (1:1.1.15-1) ...
Setting up gir1.2-atk-1.0:amd64 (2.28.1-1) ...
Setting up libgtk2.0-common (2.24.32-1ubuntu1) ...
Setting up libxkbcommon-dev:amd64 (0.8.2-1~ubuntu18.04.1) ...
Setting up libpulse-mainloop-glib0:amd64 (1:11.1-1ubuntu7.11) ...
Setting up libpulse-dev:amd64 (1:11.1-1ubuntu7.11) ...
Setting up libarchive-zip-perl (1.60-1ubuntu0.1) ...
Setting up libmircore-dev:amd64 (0.31.1-0ubuntu1) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...
Setting up libsigsegv2:amd64 (2.12-1) ...
Setting up libgme-dev:amd64 (0.6.2-1) ...
Setting up gir1.2-freedesktop:amd64 (1.56.1-1) ...
Setting up libsndio-dev:amd64 (1.1.0-3) ...
Setting up libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...
Setting up libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...
Setting up libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.7) ...
Setting up libarchive-cpio-perl (0.10-1) ...
Setting up gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...
Setting up libatk1.0-dev:amd64 (2.28.1-1) ...
Setting up gettext-base (0.19.8.1-6ubuntu0.3) ...
Setting up m4 (1.4.18-1) ...
Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...
Setting up gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...
Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...
Setting up libopenal-dev:amd64 (1:1.18.2-2) ...
Setting up libsys-hostname-long-perl (1.5-1) ...
Setting up libwildmidi-config (0.4.2-1) ...
Setting up libmircookie2:amd64 (0.31.1-0ubuntu1) ...
Setting up libgdk-pixbuf2.0-dev (2.36.11-2) ...
Setting up libmail-sendmail-perl (0.80-1) ...
Setting up x11proto-xinerama-dev (2018.4-4) ...
Setting up autotools-dev (20180224.1) ...
Setting up libpixman-1-dev:amd64 (0.34.0-2ubuntu0.1) ...
Setting up x11proto-randr-dev (2018.4-4) ...
Setting up libxinerama-dev:amd64 (2:1.1.3-1) ...
Setting up libxv-dev:amd64 (2:1.0.11-1) ...
Setting up nasm (2.13.02-0.1) ...
Setting up libcapnp-0.6.1:amd64 (0.6.1-1ubuntu1) ...
Setting up libibus-1.0-5:amd64 (1.5.17-3ubuntu5.3) ...
Setting up libmircore1:amd64 (0.31.1-0ubuntu1) ...
Setting up freepats (20060219-1) ...
Setting up libprotobuf-lite10:amd64 (3.0.0-9.1ubuntu1) ...
Setting up libudev-dev:amd64 (237-3ubuntu10.56) ...
Setting up libfluidsynth1:amd64 (1.1.9-1) ...
Setting up x11proto-input-dev (2018.4-4) ...
Setting up x11proto-composite-dev (1:2018.4-4) ...
Setting up autopoint (0.19.8.1-6ubuntu0.3) ...
Setting up libaudio2:amd64 (1.9.4-6) ...
Setting up libfile-stripnondeterminism-perl (0.040-1.1~build1) ...
Setting up libgtk2.0-0:amd64 (2.24.32-1ubuntu1) ...
Setting up gir1.2-ibus-1.0:amd64 (1.5.17-3ubuntu5.3) ...
Setting up libgail18:amd64 (2.24.32-1ubuntu1) ...
Setting up libxrandr-dev:amd64 (2:1.5.1-1) ...
Setting up libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...
Setting up gettext (0.19.8.1-6ubuntu0.3) ...
Setting up libxcomposite-dev:amd64 (1:0.4.4-2) ...
Setting up libmirprotobuf3:amd64 (0.31.1-0ubuntu1) ...
Setting up libprotobuf-dev:amd64 (3.0.0-9.1ubuntu1) ...
Setting up libgail-common:amd64 (2.24.32-1ubuntu1) ...
Setting up autoconf (2.69-11) ...
Setting up libmircookie-dev:amd64 (0.31.1-0ubuntu1) ...
Setting up libwildmidi2:amd64 (0.4.2-1) ...
Setting up file (1:5.32-2ubuntu0.4) ...
Setting up intltool-debian (0.35.0+20060710.4) ...
Setting up libibus-1.0-dev:amd64 (1.5.17-3ubuntu5.3) ...
Setting up automake (1:1.15.1-3ubuntu2) ...
update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode
Setting up libmircommon7:amd64 (0.31.1-0ubuntu1) ...
Setting up libxi-dev:amd64 (2:1.7.9-1) ...
Setting up libpango1.0-dev (1.40.14-1ubuntu0.1) ...
Setting up libfluidsynth-dev:amd64 (1.1.9-1) ...
Setting up timidity (2.13.2-41) ...
Setting up gir1.2-gtk-2.0 (2.24.32-1ubuntu1) ...
Setting up libgtk2.0-bin (2.24.32-1ubuntu1) ...
Setting up libtool (2.4.6-2) ...
Setting up po-debconf (1.0.20) ...
Setting up libwildmidi-dev (0.4.2-1) ...
Setting up libgtk2.0-dev (2.24.32-1ubuntu1) ...
Setting up libmirclient9:amd64 (0.31.1-0ubuntu1) ...
Setting up libmircommon-dev:amd64 (0.31.1-0ubuntu1) ...
Setting up timidity-daemon (2.13.2-41) ...
Adding group timidity....done
Adding system user timidity....done
Adding user `timidity' to group `audio' ...
Adding user timidity to group audio
Done.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up libmirclient-dev:amd64 (0.31.1-0ubuntu1) ...
Setting up libsdl2-dev:amd64 (2.0.8+dfsg1-1ubuntu1.18.04.4) ...
Setting up debhelper (11.1.6ubuntu2) ...
Setting up dh-autoreconf (17) ...
Setting up dh-strip-nondeterminism (0.040-1.1~build1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
Processing triggers for systemd (237-3ubuntu10.56) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
libboost-all-dev is already the newest version (1.65.1.0ubuntu1).
The following package was automatically installed and is no longer required:
libnvidia-common-460
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'liblua5.1-0-dev' instead of 'liblua5.1-dev'
The following package was automatically installed and is no longer required:
libnvidia-common-460
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
libtool-bin
The following NEW packages will be installed:
liblua5.1-0-dev libtool-bin
0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded.
Need to get 198 kB of archives.
After this operation, 1,188 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liblua5.1-0-dev amd64 5.1.5-8.1build2 [119 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtool-bin amd64 2.4.6-2 [79.5 kB]
Fetched 198 kB in 0s (401 kB/s)
Selecting previously unselected package liblua5.1-0-dev:amd64.
(Reading database ... 127170 files and directories currently installed.)
Preparing to unpack .../liblua5.1-0-dev_5.1.5-8.1build2_amd64.deb ...
Unpacking liblua5.1-0-dev:amd64 (5.1.5-8.1build2) ...
Selecting previously unselected package libtool-bin.
Preparing to unpack .../libtool-bin_2.4.6-2_amd64.deb ...
Unpacking libtool-bin (2.4.6-2) ...
Setting up libtool-bin (2.4.6-2) ...
Setting up liblua5.1-0-dev:amd64 (5.1.5-8.1build2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgtk2.0-dev is already the newest version (2.24.32-1ubuntu1).
python-numpy is already the newest version (1:1.13.3-2ubuntu1).
python-numpy set to manually installed.
libboost-all-dev is already the newest version (1.65.1.0ubuntu1).
cmake is already the newest version (3.10.2-1ubuntu2.18.04.2).
git is already the newest version (1:2.17.1-1ubuntu0.13).
libsdl2-dev is already the newest version (2.0.8+dfsg1-1ubuntu1.18.04.4).
The following package was automatically installed and is no longer required:
libnvidia-common-460
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Cloning into 'vizdoomgym'...
remote: Enumerating objects: 588, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 588 (delta 0), reused 0 (delta 0), pack-reused 585
Receiving objects: 100% (588/588), 184.91 KiB | 1.41 MiB/s, done.
Resolving deltas: 100% (314/314), done.
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Obtaining file:///content/vizdoomgym
Collecting vizdoom@ https://github.com/mwydmuch/ViZDoom/tarball/1.1.8pre
Downloading https://github.com/mwydmuch/ViZDoom/tarball/1.1.8pre
/ 4.9 MB 630 kB/s
Requirement already satisfied: gym in /usr/local/lib/python3.7/dist-packages (from vizdoomgym==1.0) (0.25.2)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from vizdoomgym==1.0) (1.21.6)
Collecting pre-commit
Downloading pre_commit-2.20.0-py2.py3-none-any.whl (199 kB)
|████████████████████████████████| 199 kB 7.3 MB/s
Requirement already satisfied: gym-notices>=0.0.4 in /usr/local/lib/python3.7/dist-packages (from gym->vizdoomgym==1.0) (0.0.8)
Requirement already satisfied: importlib-metadata>=4.8.0 in /usr/local/lib/python3.7/dist-packages (from gym->vizdoomgym==1.0) (4.13.0)
Requirement already satisfied: cloudpickle>=1.2.0 in /usr/local/lib/python3.7/dist-packages (from gym->vizdoomgym==1.0) (1.5.0)
Requirement already satisfied: typing-extensions>=3.6.4 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=4.8.0->gym->vizdoomgym==1.0) (4.1.1)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=4.8.0->gym->vizdoomgym==1.0) (3.10.0)
Collecting identify>=1.0.0
Downloading identify-2.5.9-py2.py3-none-any.whl (98 kB)
|████████████████████████████████| 98 kB 10.2 MB/s
Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.7/dist-packages (from pre-commit->vizdoomgym==1.0) (6.0)
Collecting nodeenv>=0.11.1
Downloading nodeenv-1.7.0-py2.py3-none-any.whl (21 kB)
Collecting virtualenv>=20.0.8
Downloading virtualenv-20.16.7-py3-none-any.whl (8.8 MB)
|████████████████████████████████| 8.8 MB 52.8 MB/s
Requirement already satisfied: toml in /usr/local/lib/python3.7/dist-packages (from pre-commit->vizdoomgym==1.0) (0.10.2)
Collecting cfgv>=2.0.0
Downloading cfgv-3.3.1-py2.py3-none-any.whl (7.3 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from nodeenv>=0.11.1->pre-commit->vizdoomgym==1.0) (57.4.0)
Collecting platformdirs<3,>=2.4
Downloading platformdirs-2.5.4-py3-none-any.whl (14 kB)
Collecting distlib<1,>=0.3.6
Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB)
|████████████████████████████████| 468 kB 57.6 MB/s
Requirement already satisfied: filelock<4,>=3.4.1 in /usr/local/lib/python3.7/dist-packages (from virtualenv>=20.0.8->pre-commit->vizdoomgym==1.0) (3.8.0)
Building wheels for collected packages: vizdoom
Building wheel for vizdoom (setup.py) ... done
Created wheel for vizdoom: filename=vizdoom-1.1.8-py3-none-any.whl size=14293734 sha256=41729e7ccdee470e3464c314767826ea247e00bcc7b811e887a413da5ca95074
Stored in directory: /tmp/pip-ephem-wheel-cache-kngpdfhy/wheels/00/85/76/b1bebad14608d5b4673739eaadae34d342637d7246cd65d706
Successfully built vizdoom
Installing collected packages: platformdirs, distlib, virtualenv, nodeenv, identify, cfgv, vizdoom, pre-commit, vizdoomgym
Running setup.py develop for vizdoomgym
Successfully installed cfgv-3.3.1 distlib-0.3.6 identify-2.5.9 nodeenv-1.7.0 platformdirs-2.5.4 pre-commit-2.20.0 virtualenv-20.16.7 vizdoom-1.1.8 vizdoomgym-1.0
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (7.1.2)
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting scipy==1.6.0
Downloading scipy-1.6.0-cp37-cp37m-manylinux1_x86_64.whl (27.4 MB)
|████████████████████████████████| 27.4 MB 1.6 MB/s
Requirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.7/dist-packages (from scipy==1.6.0) (1.21.6)
Installing collected packages: scipy
Attempting uninstall: scipy
Found existing installation: scipy 1.7.3
Uninstalling scipy-1.7.3:
Successfully uninstalled scipy-1.7.3
Successfully installed scipy-1.6.0
In [ ]:
Copied!
import os
os.kill(os.getpid(), 9)
import os
os.kill(os.getpid(), 9)
IMPORTANT NOTE: After installing all dependencies, restart your runtime¶
------------------------- IMAGE PREPROCESSING (image_preprocessing.py) -------------------------¶
Importing the libraries¶
In [1]:
Copied!
import numpy as np
""" issue :https://github.com/scipy/scipy/releases/tag/v1.3.0rc1 """
# from scipy.misc import imresize
"""solution : https://stackoverflow.com/questions/56260998/how-to-fix-cannot-import-name-imresize-error-while-this-function-importing-fr """
import cv2
from gym.core import ObservationWrapper
from gym.spaces.box import Box
import numpy as np
""" issue :https://github.com/scipy/scipy/releases/tag/v1.3.0rc1 """
# from scipy.misc import imresize
"""solution : https://stackoverflow.com/questions/56260998/how-to-fix-cannot-import-name-imresize-error-while-this-function-importing-fr """
import cv2
from gym.core import ObservationWrapper
from gym.spaces.box import Box
Preprocessing the images¶
In [2]:
Copied!
class PreprocessImage(ObservationWrapper):
def __init__(self, env, height = 64, width = 64, grayscale = True, crop = lambda img: img):
super(PreprocessImage, self).__init__(env)
self.img_size = (height, width)
self.grayscale = grayscale
self.crop = crop
n_colors = 1 if self.grayscale else 3
self.observation_space = Box(0.0, 1.0, [n_colors, height, width])
def observation(self, img):
img = self.crop(img)
# img = imresize(img, self.img_size)
img = cv2.resize(img, self.img_size)
if self.grayscale:
img = img.mean(-1, keepdims = True)
img = np.transpose(img, (2, 0, 1))
img = img.astype('float32') / 255.
return img
class PreprocessImage(ObservationWrapper):
def __init__(self, env, height = 64, width = 64, grayscale = True, crop = lambda img: img):
super(PreprocessImage, self).__init__(env)
self.img_size = (height, width)
self.grayscale = grayscale
self.crop = crop
n_colors = 1 if self.grayscale else 3
self.observation_space = Box(0.0, 1.0, [n_colors, height, width])
def observation(self, img):
img = self.crop(img)
# img = imresize(img, self.img_size)
img = cv2.resize(img, self.img_size)
if self.grayscale:
img = img.mean(-1, keepdims = True)
img = np.transpose(img, (2, 0, 1))
img = img.astype('float32') / 255.
return img
------------------------- EXPERIENCE REPLAY (experience_replay.py) -------------------------¶
Importing the libraries¶
In [3]:
Copied!
import numpy as np
from collections import namedtuple, deque
import numpy as np
from collections import namedtuple, deque
Defining One Step¶
In [4]:
Copied!
Step = namedtuple('Step', ['state', 'action', 'reward', 'done'])
Step
Step = namedtuple('Step', ['state', 'action', 'reward', 'done'])
Step
Out[4]:
__main__.Step
Making the AI progress on several (n_step) steps¶
In [5]:
Copied!
class NStepProgress:
def __init__(self, env, ai, n_step):
self.ai = ai
self.rewards = []
self.env = env
self.n_step = n_step
def __iter__(self):
state = self.env.reset()
history = deque()
reward = 0.0
while True:
action = self.ai(np.array([state]))[0][0]
next_state, r, is_done, _ = self.env.step(action)
reward += r
history.append(Step(state = state, action = action, reward = r, done = is_done))
while len(history) > self.n_step + 1:
history.popleft()
if len(history) == self.n_step + 1:
yield tuple(history)
state = next_state
if is_done:
if len(history) > self.n_step + 1:
history.popleft()
while len(history) >= 1:
yield tuple(history)
history.popleft()
self.rewards.append(reward)
reward = 0.0
state = self.env.reset()
history.clear()
def rewards_steps(self):
rewards_steps = self.rewards
self.rewards = []
return rewards_steps
class NStepProgress:
def __init__(self, env, ai, n_step):
self.ai = ai
self.rewards = []
self.env = env
self.n_step = n_step
def __iter__(self):
state = self.env.reset()
history = deque()
reward = 0.0
while True:
action = self.ai(np.array([state]))[0][0]
next_state, r, is_done, _ = self.env.step(action)
reward += r
history.append(Step(state = state, action = action, reward = r, done = is_done))
while len(history) > self.n_step + 1:
history.popleft()
if len(history) == self.n_step + 1:
yield tuple(history)
state = next_state
if is_done:
if len(history) > self.n_step + 1:
history.popleft()
while len(history) >= 1:
yield tuple(history)
history.popleft()
self.rewards.append(reward)
reward = 0.0
state = self.env.reset()
history.clear()
def rewards_steps(self):
rewards_steps = self.rewards
self.rewards = []
return rewards_steps
Implementing Experience Replay¶
In [6]:
Copied!
class ReplayMemory:
def __init__(self, n_steps, capacity = 10000):
self.capacity = capacity
self.n_steps = n_steps
self.n_steps_iter = iter(n_steps)
self.buffer = deque()
def sample_batch(self, batch_size): # creates an iterator that returns random batches
ofs = 0
vals = list(self.buffer)
np.random.shuffle(vals)
while (ofs+1)*batch_size <= len(self.buffer):
yield vals[ofs*batch_size:(ofs+1)*batch_size]
ofs += 1
def run_steps(self, samples):
while samples > 0:
entry = next(self.n_steps_iter) # 10 consecutive steps
self.buffer.append(entry) # we put 200 for the current episode
samples -= 1
while len(self.buffer) > self.capacity: # we accumulate no more than the capacity (10000)
self.buffer.popleft()
class ReplayMemory:
def __init__(self, n_steps, capacity = 10000):
self.capacity = capacity
self.n_steps = n_steps
self.n_steps_iter = iter(n_steps)
self.buffer = deque()
def sample_batch(self, batch_size): # creates an iterator that returns random batches
ofs = 0
vals = list(self.buffer)
np.random.shuffle(vals)
while (ofs+1)*batch_size <= len(self.buffer):
yield vals[ofs*batch_size:(ofs+1)*batch_size]
ofs += 1
def run_steps(self, samples):
while samples > 0:
entry = next(self.n_steps_iter) # 10 consecutive steps
self.buffer.append(entry) # we put 200 for the current episode
samples -= 1
while len(self.buffer) > self.capacity: # we accumulate no more than the capacity (10000)
self.buffer.popleft()
------------------------- AI FOR DOOM (ai.py) -------------------------¶
Importing the libraries¶
In [7]:
Copied!
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
Importing the packages for OpenAI and Doom¶
In [8]:
Copied!
import gym
import vizdoomgym
from gym import wrappers
import gym
import vizdoomgym
from gym import wrappers
Part 1 - Building the AI¶
Making the Brain¶
In [9]:
Copied!
class CNN(nn.Module):
def __init__(self, number_actions):
super(CNN, self).__init__()
self.convolution1 = nn.Conv2d(in_channels = 1, out_channels = 32, kernel_size = 5)
self.convolution2 = nn.Conv2d(in_channels = 32, out_channels = 32, kernel_size = 3)
self.convolution3 = nn.Conv2d(in_channels = 32, out_channels = 64, kernel_size = 2)
self.fc1 = nn.Linear(in_features = self.count_neurons((1, 256, 256)), out_features = 40)
self.fc2 = nn.Linear(in_features = 40, out_features = number_actions)
def count_neurons(self, image_dim):
x = Variable(torch.rand(1, *image_dim))
x = F.relu(F.max_pool2d(self.convolution1(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution2(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution3(x), 3, 2))
return x.data.view(1, -1).size(1)
def forward(self, x):
x = F.relu(F.max_pool2d(self.convolution1(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution2(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution3(x), 3, 2))
x = x.view(x.size(0), -1)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x
class CNN(nn.Module):
def __init__(self, number_actions):
super(CNN, self).__init__()
self.convolution1 = nn.Conv2d(in_channels = 1, out_channels = 32, kernel_size = 5)
self.convolution2 = nn.Conv2d(in_channels = 32, out_channels = 32, kernel_size = 3)
self.convolution3 = nn.Conv2d(in_channels = 32, out_channels = 64, kernel_size = 2)
self.fc1 = nn.Linear(in_features = self.count_neurons((1, 256, 256)), out_features = 40)
self.fc2 = nn.Linear(in_features = 40, out_features = number_actions)
def count_neurons(self, image_dim):
x = Variable(torch.rand(1, *image_dim))
x = F.relu(F.max_pool2d(self.convolution1(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution2(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution3(x), 3, 2))
return x.data.view(1, -1).size(1)
def forward(self, x):
x = F.relu(F.max_pool2d(self.convolution1(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution2(x), 3, 2))
x = F.relu(F.max_pool2d(self.convolution3(x), 3, 2))
x = x.view(x.size(0), -1)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x
Making the Body¶
In [10]:
Copied!
class SoftmaxBody(nn.Module):
def __init__(self, T):
super(SoftmaxBody, self).__init__()
self.T = T
def forward(self, outputs, number_actions=1):
probs = F.softmax(outputs * self.T)
actions = probs.multinomial(num_samples=number_actions)
return actions
class SoftmaxBody(nn.Module):
def __init__(self, T):
super(SoftmaxBody, self).__init__()
self.T = T
def forward(self, outputs, number_actions=1):
probs = F.softmax(outputs * self.T)
actions = probs.multinomial(num_samples=number_actions)
return actions
Making the AI¶
In [11]:
Copied!
class AI:
def __init__(self, brain, body):
self.brain = brain
self.body = body
def __call__(self, inputs):
input = Variable(torch.from_numpy(np.array(inputs, dtype = np.float32)))
output = self.brain(input)
actions = self.body(output)
return actions.data.numpy()
class AI:
def __init__(self, brain, body):
self.brain = brain
self.body = body
def __call__(self, inputs):
input = Variable(torch.from_numpy(np.array(inputs, dtype = np.float32)))
output = self.brain(input)
actions = self.body(output)
return actions.data.numpy()
Part 2 - Training the AI with Deep Convolutional Q-Learning¶
Getting the Doom environment¶
In [13]:
Copied!
doom_env = PreprocessImage(gym.make('VizdoomCorridor-v0'), width = 256, height = 256, grayscale = True)
"""AttributeError: module 'gym.wrappers' has no attribute 'Monitor' """
# doom_env = wrappers.Monitor(doom_env, "videos", force = True)
# doom_env = gym.wrappers.RecordEpisodeStatistics(doom_env, "videos", force = True)
doom_env = gym.wrappers.RecordVideo(doom_env, "videos")
# doom_env.render()
number_actions = doom_env.action_space.n
doom_env = PreprocessImage(gym.make('VizdoomCorridor-v0'), width = 256, height = 256, grayscale = True)
"""AttributeError: module 'gym.wrappers' has no attribute 'Monitor' """
# doom_env = wrappers.Monitor(doom_env, "videos", force = True)
# doom_env = gym.wrappers.RecordEpisodeStatistics(doom_env, "videos", force = True)
doom_env = gym.wrappers.RecordVideo(doom_env, "videos")
# doom_env.render()
number_actions = doom_env.action_space.n
/usr/local/lib/python3.7/dist-packages/gym/core.py:318: DeprecationWarning: WARN: Initializing wrapper in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future. "Initializing wrapper in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future." /usr/local/lib/python3.7/dist-packages/gym/wrappers/step_api_compatibility.py:40: DeprecationWarning: WARN: Initializing environment in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future. "Initializing environment in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future."
Building an AI¶
In [14]:
Copied!
cnn = CNN(number_actions)
softmax_body = SoftmaxBody(T = 1.0)
ai = AI(brain = cnn, body = softmax_body)
cnn = CNN(number_actions)
softmax_body = SoftmaxBody(T = 1.0)
ai = AI(brain = cnn, body = softmax_body)
Setting up Experience Replay¶
In [15]:
Copied!
n_steps = NStepProgress(env = doom_env, ai = ai, n_step = 10)
memory = ReplayMemory(n_steps = n_steps, capacity = 10000)
n_steps = NStepProgress(env = doom_env, ai = ai, n_step = 10)
memory = ReplayMemory(n_steps = n_steps, capacity = 10000)
Implementing Eligibility Trace¶
In [16]:
Copied!
def eligibility_trace(batch):
gamma = 0.99
inputs = []
targets = []
for series in batch:
input = Variable(torch.from_numpy(np.array([series[0].state, series[-1].state], dtype = np.float32)))
output = cnn(input)
cumul_reward = 0.0 if series[-1].done else output[1].data.max()
for step in reversed(series[:-1]):
cumul_reward = step.reward + gamma * cumul_reward
state = series[0].state
target = output[0].data
target[series[0].action] = cumul_reward
inputs.append(state)
targets.append(target)
return torch.from_numpy(np.array(inputs, dtype = np.float32)), torch.stack(targets)
def eligibility_trace(batch):
gamma = 0.99
inputs = []
targets = []
for series in batch:
input = Variable(torch.from_numpy(np.array([series[0].state, series[-1].state], dtype = np.float32)))
output = cnn(input)
cumul_reward = 0.0 if series[-1].done else output[1].data.max()
for step in reversed(series[:-1]):
cumul_reward = step.reward + gamma * cumul_reward
state = series[0].state
target = output[0].data
target[series[0].action] = cumul_reward
inputs.append(state)
targets.append(target)
return torch.from_numpy(np.array(inputs, dtype = np.float32)), torch.stack(targets)
Making the moving average on 100 steps¶
In [17]:
Copied!
class MA:
def __init__(self, size):
self.list_of_rewards = []
self.size = size
def add(self, rewards):
if isinstance(rewards, list):
self.list_of_rewards += rewards
else:
self.list_of_rewards.append(rewards)
while len(self.list_of_rewards) > self.size:
del self.list_of_rewards[0]
def average(self):
return np.mean(self.list_of_rewards)
ma = MA(100)
class MA:
def __init__(self, size):
self.list_of_rewards = []
self.size = size
def add(self, rewards):
if isinstance(rewards, list):
self.list_of_rewards += rewards
else:
self.list_of_rewards.append(rewards)
while len(self.list_of_rewards) > self.size:
del self.list_of_rewards[0]
def average(self):
return np.mean(self.list_of_rewards)
ma = MA(100)
Training the AI¶
In [18]:
Copied!
loss = nn.MSELoss()
optimizer = optim.Adam(cnn.parameters(), lr = 0.001)
nb_epochs = 20
for epoch in range(1, nb_epochs + 1):
memory.run_steps(samples=200)
for batch in memory.sample_batch(128):
inputs, targets = eligibility_trace(batch)
inputs, targets = Variable(inputs), Variable(targets)
predictions = cnn(inputs)
loss_error = loss(predictions, targets)
optimizer.zero_grad()
loss_error.backward()
optimizer.step()
rewards_steps = n_steps.rewards_steps()
ma.add(rewards_steps)
avg_reward = ma.average()
print("Epoch: %s, Average Reward: %s" % (str(epoch), str(avg_reward)))
loss = nn.MSELoss()
optimizer = optim.Adam(cnn.parameters(), lr = 0.001)
nb_epochs = 20
for epoch in range(1, nb_epochs + 1):
memory.run_steps(samples=200)
for batch in memory.sample_batch(128):
inputs, targets = eligibility_trace(batch)
inputs, targets = Variable(inputs), Variable(targets)
predictions = cnn(inputs)
loss_error = loss(predictions, targets)
optimizer.zero_grad()
loss_error.backward()
optimizer.step()
rewards_steps = n_steps.rewards_steps()
ma.add(rewards_steps)
avg_reward = ma.average()
print("Epoch: %s, Average Reward: %s" % (str(epoch), str(avg_reward)))
/usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:175: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator. "Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator." /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:191: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `return_info` to return information from the environment resetting. "Future gym versions will require that `Env.reset` can be passed `return_info` to return information from the environment resetting." /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:196: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information. "Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information." /usr/local/lib/python3.7/dist-packages/gym/wrappers/monitoring/video_recorder.py:90: UserWarning: WARN: Disabling video recorder because environment <PreprocessImage<OrderEnforcing<StepAPICompatibility<PassiveEnvChecker<VizdoomCorridor<VizdoomCorridor-v0>>>>>> was not initialized with any compatible video mode between `single_rgb_array` and `rgb_array` f"Disabling video recorder because environment {env} was not initialized with any compatible video " /usr/local/lib/python3.7/dist-packages/gym/core.py:44: DeprecationWarning: WARN: The argument mode in render method is deprecated; use render_mode during environment initialization instead. See here for more information: https://www.gymlibrary.ml/content/api/ "The argument mode in render method is deprecated; " /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:8: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument. /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:228: DeprecationWarning: WARN: Core environment is written in old step API which returns one bool instead of two. It is recommended to rewrite the environment with new step API. "Core environment is written in old step API which returns one bool instead of two. "
Epoch: 1, Average Reward: -107.89522552490234 Epoch: 2, Average Reward: -81.10867004394531 Epoch: 3, Average Reward: -37.05560111999512 Epoch: 4, Average Reward: 21.94904963175456 Epoch: 5, Average Reward: 70.51317138671875 Epoch: 6, Average Reward: 54.676299151252294 Epoch: 7, Average Reward: 36.71723697060033 Epoch: 8, Average Reward: 32.827680414373226 Epoch: 9, Average Reward: 35.313388188680015 Epoch: 10, Average Reward: 47.3538897479022 Epoch: 11, Average Reward: 81.94702253670528 Epoch: 12, Average Reward: 102.21445846557617 Epoch: 13, Average Reward: 111.37974417550224 Epoch: 14, Average Reward: 134.61105587607935 Epoch: 15, Average Reward: 144.8112967886576 Epoch: 16, Average Reward: 159.37986223087754 Epoch: 17, Average Reward: 157.8548824229139 Epoch: 18, Average Reward: 154.15594264439173 Epoch: 19, Average Reward: 169.00660705566406 Epoch: 20, Average Reward: 163.16806547982353
----- EXTRA CODE ONLY SPECIFIC TO THIS COLAB NOTEBOOK - VISUALIZING THE AI IN ACTION -----¶
Importing the libraries¶
In [20]:
Copied!
import os
import cv2
import glob
import gym
import vizdoomgym
import matplotlib.pyplot as plt
from collections import Counter
# from gym.wrappers import Monitor
from gym.wrappers import RecordVideo
import os
import cv2
import glob
import gym
import vizdoomgym
import matplotlib.pyplot as plt
from collections import Counter
# from gym.wrappers import Monitor
from gym.wrappers import RecordVideo
Printing the input shape and number of possible actions¶
In [22]:
Copied!
env = gym.make('VizdoomCorridor-v0')
action_num = env.action_space.n
print("Number of possible actions: ", action_num)
state = env.reset()
state, reward, done, info = env.step(env.action_space.sample())
print(state.shape)
env.close()
env = gym.make('VizdoomCorridor-v0')
action_num = env.action_space.n
print("Number of possible actions: ", action_num)
state = env.reset()
state, reward, done, info = env.step(env.action_space.sample())
print(state.shape)
env.close()
Number of possible actions: 7 (240, 320, 3)
Displaying a frame of the environment just to see how it is like¶
In [23]:
Copied!
observation = env.reset()
plt.imshow(observation)
plt.show()
print(observation.shape)
observation = env.reset()
plt.imshow(observation)
plt.show()
print(observation.shape)
(240, 320, 3)
Making a helper function for the visualization¶
In [30]:
Copied!
def wrap_env(env):
# env = Monitor(env, './vid',video_callable=lambda episode_id:True, force=True)
env = RecordVideo(env, './vid') #error when adding lambda as episode_trigger arg
return env
def wrap_env(env):
# env = Monitor(env, './vid',video_callable=lambda episode_id:True, force=True)
env = RecordVideo(env, './vid') #error when adding lambda as episode_trigger arg
return env
Running the AI on one episode¶
In [31]:
Copied!
gym_env = PreprocessImage(gym.make('VizdoomCorridor-v0'), width = 256, height = 256, grayscale = True)
# gym_env = wrappers.Monitor(gym_env, "videos", force = True)
gym_env = wrappers.RecordVideo(gym_env, "videos")
environment = wrap_env(gym_env)
done = False
observation = environment.reset()
new_observation = observation
actions_counter = Counter()
prev_input = None
img_array=[]
while True:
# Feeding the game screen and getting the Q values for each action
actions = cnn(Variable(Variable(torch.from_numpy(observation.reshape(1, 1, 256, 256)))))
# Getting the action
action = np.argmax(actions.detach().numpy(), axis=-1)
actions_counter[str(action)] += 1
# Selecting the action using epsilon greedy policy
environment.render()
observation = new_observation
# Now performing the action and moving to the next state, next_obs, receive reward
new_observation, reward, done, _ = environment.step(action)
img_array.append(new_observation)
if done:
# observation = env.reset()
break
environment.close()
gym_env = PreprocessImage(gym.make('VizdoomCorridor-v0'), width = 256, height = 256, grayscale = True)
# gym_env = wrappers.Monitor(gym_env, "videos", force = True)
gym_env = wrappers.RecordVideo(gym_env, "videos")
environment = wrap_env(gym_env)
done = False
observation = environment.reset()
new_observation = observation
actions_counter = Counter()
prev_input = None
img_array=[]
while True:
# Feeding the game screen and getting the Q values for each action
actions = cnn(Variable(Variable(torch.from_numpy(observation.reshape(1, 1, 256, 256)))))
# Getting the action
action = np.argmax(actions.detach().numpy(), axis=-1)
actions_counter[str(action)] += 1
# Selecting the action using epsilon greedy policy
environment.render()
observation = new_observation
# Now performing the action and moving to the next state, next_obs, receive reward
new_observation, reward, done, _ = environment.step(action)
img_array.append(new_observation)
if done:
# observation = env.reset()
break
environment.close()
/usr/local/lib/python3.7/dist-packages/gym/core.py:318: DeprecationWarning: WARN: Initializing wrapper in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future. "Initializing wrapper in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future." /usr/local/lib/python3.7/dist-packages/gym/wrappers/step_api_compatibility.py:40: DeprecationWarning: WARN: Initializing environment in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future. "Initializing environment in old step API which returns one bool instead of two. It is recommended to set `new_step_api=True` to use new step API. This will be the default behaviour in future." /usr/local/lib/python3.7/dist-packages/gym/wrappers/record_video.py:79: UserWarning: WARN: Overwriting existing videos at /content/videos folder (try specifying a different `video_folder` for the `RecordVideo` wrapper if this is not desired) f"Overwriting existing videos at {self.video_folder} folder " /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:175: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator. "Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator." /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:191: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `return_info` to return information from the environment resetting. "Future gym versions will require that `Env.reset` can be passed `return_info` to return information from the environment resetting." /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:196: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information. "Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information." /usr/local/lib/python3.7/dist-packages/gym/wrappers/monitoring/video_recorder.py:90: UserWarning: WARN: Disabling video recorder because environment <PreprocessImage<OrderEnforcing<StepAPICompatibility<PassiveEnvChecker<VizdoomCorridor<VizdoomCorridor-v0>>>>>> was not initialized with any compatible video mode between `single_rgb_array` and `rgb_array` f"Disabling video recorder because environment {env} was not initialized with any compatible video " /usr/local/lib/python3.7/dist-packages/gym/core.py:44: DeprecationWarning: WARN: The argument mode in render method is deprecated; use render_mode during environment initialization instead. See here for more information: https://www.gymlibrary.ml/content/api/ "The argument mode in render method is deprecated; " /usr/local/lib/python3.7/dist-packages/gym/wrappers/monitoring/video_recorder.py:90: UserWarning: WARN: Disabling video recorder because environment <RecordVideo<PreprocessImage<OrderEnforcing<StepAPICompatibility<PassiveEnvChecker<VizdoomCorridor<VizdoomCorridor-v0>>>>>>> was not initialized with any compatible video mode between `single_rgb_array` and `rgb_array` f"Disabling video recorder because environment {env} was not initialized with any compatible video " /usr/local/lib/python3.7/dist-packages/gym/core.py:50: DeprecationWarning: WARN: You are calling render method, but you didn't specified the argument render_mode at environment initialization. To maintain backward compatibility, the environment will render in human mode. If you want to render in human mode, initialize the environment in this way: gym.make('EnvName', render_mode='human') and don't call the render method. See here for more information: https://www.gymlibrary.ml/content/api/ "You are calling render method, " /usr/local/lib/python3.7/dist-packages/gym/utils/passive_env_checker.py:228: DeprecationWarning: WARN: Core environment is written in old step API which returns one bool instead of two. It is recommended to rewrite the environment with new step API. "Core environment is written in old step API which returns one bool instead of two. "
Outputting the video of the gameplay¶
In [32]:
Copied!
folder_name = "gameplay_frames"
video_name = "agent_gameplay.avi"
if not os.path.exists(folder_name):
os.makedirs(folder_name)
for i in range(len(img_array)):
plt.imsave("{}/{}_frame.jpg".format(folder_name, i), img_array[i].reshape(256, 256))
files = glob.glob(os.path.expanduser("{}/*".format(folder_name)))
frames_array = []
for filename in sorted(files, key=lambda t: os.stat(t).st_mtime):
img = cv2.imread(filename)
height, width, layers = img.shape
size = (width,height)
frames_array.append(img)
out = cv2.VideoWriter(video_name, cv2.VideoWriter_fourcc(*'DIVX'), 15, size)
for i in range(len(frames_array)):
out.write(frames_array[i])
out.release()
folder_name = "gameplay_frames"
video_name = "agent_gameplay.avi"
if not os.path.exists(folder_name):
os.makedirs(folder_name)
for i in range(len(img_array)):
plt.imsave("{}/{}_frame.jpg".format(folder_name, i), img_array[i].reshape(256, 256))
files = glob.glob(os.path.expanduser("{}/*".format(folder_name)))
frames_array = []
for filename in sorted(files, key=lambda t: os.stat(t).st_mtime):
img = cv2.imread(filename)
height, width, layers = img.shape
size = (width,height)
frames_array.append(img)
out = cv2.VideoWriter(video_name, cv2.VideoWriter_fourcc(*'DIVX'), 15, size)
for i in range(len(frames_array)):
out.write(frames_array[i])
out.release()
In [ ]:
Copied!