Meta-Llama-3-8B-Instruct 本地推理
基础环境信息(wsl2安装Ubuntu22.04 + miniconda)
使用miniconda搭建环境
(base) :~$ conda create --name pytorch212 python=3.10
Retrieving notices: ...working... done
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done
environment location: /home/chop/miniconda3/envs/pytorch212
added / updated specs:
- python=3.10
The following NEW packages will be INSTALLED:
_libgcc_mutex anaconda/pkgs/main/linux-64::_libgcc_mutex-0.1-main
_openmp_mutex anaconda/pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
bzip2 anaconda/pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_5
ca-certificates anaconda/pkgs/main/linux-64::ca-certificates-2024.3.11-h06a4308_0
ld_impl_linux-64 anaconda/pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1
libffi anaconda/pkgs/main/linux-64::libffi-3.4.4-h6a678d5_0
libgcc-ng anaconda/pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
libgomp anaconda/pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
libstdcxx-ng anaconda/pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
libuuid anaconda/pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0
ncurses anaconda/pkgs/main/linux-64::ncurses-6.4-h6a678d5_0
openssl anaconda/pkgs/main/linux-64::openssl-3.0.13-h7f8727e_0
pip anaconda/pkgs/main/linux-64::pip-23.3.1-py310h06a4308_0
python anaconda/pkgs/main/linux-64::python-3.10.14-h955ad1f_0
readline anaconda/pkgs/main/linux-64::readline-8.2-h5eee18b_0
setuptools anaconda/pkgs/main/linux-64::setuptools-68.2.2-py310h06a4308_0
sqlite anaconda/pkgs/main/linux-64::sqlite-3.41.2-h5eee18b_0
tk anaconda/pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0
tzdata anaconda/pkgs/main/noarch::tzdata-2024a-h04d1e81_0
wheel anaconda/pkgs/main/linux-64::wheel-0.41.2-py310h06a4308_0
xz anaconda/pkgs/main/linux-64::xz-5.4.6-h5eee18b_0
zlib anaconda/pkgs/main/linux-64::zlib-1.2.13-h5eee18b_0
Proceed ([y]/n)? y
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) :~$ conda activate pytorch212
下载Llama-Chinese
(pytorch212) :~$git init
(pytorch212) :~$git clone https://github.com/LlamaFamily/Llama-Chinese.git
(pytorch212) :~$ cd Llama-Chinese
(pytorch212) :~/Llama-Chinese$ ls
README.md README_EN.md assets data docker docs examples inference-speed requirements.txt scripts train
安装所需要的软件包
(pytorch212) :~/Llama-Chinese/Llama-Chinese$ pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torch==2.1.2 (from -r requirements.txt (line 1))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/03/f1/13137340776dd5d5bcfd2574c9c6dfcc7618285035cd77240496e5c1a79b/torch-2.1.2-cp310-cp310-manylinux1_x86_64.whl (670.2 MB)
Requirement already satisfied: bitsandbytes==0.42.0 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (0.42.0)
Requirement already satisfied: accelerate==0.27.2 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 3)) (0.27.2)
Requirement already satisfied: numpy==1.26.4 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 4)) (1.26.4)
Requirement already satisfied: gekko==1.0.6 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 5)) (1.0.6)
Requirement already satisfied: pandas in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 6)) (2.2.2)
Requirement already satisfied: scipy in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 7)) (1.13.0)
Requirement already satisfied: sentencepiece==0.2.0 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 8)) (0.2.0)
Requirement already satisfied: datasets in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 9)) (2.19.0)
Requirement already satisfied: evaluate in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 10)) (0.4.1)
Requirement already satisfied: pytest in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 11)) (8.1.1)
Requirement already satisfied: peft==0.8.2 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 12)) (0.8.2)
Requirement already satisfied: transformers==4.39.0 in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 13)) (4.39.0)
Collecting deepspeed==0.14.0 (from -r requirements.txt (line 14))
Using cached deepspeed-0.14.0-py3-none-any.whl
Requirement already satisfied: scikit-learn in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 15)) (1.4.2)
Requirement already satisfied: torchvision in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 16)) (0.17.2)
Requirement already satisfied: torchdata in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 17)) (0.7.1)
Requirement already satisfied: torchaudio in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 18)) (2.2.2)
Requirement already satisfied: tensorboard in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 19)) (2.16.2)
Requirement already satisfied: gradio in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 20)) (4.27.0)
Requirement already satisfied: packaging in /home/chop/.local/lib/python3.10/site-packages (from -r requirements.txt (line 21)) (24.0)
Requirement already satisfied: filelock in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (3.13.4)
Requirement already satisfied: typing-extensions in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (4.11.0)
Requirement already satisfied: sympy in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (1.12)
Requirement already satisfied: networkx in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (3.3)
Requirement already satisfied: jinja2 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (3.1.3)
Requirement already satisfied: fsspec in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (2024.3.1)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (12.1.105)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (12.1.105)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (12.1.105)
Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (8.9.2.26)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (12.1.3.1)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (11.0.2.54)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (10.3.2.106)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (11.4.5.107)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (12.1.0.106)
Collecting nvidia-nccl-cu12==2.18.1 (from torch==2.1.2->-r requirements.txt (line 1))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a4/05/23f8f38eec3d28e4915725b233c24d8f1a33cb6540a882f7b54be1befa02/nvidia_nccl_cu12-2.18.1-py3-none-manylinux1_x86_64.whl (209.8 MB)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /home/chop/.local/lib/python3.10/site-packages (from torch==2.1.2->-r requirements.txt (line 1)) (12.1.105)
Collecting triton==2.1.0 (from torch==2.1.2->-r requirements.txt (line 1))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4d/22/91a8af421c8a8902dde76e6ef3db01b258af16c53d81e8c0d0dc13900a9e/triton-2.1.0-0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (89.2 MB)
Requirement already satisfied: psutil in /home/chop/.local/lib/python3.10/site-packages (from accelerate==0.27.2->-r requirements.txt (line 3)) (5.9.8)
Collecting pyyaml (from accelerate==0.27.2->-r requirements.txt (line 3))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/29/61/bf33c6c85c55bc45a29eee3195848ff2d518d84735eb0e2d8cb42e0d285e/PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)
Requirement already satisfied: huggingface-hub in /home/chop/.local/lib/python3.10/site-packages (from accelerate==0.27.2->-r requirements.txt (line 3)) (0.22.2)
Requirement already satisfied: safetensors>=0.3.1 in /home/chop/.local/lib/python3.10/site-packages (from accelerate==0.27.2->-r requirements.txt (line 3)) (0.4.3)
Requirement already satisfied: tqdm in /home/chop/.local/lib/python3.10/site-packages (from peft==0.8.2->-r requirements.txt (line 12)) (4.66.2)
Requirement already satisfied: regex!=2019.12.17 in /home/chop/.local/lib/python3.10/site-packages (from transformers==4.39.0->-r requirements.txt (line 13)) (2024.4.16)
Requirement already satisfied: requests in /home/chop/.local/lib/python3.10/site-packages (from transformers==4.39.0->-r requirements.txt (line 13)) (2.31.0)
Requirement already satisfied: tokenizers<0.19,>=0.14 in /home/chop/.local/lib/python3.10/site-packages (from transformers==4.39.0->-r requirements.txt (line 13)) (0.15.2)
Collecting hjson (from deepspeed==0.14.0->-r requirements.txt (line 14))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/1f/7f/13cd798d180af4bf4c0ceddeefba2b864a63c71645abc0308b768d67bb81/hjson-3.1.0-py3-none-any.whl (54 kB)
Collecting ninja (from deepspeed==0.14.0->-r requirements.txt (line 14))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/6d/92/8d7aebd4430ab5ff65df2bfee6d5745f95c004284db2d8ca76dcbfd9de47/ninja-1.11.1.1-py2.py3-none-manylinux1_x86_64.manylinux_2_5_x86_64.whl (307 kB)
Collecting py-cpuinfo (from deepspeed==0.14.0->-r requirements.txt (line 14))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e0/a9/023730ba63db1e494a271cb018dcd361bd2c917ba7004c3e49d5daf795a2/py_cpuinfo-9.0.0-py3-none-any.whl (22 kB)
Requirement already satisfied: pydantic in /home/chop/.local/lib/python3.10/site-packages (from deepspeed==0.14.0->-r requirements.txt (line 14)) (2.7.0)
Collecting pynvml (from deepspeed==0.14.0->-r requirements.txt (line 14))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5b/9c/adb8070059caaa15d5a572b66bccd95900d8c1b9fa54d6ecea6ae97448d1/pynvml-11.5.0-py3-none-any.whl (53 kB)
Requirement already satisfied: nvidia-nvjitlink-cu12 in /home/chop/.local/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch==2.1.2->-r requirements.txt (line 1)) (12.4.127)
Requirement already satisfied: python-dateutil>=2.8.2 in /home/chop/.local/lib/python3.10/site-packages (from pandas->-r requirements.txt (line 6)) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /home/chop/.local/lib/python3.10/site-packages (from pandas->-r requirements.txt (line 6)) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in /home/chop/.local/lib/python3.10/site-packages (from pandas->-r requirements.txt (line 6)) (2024.1)
Requirement already satisfied: pyarrow>=12.0.0 in /home/chop/.local/lib/python3.10/site-packages (from datasets->-r requirements.txt (line 9)) (16.0.0)
Requirement already satisfied: pyarrow-hotfix in /home/chop/.local/lib/python3.10/site-packages (from datasets->-r requirements.txt (line 9)) (0.6)
Requirement already satisfied: dill<0.3.9,>=0.3.0 in /home/chop/.local/lib/python3.10/site-packages (from datasets->-r requirements.txt (line 9)) (0.3.8)
Requirement already satisfied: xxhash in /home/chop/.local/lib/python3.10/site-packages (from datasets->-r requirements.txt (line 9)) (3.4.1)
Requirement already satisfied: multiprocess in /home/chop/.local/lib/python3.10/site-packages (from datasets->-r requirements.txt (line 9)) (0.70.16)
Requirement already satisfied: aiohttp in /home/chop/.local/lib/python3.10/site-packages (from datasets->-r requirements.txt (line 9)) (3.9.5)
Requirement already satisfied: responses<0.19 in /home/chop/.local/lib/python3.10/site-packages (from evaluate->-r requirements.txt (line 10)) (0.18.0)
Requirement already satisfied: iniconfig in /home/chop/.local/lib/python3.10/site-packages (from pytest->-r requirements.txt (line 11)) (2.0.0)
Requirement already satisfied: pluggy<2.0,>=1.4 in /home/chop/.local/lib/python3.10/site-packages (from pytest->-r requirements.txt (line 11)) (1.5.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /home/chop/.local/lib/python3.10/site-packages (from pytest->-r requirements.txt (line 11)) (1.2.1)
Requirement already satisfied: tomli>=1 in /home/chop/.local/lib/python3.10/site-packages (from pytest->-r requirements.txt (line 11)) (2.0.1)
Requirement already satisfied: joblib>=1.2.0 in /home/chop/.local/lib/python3.10/site-packages (from scikit-learn->-r requirements.txt (line 15)) (1.4.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/chop/.local/lib/python3.10/site-packages (from scikit-learn->-r requirements.txt (line 15)) (3.4.0)
INFO: pip is looking at multiple versions of torchvision to determine which version is compatible with other requirements. This could take a while.
Collecting torchvision (from -r requirements.txt (line 16))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/1a/e8/13432ae6be567b577a4c89d1bd50084e4d989b379a7be8050380b5ab3a6e/torchvision-0.17.1-cp310-cp310-manylinux1_x86_64.whl (6.9 MB)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d8/51/55393d57c2d95311b1675c8cd37d307f5022460cf98746e4df882dfb415c/torchvision-0.17.0-cp310-cp310-manylinux1_x86_64.whl (6.9 MB)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/da/ae/76bd3682465730dea7be21f36a8160a911a470de6f26228904f222e7fefe/torchvision-0.16.2-cp310-cp310-manylinux1_x86_64.whl (6.8 MB)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /home/chop/.local/lib/python3.10/site-packages (from torchvision->-r requirements.txt (line 16)) (10.3.0)
Requirement already satisfied: urllib3>=1.25 in /home/chop/.local/lib/python3.10/site-packages (from torchdata->-r requirements.txt (line 17)) (2.2.1)
INFO: pip is looking at multiple versions of torchaudio to determine which version is compatible with other requirements. This could take a while.
Collecting torchaudio (from -r requirements.txt (line 18))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ce/99/7485966a902905e206eda57fdca8de69545c107e33eefe9f6536c2dda16c/torchaudio-2.2.1-cp310-cp310-manylinux1_x86_64.whl (3.3 MB)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/30/fc/cdcf7c2071539ea147ddb6de2b538d9c1599665b621f2e6cf0b3ef51d20d/torchaudio-2.2.0-cp310-cp310-manylinux1_x86_64.whl (3.3 MB)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/25/83/4170df23c16c25818ce9591fd2b8109cda3f725d115d77417d4efef4eb46/torchaudio-2.1.2-cp310-cp310-manylinux1_x86_64.whl (3.3 MB)
Requirement already satisfied: absl-py>=0.4 in /home/chop/.local/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (2.1.0)
Requirement already satisfied: grpcio>=1.48.2 in /home/chop/.local/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (1.62.2)
Requirement already satisfied: markdown>=2.6.8 in /home/chop/.local/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (3.6)
Requirement already satisfied: protobuf!=4.24.0,>=3.19.6 in /home/chop/.local/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (5.26.1)
Requirement already satisfied: setuptools>=41.0.0 in /home/chop/miniconda3/envs/pytorch212/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (68.2.2)
Collecting six>1.9 (from tensorboard->-r requirements.txt (line 19))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /home/chop/.local/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (0.7.2)
Requirement already satisfied: werkzeug>=1.0.1 in /home/chop/.local/lib/python3.10/site-packages (from tensorboard->-r requirements.txt (line 19)) (3.0.2)
Requirement already satisfied: aiofiles<24.0,>=22.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (23.2.1)
Requirement already satisfied: altair<6.0,>=4.2.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (5.3.0)
Requirement already satisfied: fastapi in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.110.2)
Requirement already satisfied: ffmpy in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.3.2)
Requirement already satisfied: gradio-client==0.15.1 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.15.1)
Requirement already satisfied: httpx>=0.24.1 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.27.0)
Requirement already satisfied: importlib-resources<7.0,>=1.3 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (6.4.0)
Requirement already satisfied: markupsafe~=2.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (2.1.5)
Requirement already satisfied: matplotlib~=3.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (3.8.4)
Requirement already satisfied: orjson~=3.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (3.10.1)
Requirement already satisfied: pydub in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.25.1)
Requirement already satisfied: python-multipart>=0.0.9 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.0.9)
Requirement already satisfied: ruff>=0.2.2 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.4.1)
Requirement already satisfied: semantic-version~=2.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (2.10.0)
Requirement already satisfied: tomlkit==0.12.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.12.0)
Requirement already satisfied: typer<1.0,>=0.12 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.12.3)
Requirement already satisfied: uvicorn>=0.14.0 in /home/chop/.local/lib/python3.10/site-packages (from gradio->-r requirements.txt (line 20)) (0.29.0)
Requirement already satisfied: websockets<12.0,>=10.0 in /home/chop/.local/lib/