Skip to content

6. Using Allie and Docker

Jim Schwoebel edited this page Aug 11, 2020 · 18 revisions

Docker is useful to maintain Allie's functionality across multiple operating systems and production environments.

Installing Docker

First, you have to install Docker Desktop. You can do this at this link.

Note if you are on MacOS you should avoid using brew install docker as this may cause some things to break.

Creating an Allie Docker container

Type this into the terminal to build a docker container from Allie's custom base image:

git clone [email protected]:jim-schwoebel/allie.git
cd allie 
docker build -t allie_image .

...
------------------------------
-----------------^^^-----------------------
-------------^^^^---^^^^-------------------
-----------CLEANUP TEMP FILES--------------
---------^^^^^^^^^^^^^^^^^^^^^^------------
deleting temp files from FFmpeg and SoX tests
-------------------------------------------
deleting temp files load_dir tests
-------------------------------------------
deleting temp model files (audio, text, image, and video)
-------------------------------------------
[nltk_data] Downloading package punkt to /root/nltk_data...
[nltk_data]   Unzipping tokenizers/punkt.zip.
[nltk_data] Downloading package averaged_perceptron_tagger to
[nltk_data]     /root/nltk_data...
[nltk_data]   Unzipping taggers/averaged_perceptron_tagger.zip.
[nltk_data] Downloading package wordnet to /root/nltk_data...
[nltk_data]   Unzipping corpora/wordnet.zip.
Removing intermediate container 02ebf5460c38
 ---> 1f2cf4f18e07
Successfully built 1f2cf4f18e07
Successfully tagged allie_image:latest

Then you can use the terminal to use the Docker container as if it were your own computer:

docker run -it --entrypoint=/bin/bash allie_image

You can now use the Allie CLI by typing in:

python3 allie.py -h

Which should output some ways you can use Allie:

Usage: allie.py [options]

Options:
  -h, --help            show this help message and exit
  --c=command, --command=command
                        the target command (annotate API = 'annotate',
                        augmentation API = 'augment',  cleaning API = 'clean',
                        datasets API = 'data',  features API = 'features',
                        model prediction API = 'predict',  preprocessing API =
                        'transform',  model training API = 'train',  testing
                        API = 'test',  visualize API = 'visualize',
                        list/change default settings = 'settings')
  --p=problemtype, --problemtype=problemtype
                        specify the problem type ('c' = classification or 'r'
                        = regression)
  --s=sampletype, --sampletype=sampletype
                        specify the type files that you'd like to operate on
                        (e.g. 'audio', 'text', 'image', 'video', 'csv')
  --n=common_name, --name=common_name
                        specify the common name for the model (e.g. 'gender'
                        for a male/female problem)
  --i=class_, --class=class_
                        specify the class that you wish to annotate (e.g.
                        'male')
  --d=dir, --dir=dir    an array of the target directory (or directories) that
                        contains sample files for the annotation API,
                        prediction API, features API, augmentation API,
                        cleaning API, and preprocessing API (e.g.
                        '/Users/jim/desktop/allie/train_dir/teens/')

For more information on how to use the Allie CLI, check out the Allie CLI tutorial or any of the links below:

Copying files into directories from host computer in Docker

If you want to copy files from your host system to the container, you should use docker cp command like this:

docker cp host_source_path container:destination_path

If you want to copy files from the container to the host system, use this command:

docker cp container:source_path host_destination_path

These are the most important commands to prepare datasets on a host computer and use them in the Docker container to use Allie's CLI capabilities.

Note that this section was extracted from this tutorial.