系统为arm64架构,区别于一般的x86,很多软件安装起来较为繁琐。
下面是一个dockerfile,安装transformers:
FROM nvcr.io/nvidia/l4t-pytorch:r32.6.1-pth1.9-py3
RUN rm /usr/bin/python && ln -s /usr/bin/python3.6 /usr/bin/python && ln -s /usr/bin/pip3 /usr/bin/pip
RUN apt-get update --fix-missing && apt-get install -y git
RUN echo Asia/Shanghai > /etc/localtime && echo Asia/Shanghai > /etc/timezone && apt-get install tzdata
# 安装transformers,依赖tokenizers库,需要rust编译
RUN apt-get install curl -y
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN pip install setuptools_rust==1.1.2
RUN cp /root/.cargo/bin/rustc /root/.cargo/bin/cargo /usr/bin/
RUN git config --global url."https://hub.fastgit.org/".insteadOf "https://github.com/"
RUN pip install transformers==4.6.1 -i https://mirrors.aliyun.com/pypi/simple/
# 通过apt-get安装pandas scitkit-learn,直接pip安装可能失败
RUN apt-get -y install python3-pandas python3-sklearn