Xinference 安装

安装 Xinference

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 创建虚拟环境
conda create -n xinference python=3.11

# 激活虚拟环境
conda activate xinference

# 安装的时候报错,提示缺少 torch,pip install torch 安装 torch
pip install "xinference[all]"

# Apple M系列
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python

# 英伟达显卡
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python

# AMD 显卡
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python

# 启动 Xinference
xinference-local --host 主机ip --port 9997

# 启动模型
xinference launch --model-name ChatTTS --model-type audio --endpoint http://主机ip:9997

# 因为是 TTS 模型,需要安装 ffmpeg
conda install -c conda-forge ffmpeg
ffmpeg -version

# 在使用的时候报错:ImportError: Failed to intialize FFmpeg extension. Tried versions: ['6', '5', '4', '']. Enable DEBUG logging to see more details about the error.

# 降级 FFmpeg
conda activate xinference
conda install -c conda-forge ffmpeg=5.1.2
ffmpeg -version
/images/documents/Xinference安装/1.png
(图1)

Dify 添加 Xinference

/images/documents/Xinference安装/2.png
(图2)

0%