发现推理的时候,只有一个python进程的CPU利用率是100%,其他的CPU都在围观,是不是没有用到并行计算?
希望所有的CPU利用率都打满,提高推理速度。
python cli_demo.py
Environment- OS: macOS 10.15.7 Intel
- Python: 3.8.16
- Transformers: 4.26.1
- PyTorch: 1.7.0
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) : No
(pytorch-1.7.0) ➜ ~ conda list
# packages in environment at /Users/taozhijiang/miniconda3/envs/pytorch-1.7.0:
#
# Name Version Build Channel
aiofiles 23.1.0 pypi_0 pypi
aiohttp 3.8.4 pypi_0 pypi
aiosignal 1.3.1 pypi_0 pypi
altair 4.2.2 pypi_0 pypi
anyio 3.6.2 pypi_0 pypi
appdirs 1.4.4 pyhd3eb1b0_0
async-timeout 4.0.2 pypi_0 pypi
attrs 22.2.0 pypi_0 pypi
blas 1.0 mkl
brotlipy 0.7.0 py38h9ed2024_1003
ca-certificates 2023.01.10 hecd8cb5_0
certifi 2022.12.7 py38hecd8cb5_0
cffi 1.15.1 py38h6c40b1e_3
charset-normalizer 2.0.4 pyhd3eb1b0_0
click 8.0.4 py38hecd8cb5_0
contourpy 1.0.7 pypi_0 pypi
cpm-kernels 1.0.11 pypi_0 pypi
cryptography 39.0.1 py38hf6deb26_0
cycler 0.11.0 pypi_0 pypi
dataclasses 0.8 pyh6d0b6a4_7
entrypoints 0.4 pypi_0 pypi
fastapi 0.95.0 pypi_0 pypi
ffmpy 0.3.0 pypi_0 pypi
filelock 3.9.0 py38hecd8cb5_0
flit-core 3.8.0 py38hecd8cb5_0
fonttools 4.39.2 pypi_0 pypi
frozenlist 1.3.3 pypi_0 pypi
fsspec 2023.3.0 pypi_0 pypi
gradio 3.23.0 pypi_0 pypi
h11 0.14.0 pypi_0 pypi
httpcore 0.16.3 pypi_0 pypi
httpx 0.23.3 pypi_0 pypi
huggingface-hub 0.13.3 pypi_0 pypi
icetk 0.0.4 pypi_0 pypi
idna 3.4 py38hecd8cb5_0
importlib-metadata 6.0.0 py38hecd8cb5_0
importlib-resources 5.12.0 pypi_0 pypi
importlib_metadata 6.0.0 hd3eb1b0_0
intel-openmp 2021.4.0 hecd8cb5_3538
jinja2 3.1.2 pypi_0 pypi
joblib 1.1.1 py38hecd8cb5_0
jsonschema 4.17.3 pypi_0 pypi
kiwisolver 1.4.4 pypi_0 pypi
libcxx 14.0.6 h9765a3e_0
libffi 3.4.2 hecd8cb5_6
libgfortran 5.0.0 11_3_0_hecd8cb5_28
libgfortran5 11.3.0 h9dfd629_28
libprotobuf 3.20.3 hfff2838_0
linkify-it-py 2.0.0 pypi_0 pypi
llvm-openmp 14.0.6 h0dcd299_0
markdown-it-py 2.2.0 pypi_0 pypi
markupsafe 2.1.2 pypi_0 pypi
matplotlib 3.7.1 pypi_0 pypi
mdit-py-plugins 0.3.3 pypi_0 pypi
mdurl 0.1.2 pypi_0 pypi
mkl 2021.4.0 hecd8cb5_637
mkl-service 2.4.0 py38h9ed2024_0
mkl_fft 1.3.1 py38h4ab4a9b_0
mkl_random 1.2.2 py38hb2f4e1b_0
mpmath 1.3.0 pypi_0 pypi
multidict 6.0.4 pypi_0 pypi
ncurses 6.4 hcec6c5f_0
networkx 3.0 pypi_0 pypi
numexpr 2.8.4 py38he696674_0
numpy 1.23.5 py38he696674_0
numpy-base 1.23.5 py38h9cd3388_0
openssl 1.1.1t hca72f7f_0
orjson 3.8.8 pypi_0 pypi
packaging 23.0 py38hecd8cb5_0
pandas 1.5.3 pypi_0 pypi
pillow 9.4.0 pypi_0 pypi
pip 23.0.1 py38hecd8cb5_0
pkgutil-resolve-name 1.3.10 pypi_0 pypi
pooch 1.4.0 pyhd3eb1b0_0
protobuf 3.20.0 pypi_0 pypi
pycparser 2.21 pyhd3eb1b0_0
pydantic 1.10.6 pypi_0 pypi
pydub 0.25.1 pypi_0 pypi
pyopenssl 23.0.0 py38hecd8cb5_0
pyparsing 3.0.9 pypi_0 pypi
pyrsistent 0.19.3 pypi_0 pypi
pysocks 1.7.1 py38_1
python 3.8.16 h218abb5_3
python-dateutil 2.8.2 pypi_0 pypi
python-multipart 0.0.6 pypi_0 pypi
pytz 2022.7.1 pypi_0 pypi
pyyaml 6.0 py38h6c40b1e_1
readline 8.2 hca72f7f_0
regex 2022.7.9 py38hca72f7f_0
requests 2.28.1 py38hecd8cb5_1
rfc3986 1.5.0 pypi_0 pypi
sacremoses 0.0.43 pyhd3eb1b0_0
scikit-learn 1.2.1 py38hcec6c5f_0
scipy 1.10.0 py38h91c6ef4_1
semantic-version 2.10.0 pypi_0 pypi
sentencepiece 0.1.97 pypi_0 pypi
setuptools 65.6.3 py38hecd8cb5_0
six 1.16.0 pyhd3eb1b0_1
sniffio 1.3.0 pypi_0 pypi
sqlite 3.41.1 h6c40b1e_0
starlette 0.26.1 pypi_0 pypi
sympy 1.11.1 pypi_0 pypi
threadpoolctl 2.2.0 pyh0d69192_0
tk 8.6.12 h5d9f67b_0
tokenizers 0.11.4 py38h8776b5c_1
toolz 0.12.0 pypi_0 pypi
torch 2.0.0 pypi_0 pypi
torchvision 0.15.1 pypi_0 pypi
tqdm 4.64.1 py38hecd8cb5_0
transformers 4.26.1 py_0 huggingface
typing-extensions 4.4.0 py38hecd8cb5_0
typing_extensions 4.4.0 py38hecd8cb5_0
uc-micro-py 1.0.1 pypi_0 pypi
urllib3 1.26.14 py38hecd8cb5_0
uvicorn 0.21.1 pypi_0 pypi
websockets 10.4 pypi_0 pypi
wheel 0.38.4 py38hecd8cb5_0
xz 5.2.10 h6c40b1e_1
yaml 0.2.5 haf1e3a3_0
yarl 1.8.2 pypi_0 pypi
zipp 3.11.0 py38hecd8cb5_0
zlib 1.2.13 h4dc903c_0