Installing DBNsim
Requirements
For running DBNsim on you own server you will need:
- Some knowledge of the command line interface of your machine;
- An intepreter for Python 2.7 (not Python 3);
- the pip package manager for Python 2, which should be shipped with a standard Python installation;
- optionally (for GPU support) the NVIDIA drivers for CUDA.
Please note that you have to use Python 2 (preferably 2.7), not Python 3! This is beacause, unfortunately, DBNsim currently depends on two libraries that are only available for Python 2.
If you have installed Python under Windows but your command line says it doesn't recognize the commands pip
and python
, then you just have to add Python to your path. This is generally done by going to System Properties / Advanced / Environment Variables.
Basic installation
For installing DBNsim (both for CPU and GPU usage) follow these steps:
git clone https://github.com/ggiuffre/DBNsim.git cd DBNsim pip install --user -r requirements.txt
In addition, it is recommended to install scipy, with the command pip install --user scipy
. Windows user may find it difficult but this is currently an optional dependency; the only thing is that without it you won't be able to handle MATLAB files as an administrator (see here).
If you don't have Git installed, you can still go to the GitHub repo, click "Clone or Download", then "Download ZIP"; now extract the archive, and then cd
into the extracted directory.
Adding GPU support
If you have a CUDA-enabled GPU, you can install CUDAMat. To install it, first exit the DBNsim
directory (this is very important) — a simple way to exit the directory is to cd
into your home directory; then execute the following commands:
git clone https://github.com/cudamat/cudamat.git cd cudamat pip install --user .
As before, if you don't have Git installed you can download a zipped version of CUDAMat from GitHub.
If you get errors while installing with pip
, make sure you have the CUDA drivers installed, along with the NVIDIA CUDA compiler (nvcc). If you're using Ubuntu, then you can install them with:
sudo apt-get install nvidia-cuda-toolkit
After you manage to install CUDAMat, remember to test it. To do this, exit the cudamat
directory (this is very important), enter a Python interpreter and type:
import numpy as np import cudamat as cm cm.cublas_init() a = cm.CUDAMatrix(np.random.rand(32, 256)) b = cm.CUDAMatrix(np.random.rand(256, 32)) c = cm.dot(a, b) d = c.sum(axis = 0) print(d.asarray())
Launching DBNsim
Finally, launch DBNsim with:
cd path/to/DBNsim python DBNsite/manage.py runserver
... this actually launches DBNsim only locally. Instead, if you want other users to access it, type:
cd path/to/DBNsim python DBNsite/manage.py runserver your.public.ip.address:8000
You should see something like:
Performing system checks... loading data from pickle... loading data from pickle... loading data from pickle... loading data from pickle... System check identified no issues (0 silenced). June 22, 2017 - 16:02:15 Django version 1.11.2, using settings 'DBNsite.settings' Starting development server at http://your.public.ip.address:8000/ Quit the server with CONTROL-C.
This means the server is up and running. Now you should find the user interface at http://127.0.0.1:8000
if you're running the app locally. Or, if you're publishing it to a network, you should find it at http://your.public.ip.address:8000
. 8000 is just an example — you can run DBNsim on any port you have access to.
Once you're on the page, you will be asked for a password. If the server administrator didn't change the default configuration, the password is user.
When you want to shut down the server, return to the command line interface and press CONTROL-C.
Changing the default configuration
As the server administrator, you have more power than normal users. It is possible to configure DBNsim under the following aspects:
- you can edit the available training datasets, removing them and/or adding new ones;
- you can set a password that the users have to know in order to use the app;
- you can alter the default values of the hyper-parameters (e.g. you can set a default value of 0.5 for the learning rate, if the user doesn't change it on the form);
- you can change some graphical parameters in the user interface.
For more about how to change the configuration, please read here.