xinference 使用命令实践记录

1. qwen-chat 模型相关的参数组合,以决定它能够怎样跑在各种推理引擎上

命令

xinference engine -e http://0.0.0.0:9997 --model-name qwen-chat

结果

2.  将 qwen-chat 跑在 VLLM 推理引擎上,但是我不知道什么样的其他参数符合这个要求。

命令: 

xinference engine -e http://0.0.0.0:9997 --model-name qwen-chat --model-engine vllm

3. 加载 GGUF 格式的 qwen-chat 模型,我需要知道其余的参数组合

命令

xinference engine -e http://0.0.0.0:9997 --model-name qwen-chat -f ggufv2

4. 运行一个内置的 llama-2-chat 模型。 当你需要运行一个模型时,第一次运行是要从HuggingFace 下载模型参数, 一般来说需要根据模型大小下载10到30分钟不等。 当下载完成后,Xinference本地会有缓存的处理,以后再运行相同的模型不需要重新下载 由于国内下载不了 HuggingFace , 在启动 xinference-local 时 增加变量 export HF_ENDPOINT=https://hf-mirror.com 指定国内镜像

事先查询一下

xinference engine -e http://0.0.0.0:9997 --model-name llama-2-chat --model-engine vllm

运行命令

xinference launch --model-engine vllm -u my-llama-2 -n llama-2-chat -s 13 -f pytorch

报显存错误, 显存只有24G

RuntimeError: Failed to launch model, detail:
 [address=0.0.0.0:44231, pid=47189] CUDA out of memory. 
 Tried to allocate 270.00 MiB. 
 GPU 0 has a total capacity of 23.64 GiB of which 213.69 MiB is free. 
 Including non-PyTorch memory, 
 this process has 23.43 GiB memory in use. 
Of the allocated memory 22.99 GiB is allocated by PyTorch, 
and 1.76 MiB is reserved by PyTorch but unallocated. 
If reserved but unallocated memory is large 
try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation.  See documentation for Memory Management  (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

解决办法在 xinf.sh启动脚本增加环境变量设置

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值