Loading

llama-factory实现挂载和解决gradio web时效问题

使用nohup挂载

encrypoint.sh

source /data/develop/hjy/LLaMA-Factory/.venv/bin/activate
llamafactory-cli webui
(base) $ source ./entrypoint.sh 
: No such file or directory
Running on local URL:  http://0.0.0.0:7861
Running on public URL: https://ae90836e94d3ceee52.gradio.live

改为

nohup bash entrypoint.sh > logs/logfile.log 2>&1 &

logfile.logs

nohup: ignoring input
entrypoint.sh: line 1: /data/develop/hjy/LLaMA-Factory/.venv/bin/activate
: No such file or directory

出现问题:执行以下命令可以请求到,但logfile.logs就是不显示

curl http://0.0.0.0:7861

于是手动激活虚拟环境

source .venv/bin/activate

修改encrypoint.sh

#!/bin/bash
llamafactory-cli webui

执行脚本成功~

bash entrypoint.sh

接下来使用nohup:

nohup bash entrypoint.sh > logs/logfile.log 2>&1 &

logfiles.log:

nohup: ignoring input

执行成功了,但是看不到gradio的日志

解决方法:
在 entrypoint.sh加入

export PYTHONUNBUFFERED=1

使用pm2挂载

尝试采用pm2:

(base) [hongjiayin@localhost LLaMA-Factory]$ pm2 start start.sh
node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)

start.sh

source .venv/bin/activate
pm2 start entrypoint.sh --name llama-factory --log /data/develop/hjy/LLaMA-Factory/logs/logfile.log
deactivate

entrypoint.sh

USE_MODELSCOPE_HUB=1
llamafactory-cli webui

检查pm2

# 查看pm2 是否已安装
which pm2
# 查看当前安装的CXXABI版本
(base)$ strings /usr/lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1

设置share link为永久

由于llama-factory项目的web ui是用gradio 构建,
执行命令 llamafactory-cli webui 显示

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)

意思:“这个地址只有72小时,如获得永久的地址,需要运行 gradio deploy 命令来部署到 huggingface 的空间上。
解决方法参考:
https://blog.csdn.net/fogdragon/article/details/131496615

出现:Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.
找到//.venv/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.2 授予权限

posted @ 2024-09-28 17:34  踩坑大王  阅读(56)  评论(0编辑  收藏  举报