参考视频:
【DeepSeek+LoRA+FastAPI】开发人员如何微调大模型并暴露接口给后端调用
按照博主的视频安装之后遇到一些问题,可能是博主使用的lunix , 而我使用的是windows又或是博主租用的服务器会有一些基础配置,所以按照步骤安装会报一些错误。
1. pip install -e ".[torch,metrics]"报错
- 查看.condarc配置文件,将default删除,替换成国内的镜像源
show_channel_urls: true
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
envs_dirs:
- D:\Software\LLaMA-Factory
- e:\llama-factory-domain
2. 运行llamafactory-cli webui报错
1. 提示`llamafactory-cli version
Traceback (most recent call last):llamafactory-cli version
Traceback (most recent call last):证明没有成功安装llamafactory,需要重新安装一下,这里需要注意,响应的版本安装最新版可能会发生版本不适配的情况
pip install llama-factory=4.44.1 --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
`
2. 报错`File “D:\Software\LLaMA-Factory\LLaMA-Factory\lib\site-packages\httpx_transports\default.py”, line 153, in init
ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
File “D:\Software\LLaMA-Factory\LLaMA-Factory\lib\site-packages\httpx_config.py”, line 35, in create_ssl_context
ctx = ssl.create_default_context(cafile=os.environ[“SSL_CERT_FILE”])
File “D:\Software\LLaMA-Factory\LLaMA-Factory\lib\ssl.py”, line 766, in create_default_context
context.load_verify_locations(cafile, capath, cadata)
FileNotFoundError: [Errno 2] No such file or directory`
- 手动设置正确的 SSL_CERT_FILE 环境变量,指向 Python 安装目录中的 cacert.pem 文件。
- 如果找不到 cacert.pem 文件,可以从 cURL 官方仓库下载并放置到正确的目录。
- 设置后还会出现找不到的情况,可以使用命令`echo %SSL_CERT_FILE% `查看实际的位置并通过`set SSL_CERT_FILE=C:\Python310\DLLs\cacert.pem`手动更改一下
3. `ERROR: Exception in ASGI application
Traceback (most recent call last): - 检查依赖,一般正常安装的话不会出现依赖问题,尝试通过
pip install llama-factory=4.44.1 --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple修改一下版本 -
TypeError: argument of type ‘bool’ is not iterable
Traceback报错,在路径
/src/llamafactory/webui/interface.py下将
global_share属性值修改为
True`
- ` ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.`
是由于组件版本不一致导致,重新安装制定版本的组件即可`pip install pydantic==2.10.6`
4. Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps:按照步骤下载即可
- Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_windows_amd64.exe
- Rename the downloaded file to: frpc_windows_amd64_v0.2
- Move the file to this location: D:\Software\LLaMA-Factory\LLaMA-Factory\lib\site-packages\gradio