本文主要是介绍Docker部署Azure chatgpt样例应用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Github地址
https://github.com/microsoft/sample-app-aoai-chatGPT?tab=readme-ov-file#environment-variables
使用Amazon Linux 2 AMI 的arm 64版本镜像, t4g.medium实例。
需要安装git,可能需要安装 pip3等
sudo apt-get install -y python3-pip
然后从如下地址clone代码
https://github.com/microsoft/sample-app-aoai-chatGPT.git
如果不使用requirement.txt安装依赖库,则可能会提示没有版本号,需要如下方法解决
python3 -m pip install --user --upgrade pip
requirement.txt中需要注意版本号,因为Dockerfile需要从中读取flask、werkzeug等版本信息,否则会出现版本号不对应等问题。
Name: Werkzeug
Version: 2.2.3Name: Flask
Version: 2.2.2Name: requests
Version: 2.31.0urllib3==1.26.15uvicorn==0.24.0gunicorn==20.1.0
openai对应api的版本问题
安装和启动docker 等
yum install docker
sudo systemctl restart docker
生成等
sudo docker build -t 'gpt' .
sudo docker run -d -p 80:80 --name chatgpt gpt
注意:需要用到4G及内存以上,否则会在在docker build时,报错
=> [frontend 9/9] RUN npm run build 250.2s => => # [16:0xffffbaf195c0] 31747 ms: Mark-Compact (reduce) 917.1 (938.4) -> 917.0 (939.1) MB, 966.76 / 0.02 ms (+ 29.4 ms in 6 steps since start of marking, biggest ste => => # p 12.0 ms, walltime since start of marking 1018 ms) (average mu = 0.337, current mu = 0.19[16:0xffffbaf195c0] 33415 ms: Mark-Compact (reduce) 919.1 (940.6) -> 918 => => # .8 (941.1) MB, 1450.30 / 0.00 ms (average mu = 0.227, current mu = 0.130) allocation failure; GC in old space requested => => # <--- JS stacktrace ---> => => # FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory => => # ----- Native stack trace -----
这篇关于Docker部署Azure chatgpt样例应用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!