赞
踩
- 在Path中添加 :%CONDA_HOME%
- 在Path中添加 :%CONDA_HOME%\Scripts
- 在Path中添加 :%CONDA_HOME%\Miniconda3\Library\bin
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- conda config --set show_channel_urls yes
- An HTTP error occurred when trying to retrieve this URL.
- HTTP errors are often intermittent, and a simple retry will get you on your way.
找到C盘:.condarc 文件(一般是在 C:\Users\你电脑的用户名 下,没有的话全盘搜索下)
打开.condarc 文件并替换内容为:
- channels:
- - defaults
- show_channel_urls: true
- default_channels:
- - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- custom_channels:
- conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
打开CMD输入conda clean -i 回车。
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
用python代码测试torch是否生效,如果不生效找对应cuda版本下载torch(torch.cuda.is_available()返回false则不生效)
- import torch
- print(torch.__version__)
- print(torch.cuda.is_available())
2. 创建conda工程:
打开CMD将目录CD到工程内。
执行命令:conda create --name ChatGLM-6B python=3.10.10
激活conda工程:conda activate ChatGLM-6B
- pip install pip -U
- pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
- pip install streamlit -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
- pip install streamlit_chat -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
- pip install chardet -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
执行Demo :streamlit run web_demo2.py 输入Email。
复制URL到浏览器则可以预览:
模型下载完成才可以正常对话,如果报错换下VPN节点多试几次
python api.py
默认部署在本地的 8000 端口,通过 POST 方法进行调用
- curl -X POST "http://127.0.0.1:8000" \
- -H 'Content-Type: application/json' \
- -d '{"prompt": "你好", "history": []}'
得到的返回值为
- {
- "response":"你好 本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/348575推荐阅读
相关标签
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。