工作:一个是近年的大模型,一个是远一点的算法模型;一个用的torch一个用的tensorflow
我不管什么conda版本管理,一会install,一会uninstall,一会改了我这个包,一会删了那个包,一会是什么python版本有问题,一会是cython编译有问题,一会是cuda有个so找不到,一会是onnx导出和使用的版本不一致,MLGB,CNMB,KAO,烦....................(省略1万字)
准备torch:
pytorch-wheels-cu118安装包下载_开源镜像站-阿里云
下载本地tensorflow 2.6.0 GPU+CPU (限制最高python 3.9)
没错,要下两个,只下GPU 找不到 compat.v1 那个包
开始Pip 安装(还得是自己管理版本依赖.......)
汇总得到如下环境(python 3.9 + numpy 1.19.5 torch 2.0.1 tensorflow 2.6)
注意点:
1, tensorflow 限制 numpy 版本 ~=1.19.2,它还限制很多东西,很麻烦,比如protobuf,datasets,typing-extensions.....
2, 即便已经安装了某个包,比如 numpy,为了限制其他包安装时不更改numpy的版本,
所以install时把这个numpy==1.19.5 也一起带上
3, 安装过程,如果发现有包即将下载更改重要的包,立刻停止,然后把那个重要的包==版本带上
[重要的包:
numpy, scipy, protobuf, onnx....]
>>>
pip install numpy==1.19.5 scipy==1.6.0 seaborn==0.11.0 matplotlib==3.3.4 pandas==1.2.0 scikit-learn==1.0
pip install protobuf==3.20.0
pip install modelscope==1.15.0
pip install typing-extensions~=3.7.4
pip install datasets==2.18.0
pip install diffusers==0.24.0
pip install huggingface-hub==0.25.1
pip install transformers==4.45.2
pip install numpy==1.19.5 controlnet-aux==0.0.9 scipy==1.6.0 scikit-image==0.18.1
pip install cython==3.0.11
pip install cmake==3.29.2
pip install numpy==1.19.5 onnx==1.14.0 protobuf==3.20.2 insightface==0.7.3
pip install typing-extensions~=3.7.4 albumentations==1.0
pip install accelerate
pip install mmcv==1.4.8 mmcv-full==1.7.2 mmdet==2.26.0
pip install onnxruntime==1.10.0
短短十几行,,配了我两天,,不是东边的包改了西边的包,就是北面的包不兼容南边的包,MLGB,CNMB.........
运行时遇到的一些问题:
1. transformers 导入 CLIPProcessor 出现 Unpack 找不到 问题 (typing-extensions~=3.7.4版本太低,但是tensorflow又不支持更高的版本)
既然没有,那就注释掉,,,,
如果还有问题,网上应该有解释,,,我这边打开关闭太多网页,已经忘了......不过至少比上面的环境依赖好弄一点,CAO
pip requirement 环境导出如下:(自己校对一下)
absl-py==0.15.0
accelerate==1.5.2
addict==2.4.0
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
albumentations==1.0.0
aliyun-python-sdk-core==2.16.0
aliyun-python-sdk-kms==2.16.5
asttokens==3.0.0
astunparse==1.6.3
async-timeout==5.0.1
attrs==25.3.0
certifi==2024.12.14
cffi==1.17.1
charset-normalizer==3.4.1
clang==5.0
cmake==3.29.2
comm==0.2.2
controlnet-aux==0.0.9
crcmod==1.7
cryptography==44.0.2
cycler==0.12.1
Cython==3.0.11
datasets==2.18.0
debugpy==1.8.13
decorator==5.2.1
diffusers==0.24.0
dill==0.3.7
easydict==1.13
einops==0.8.1
exceptiongroup==1.2.2
executing==2.2.0
filelock==3.18.0
flatbuffers==1.12
frozenlist==1.5.0
fsspec==2023.10.0
gast==0.4.0
google-pasta==0.2.0
grpcio==1.70.0
h5py==3.1.0
huggingface-hub==0.25.1
idna==3.10
imageio==2.37.0
importlib_metadata==8.6.1
insightface==0.7.3
ipykernel==6.29.5
ipython==8.18.1
jedi==0.19.2
Jinja2==3.1.6
jmespath==0.10.0
joblib==1.4.2
jupyter_client==8.6.3
jupyter_core==5.7.2
keras==2.6.0
Keras-Preprocessing==1.1.2
kiwisolver==1.4.7
lazy_loader==0.4
libclang==18.1.1
lit==18.1.8
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.3.4
matplotlib-inline==0.1.7
mdurl==0.1.2
mmcv==1.4.8
mmcv-full==1.7.2
mmdet==2.26.0
modelscope==1.15.0
mpmath==1.3.0
multidict==6.0.5
multiprocess==0.70.15
namex==0.0.8
nest-asyncio==1.6.0
networkx==3.2.1
numpy==1.19.5
onnx==1.14.0
onnxruntime==1.10.0
opencv-python==4.11.0.86
opencv-python-headless==4.10.0.84
opt-einsum==3.3.0
oss2==2.19.1
packaging==24.2
pandas==1.2.0
parso==0.8.4
pexpect==4.9.0
pillow==11.1.0
platformdirs==4.3.7
prettytable==3.16.0
prompt_toolkit==3.0.50
propcache==0.3.1
protobuf==3.20.2
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyarrow==19.0.1
pyarrow-hotfix==0.6
pycocotools==2.0.8
pycparser==2.22
pycryptodome==3.22.0
Pygments==2.19.1
pyparsing==3.2.3
python-dateutil==2.9.0.post0
pytz==2025.2
PyWavelets==1.4.1
PyYAML==6.0.2
pyzmq==26.3.0
qudida==0.0.4
regex==2024.11.6
requests==2.32.3
safetensors==0.5.3
scikit-image==0.18.1
scikit-learn==1.0
scipy==1.6.0
seaborn==0.11.0
simplejson==3.20.1
six==1.15.0
sortedcontainers==2.4.0
stack-data==0.6.3
sympy==1.13.3
tensorboard==2.18.0
tensorboard-data-server==0.7.2
tensorflow-cpu @ file:///root/download/tensorflow_cpu-2.6.0-cp39-cp39-manylinux2010_x86_64.whl#sha256=d2458b6e061151048d89fabf82207eb8a7e0527b64bdd6ac61c5a5d5255d087e
tensorflow-estimator==2.15.0
tensorflow-gpu @ file:///root/download/tensorflow_gpu-2.6.0-cp39-cp39-manylinux2010_x86_64.whl#sha256=412b6e2683df7071b65aa2faeac576e4acb33f178963a3001b88c639a6f1f5f5
tensorflow-io-gcs-filesystem==0.37.1
termcolor==1.1.0
terminaltables==3.1.10
threadpoolctl==3.6.0
tifffile==2024.8.30
timm==0.6.7
tokenizers==0.20.3
tomli==2.2.1
torch @ file:///root/download/torch-2.0.1%2Bcu118-cp39-cp39-linux_x86_64.whl#sha256=eb55f29db5744eda8a96f5594e637daed0d52278273005de759970e67cfa6a5a
torchvision @ file:///root/download/torchvision-0.15.2%2Bcu118-cp39-cp39-linux_x86_64.whl#sha256=f2c6f5a100bcf9020b82f5d4c87cd7e26af0409cf33b90fb797b1127dcd42de6
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
transformers==4.45.2
triton==2.0.0
typing-extensions==3.7.4.3
tzdata==2025.2
urllib3==2.3.0
wcwidth==0.2.13
Werkzeug==3.1.3
wrapt==1.12.1
xxhash==3.5.0
yapf==0.43.0
yarl==1.18.3
zipp==3.21.0