...
Code Block | ||
---|---|---|
| ||
$ docker run --rm -it lambda-stack:20.04 bash
root@fa416f6b82f5:~# pwd
/root
root@fa416f6b82f5:~# exit
$ |
So far, the container does not have access to the GPUs. To give it access to them, you need to change the runtime to nvidia
and explicitly specify a list of GPUs. The following example uses the first 2 GPUs:
...
A container is isolated from the host environment by default. Bind mounts allow you to mount a folder from the host machine into the container. TODO check terminology between bind mounts and volumes
Specify the path to the directory on host and the corresponding path inside the container using the -v
flag:
...
You can now use it in place of the LambdaStack container:
Code Block | ||
---|---|---|
| ||
$ docker run --rm pytorch-transformers \ python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))" libibverbs: Warning: couldn't open config directory '/etc/libibverbs.d'. libibverbs: Warning: couldn't open config directory '/etc/libibverbs.d'. No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english and revision af0f99b (https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english). Using a pipeline without specifying a model name and revision in production is not recommended. Downloading config.json: 100%|██████████| 629/629 [00:00<00:00, 1.45MB/s] Downloading pytorch_model.bin: 100%|██████████| 255M/255M [00:10<00:00, 24.5MB/s] Downloading tokenizer_config.json: 100%|██████████| 48.0/48.0 [00:00<00:00, 72.8kB/s] Downloading vocab.txt: 100%|██████████| 226k/226k [00:00<00:00, 295kB/s] [{'label': 'POSITIVE', 'score': 0.9998656511306763}] |
Containers can be deleted using the docker image rm
command. For example, remove the pytorch-transformers
container as follows:
Code Block |
---|
$ docker image rm pytorch-transformers
Untagged: pytorch-transformers:latest
Deleted: sha256:432c6be0a999484db090c5d9904e5c783454080d8ad8bc39e0499ace479c4559
Deleted: sha256:623ae3b33709c2fc4c40bc2c3959049345fee0087d39b4f53eb95aefd1c16f7d |
Next steps
TODO list references to go beyond the basics