Giter Site home page Giter Site logo

ml-server-example's Introduction

Server examples

1) Setup the machine

1.1) First you need to ssh into your machine

Datacrunch:

replace PATH_TO_SSHKEY with the path to your local ssh key and IP_ADDRESS_SERVER with the server's IP address:

ssh -i ~/.ssh/PATH_TO_SSHKEY user@IP_ADDRESS_SERVER

Paperspace:

Use the password you received by email to login, replace IP_ADDRESS_SERVER with the server's IP address:

ssh paperspace@IP_ADDRESS_SERVER

1.2) Setup Jupyter notebook (reference):

Create a new env only for notebooks

conda create -n notebook_env jupyter nb_conda_kernels pip

Create the service file:

sudo touch /lib/systemd/system/ipython-notebook.service
sudo vim /lib/systemd/system/ipython-notebook.service

Example of service file for Paperspace. (eventually change the PATH, Jupyter notebook path / options, User, Group or WorkingDir.) Copy paste this in Vim (i, cmd+v, esc, :wq)

[Unit]
    Description=IPython notebook
[Service]
    Type=simple
    PIDFile=/var/run/ipython-notebook.pid
    Environment="PATH=/home/paperspace/anaconda3/envs/notebook_env/bin:/home/paperspace/bin:/home/paperspace/.local/bin:/usr/local/cuda-10.0/bin:/home/paperspace/anaconda3/condabin:/home/paperspace/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    ExecStart=/home/paperspace/anaconda3/envs/notebook_env/bin/jupyter-notebook --no-browser --notebook-dir=/home/paperspace --NotebookApp.token='my_pasword' --ip=0.0.0.0
    User=paperspace
    Group=paperspace
    WorkingDirectory=/home/paperspace
[Install]
    WantedBy=multi-user.target

Load and start the service:

sudo systemctl daemon-reload
sudo systemctl start ipython-notebook

Check if it's running:

sudo systemctl status ipython-notebook

Enable it so that the service start on boot

sudo systemctl enable ipython-notebook

you can connect to the notebook at: http://IP_ADDRESS_SERVER:8888/ and change kernel using the menu: 'kernel', 'change kernel' when starting a notebook

2) Use notebooks

2.1) clone this repo:

git clone https://github.com/gu-ma/ml-server-example.git

2.2) Stylegan2-ada

Create environment (you only need to do that once):

cd sg2ada
chmod +x create_env.sh
./create_env.sh

Quickfix(es)

For Stylegan2-ada to run on Paperspace we need to run this command once:

echo "export PATH=\"/usr/local/cuda-10.0/bin:\$PATH\" \nexport LD_LIBRARY_PATH=\"/usr/local/cuda-10.0/lib64:\$LD_LIBRARY_PATH\"" >> ~/.bashrc && \
source ~/.bashrc

Also, you might run into this error: NVlabs/stylegan2-ada#2

2.3) GPT2

Create environment (you only need to do that once):

cd gpt2
chmod +x create_env.sh
./create_env.sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.