Giter Site home page Giter Site logo

dkr1818 / docker-colab-local Goto Github PK

View Code? Open in Web Editor NEW

This project forked from biplobsd/docker-colab-local

0.0 0.0 0.0 36 KB

A Docker container to act as a local runtime for Google Colab or private jupyter server with BERT preinstalled

Home Page: https://hub.docker.com/r/sorokine/docker-colab-local

Dockerfile 31.51% Shell 6.33% Python 62.16%

docker-colab-local's Introduction

docker-colab-local

Docker Cloud Build Status

A Docker container to act as a local runtime for Google Colab or private jupyter server with BERT preinstalled.

Run

$ docker run \
  --runtime=nvidia \
  -it --rm -p 8081:8081 \
  sorokine/docker-colab-local:latest

Or, to mount a volume so that it's accessible to colab:

$ docker run \
  --runtime=nvidia \
  -it --rm -p 8081:8081 \
  -v "$PWD":/opt/colab \
  sorokine/docker-colab-local:latest

where "$PWD" is a full path on your host machine to put your notebooks (other than the ones hosted on colab) and other files created by the notebooks (e.g., computed indices).

To make downloaded BERT models persistent run as:

$ docker run \
  --runtime=nvidia \
  -it --rm -p 8081:8081 \
  -v "$PWD":/opt/colab \
  -v $HOME/.cache/torch:/root/.cache/torch \
  sorokine/docker-colab-local:latest

This will use the same cache directory as the models run on the host (if your host is Linux or Mac).

Making Nvidia Work

  • on some docker versions replace --runtime=nvidia with --gpus all.
  • if you do not have a GPU or Nvidia drivers installed completely omit all nvidia flags from docker command. The notebook will work but it will be slow.
  • if you do not have the latest CUDA installed on your system check which tags are available in docker hub repo and use the one for your version of CUDA, e.g.:
$ docker run \
  --runtime=nvidia \
  -it --rm -p 8081:8081 \
  -v "$PWD":/opt/colab \
  -v $HOME/.cache/torch:/root/.cache/torch \
  sorokine/docker-colab-local:10.1
  • To find the version of CUDA on your system run nvidia-smi.

Connecting

If the container isn't running on your local machine, you'll need to forward port 8081. Run this command from the system where you are runing your browser:

$ ssh MACHINE_WHERE_DOCKER_IS_RUNNING -L 8081:localhost:8081

In Colaboratory, click the "Connect" button and select "Connect to local runtime...". Enter the port 8081 step in the dialog that appears and click the "Connect" button. (from colaboratory). Only localhost hostname is accepted (no numeric IPs). Replace the token in the dialog box with the token that is shown in the terminal after starting docker container. The connection string should look like http://localhost:8081/?token=abcdef123456.....

If your recieve an error like 0.0.0.0:8081 failed: port is already allocated.. try running container on a diferent port, for example for port 8082:

$ docker run \
  --runtime=nvidia \
  -it --rm -p 8082:8081 \
  -v "$PWD":/opt/colab \
  -v $HOME/.cache/torch:/root/.cache/torch \
  sorokine/docker-colab-local:latest

Colab notebooks expect the port in connection and on the server to be the same. To fix this problem without rebuilding the image forward the port with ssh:

$ ssh MACHINE_WHERE_DOCKER_IS_RUNNING -L 8081:localhost:8082

Notes

  • if some packages are missing install them with !pip install in your notebook. This has to be repeated on kernel restart.

TODO

plans and pressing ussues will go here

  • set jupyter port from docker CLI

docker-colab-local's People

Contributors

adriancampos avatar sorokine avatar biplobsd avatar

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.