一、下载Ollama
在线安装:
在linux中输入命令curl -fsSL https://ollama.com/install.sh | sh
由于在linux下载ollama需要经过外网,网络会不稳定,很容易造成毗连超时的问题。
离线安装:
步骤一: 下载Ollama离线版本
在linux服务器中输入命令:lscpu查看服务器型号
然后再该地址中下载Ollama离线版本:
https://github.com/ollama/ollama/releases
步骤二: 下载install.sh文件修改内容
地址为:https://ollama.com/install.sh
修改位置1:
解释掉在线下载ollama的命令
修改位置2:
修改ollama安装地址,将ollama离线版本与install放到一起
install.sh最终修改的版本:
出现该内容说明Ollama已经安装完成
二、启动Nginx并部署Vue
启动nginx命令:systemctl start nginx.service
查看nginx状态:systemctl status nginx.service
关闭nginx命令:systemctl stop nginx.service
修改子配置文件,因为子配置文件内是写http的内容。
nginx服务所在地址为:/etc/nginx/sites-available
进入该目录编辑default文件:vim default
- index index.html index.htm index.nginx-debian.html;
- # First attempt to serve request as file, then
- # as directory, then fall back to displaying a 404.
- try_files $uri $uri/ @router;
- }
- location @router {
- rewrite ^.*$ /index.html last;
- }
复制代码 如果你前端使用的是vue并且用了vue-router,那么就需要配置该代码,否则你举行router跳转的时候,就会出现404的问题。
三、启动Python脚本
进入存放python脚本的目录,运行命令:python xxx.py。运行脚本后,体系可能会提示有一些模块没有安装,按照提示安装即可。
命令:pip install module_name
其中可能有些脚本提示不对,比如:
ModuleNotFoundError: No module named 'docx'
如果出现这个问题,不能直接安装docx模块,而是应该安装python-docx。
将该安装的库全部安装后,进入放置python脚本的目录启动入口文件,短暂启动命令:python ai_analysis.py
长期后台运行命令:
nohup python ai_analysis.py /opt/app/llm_python/ai_analysis_project/log 2>&1
四、目前项目需要的库
使用MimiCPM需要的库,官方测试所用的环境:
Pillow10.1.0
torch2.1.2 / 1.13.0(本来的库版本)
torchvision0.16.2 / 0.17.1(本来的库版本)
transformers4.40.0
sentencepiece0.1.99
accelerate0.30.1
bitsandbytes==0.43.1
AI分析所需要的库
langchain
langchain_community
分析文档所需要的库
pandasai
python-docx
fitz
faiss-gpu (conda install faiss-gpu -c pytorch)
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |