forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (30 loc) · 1.34 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#---
# name: transformers
# config: config.py
# group: llm
# depends: [pytorch, torchvision, huggingface_hub, rust]
# test: [test.py, huggingface-benchmark.py]
# docs: docs.md
# notes: bitsandbytes and auto_gptq dependencies added on JetPack5 for 4-bit/8-bit quantization
#---
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ARG TRANSFORMERS_PACKAGE=transformers
ARG TRANSFORMERS_VERSION=https://pypi.org/pypi/transformers/json
ADD ${TRANSFORMERS_VERSION} /tmp/transformers_version.json
# if you want optimum[exporters,onnxruntime] see the optimum package
RUN pip3 install --no-cache-dir --verbose \
accelerate \
optimum \
sentencepiece
# install from pypi, git, ect (sometimes other version got installed)
RUN pip3 uninstall -y transformers && \
pip3 install --no-cache-dir --verbose ${TRANSFORMERS_PACKAGE}
# "/usr/local/lib/python3.8/dist-packages/transformers/modeling_utils.py", line 118
# AttributeError: module 'torch.distributed' has no attribute 'is_initialized'
RUN PYTHON_ROOT=`pip3 show transformers | grep Location: | cut -d' ' -f2` && \
sed -i 's|torch.distributed.is_initialized|torch.distributed.is_available|g' -i ${PYTHON_ROOT}/transformers/modeling_utils.py
# add benchmark script
COPY huggingface-benchmark.py /usr/local/bin
# make sure it loads
RUN pip3 show transformers && python3 -c 'import transformers; print(transformers.__version__)'