...
Code Block |
---|
|
$ docker run --rm lambda-stack:20.04 ls
TODO add outputpwd
/root |
The --rm
flag ensures that the container is stopped and cleanup after usage. TODO clarify/check this
...
Code Block |
---|
|
$ docker run --rm -it lambda-stack:20.04 bash
TODOroot@fa416f6b82f5:~# addexit
output$ |
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:
...
Code Block |
---|
|
$ mkdir hugging_container
$ echo "FROM lambda-stack:20.04" > hugging_container/Dockerfile
$ echo "pip installRUN pip install transformers[torch]" >> hugging_container/Dockerfile |
...
Code Block |
---|
$ docker image ls
TODO output
REPOSITORY TAG IMAGE ID CREATED SIZE
pytorch-transformers latest 432c6be0a999 13 seconds ago 12.1GB
lambda-stack 20.04 abe4a492cee1 6 days ago 12GB
ubuntu latest df5de72bdb3b 4 weeks ago 77.8MB
ubuntu 20.04 3bc6e9f30f51 4 weeks ago 72.8MB
debian latest 07d9246c53a6 4 weeks ago 124MB
nvidia/cuda 11.0.3-base-ubuntu20.04 8017f5c31b74 6 weeks ago 122MB
hello-world latest feb5d9fea6a5 11 months ago 13.3kB |
You can now use it in place of the LambdaStack container:
Code Block |
---|
|
$ docker run --rm pytorch-transformers \
python -c "import "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))"
TODO output
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}] |
Next steps
TODO list references to go beyond the basics