-
Notifications
You must be signed in to change notification settings - Fork 35
6. Using Allie and Docker
Docker is useful to maintain Allie's functionality across multiple operating systems and production environments.
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.
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:
- annotating files
- augmenting files
- cleaning files
- collecting data
- featurizing files
- training models
- model predictions
- preprocessing / making transformers
- unit tests
- visualizing data
- new settings
docker run -it --entrypoint=/bin/bash allie_image
docker ps
Which outputs something like:
jim@Jims-MBP ~ % docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f50bb12f153a bf44486874e2 "/bin/sh -c 'pip3 in…" 6 minutes ago Up 6 minutes quizzical_herschel
85859e56efe3 allie_image "/bin/bash" 53 minutes ago Up 53 minutes lucid_pike
docker ps -aq
docker system prune
docker system prune --volumes
docker ps
----.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6001627decd allie_image "/bin/bash" 31 minutes ago Up 31 minutes youthful_ardinghelli
We now can remove a container with:
docker kill d6001627decd
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
Example: docker cp -a /Users/jim/desktop/sample_voice_data d6001627decd:/usr/src/app
If you want to copy files from the container to the host system, use this command:
docker cp container:source_path host_destination_path
Example: docker cp -a d6001627decd:/usr/src/app/train_dir /Users/jim/desktop/sample_voice_data
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 is also useful to extract trained machine learning models or featurized files and transferring them to your local computer or the cloud.