ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14.4px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">SenseVoice+ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14.4px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">LLM API+ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14.4px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">CosyVoice API的方式运行 LAM 或 LiteAvatar 数字人。显存占用最低仅有3G!ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;display: table;padding: 0.3em 1.2em;color: rgb(255, 255, 255);background: rgb(250, 81, 81);border-radius: 8px 24px;box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 6px;">实测显存占用情况ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 16px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">在搭载ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14.4px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">RTX3060 6G的笔记本电脑上运行测试ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14.4px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">LAM数字人,仅占用ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-feature-settings: normal;font-variation-settings: normal;font-size: 14.4px;text-align: left;line-height: 1.75;color: rgb(221, 17, 68);background: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">3.1G显存!对话流畅,性能相当强悍!运行LiteAvatar数字人,也仅需5.3G显存!实测图如下:
安装 miniconda 、ffmpeg 可查看往期文章
•安装miniconda •安装ffmpeg
# 拉取主仓库 --depth=1 仅拉取最新的提交,减少空间占用
gitclone--depth=1 https://github.com/HumanAIGC-Engineering/OpenAvatarChat.git
cdOpenAvatarChat
# 拉取子仓库
git submodule update --init --recursive针对网络环境不好的同学,推荐逐个拉取仓库。在拉取失败时能快速定位到异常仓库。
所有git clone命令均带有路径,可直接在主仓库根目录下执行。
注:由于是最小化组件安装,没有拉取MiniCPM-o仓库
所有子仓库可在
.gitmodules文件中查看
gitclone--depth=1 https://github.com/HumanAIGC-Engineering/OpenAvatarChat.git
cdOpenAvatarChat# 跳过lfs下载大型文件,后续把大型文件单独下载后放入指定位置
# set GIT_LFS_SKIP_SMUDGE=1
gitclone--depth=1 https://github.com/HumanAIGC/lite-avatar.git ./src/handlers/avatar/liteavatar/algo/liteavatarliteavatar仓库中共有三个大型文件,把它们单独下载到本地再放到对应位置:
gitclone--depth=1https://github.com/snakers4/silero-vad.git./src/handlers/vad/silerovad/silero_vad
gitclone--depth=1https://github.com/HumanAIGC-Engineering/gradio-webrtc.git./src/third_party/gradio_webrtc_videochat
# CosyVoice 仓库中包含子仓库:Matcha-TTS。添加参数 --recursive 将自动拉取
gitclone--depth=1 --recursive https://github.com/FunAudioLLM/CosyVoice.git ./src/handlers/tts/cosyvoice/CosyVoicegitclone--depth=1https://github.com/aigc3d/LAM_Audio2Expression.git./src/handlers/avatar/lam/LAM_Audio2Expression
# 新建名为 openavatarchat 的 python 3.10 环境
conda create -n openavatarchat python=3.10
# 激活环境
conda activate openavatarchatcondainstall-cconda-forgepynini==2.1.6
pipinstalltorchtorchvisiontorchaudio--index-urlhttps://download.pytorch.org/whl/cu124
这个fastrtc是经过OpenAvatarChat团队修改的版本,且打包成了whl包,跟随OpenAvatarChat仓库发布。千万不要安装gradio版的fastrtc
pipinstall-ihttps://mirrors.aliyun.com/pypi/simple./src/third_party/gradio_webrtc_videochat/dist/fastrtc-0.0.19.dev0-py3-none-any.whl
请严格按照以下顺序安装依赖包。已经过多轮测试,安装后可正常运行。
pip install -i https://mirrors.aliyun.com/pypi/simple aiohttp==3.11.16
pip install -i https://mirrors.aliyun.com/pypi/simple modelscope==1.25.0
pip install -i https://mirrors.aliyun.com/pypi/simple openai==1.74.0
pip install -i https://mirrors.aliyun.com/pypi/simple dynaconf==3.2.10
pip install -i https://mirrors.aliyun.com/pypi/simple email-validator==2.2.0
pip install -i https://mirrors.aliyun.com/pypi/simple fastapi-cli==0.0.7
pip install -i https://mirrors.aliyun.com/pypi/simple loguru==0.7.3
pip install -i https://mirrors.aliyun.com/pypi/simple opencv-python-headless==4.11.0.86
pip install -i https://mirrors.aliyun.com/pypi/simple pyaml==25.1.0
pip install -i https://mirrors.aliyun.com/pypi/simple funasr==1.2.6
pip install -i https://mirrors.aliyun.com/pypi/simple vocos==0.1.0
pip install -i https://mirrors.aliyun.com/pypi/simple vector-quantize-pytorch==1.21.9
pip install -i https://mirrors.aliyun.com/pypi/simple transformers==4.44.1
pip install -i https://mirrors.aliyun.com/pypi/simple h5py==3.12.1
pip install -i https://mirrors.aliyun.com/pypi/simple pypinyin==0.53.0
pip install -i https://mirrors.aliyun.com/pypi/simple typeguard==2.13.3
pip install -i https://mirrors.aliyun.com/pypi/simple onnxruntime-gpu~=1.20.1
pip install -i https://mirrors.aliyun.com/pypi/simple onnxruntime~=1.20.1
pip install -i https://mirrors.aliyun.com/pypi/simple dashscope==1.23.1
pip install -i https://mirrors.aliyun.com/pypi/simple edge-tts==7.0.0
pip install -i https://mirrors.aliyun.com/pypi/simple addict==2.4.0
pip install -i https://mirrors.aliyun.com/pypi/simple yapf==0.40.1
pip install -i https://mirrors.aliyun.com/pypi/simple spleeter==2.4.0
pip install -i https://mirrors.aliyun.com/pypi/simple gradio==5.9.1模型文件均来自modelscope魔塔社区,无需担心网络问题。
在OpenAvatarChat根目录下执行,模型文件会下载到对应的文件夹中
modelscopedownload--modeliic/SenseVoiceSmall--local_dir./models/iic/SenseVoiceSmall
modelscopedownload--modelHumanAIGC-Engineering/LiteAvatarGallery--local_dir./resource/avatar/liteavatar
modelscope download --model AI-ModelScope/wav2vec2-base-960h --local_dir ./models/wav2vec2-base-960h
modelscope download --model Damo_XR_Lab/LAM_audio2exp LAM_audio2exp_streaming.tar --local_dir ./models/LAM_audio2exp注意:这里的LAM_audio2exp_streaming.tar压缩包需要解压,否则在运行lam数字人时报错:No checkpoint found
使用WinRAR解压有可能会遇到只解压出一个文件的问题,正常解压出来的应当是一个文件夹。猜测可能是解压软件的问题。遇到问题的同学可以修改LAM_audio2exp_streaming.tar文件后缀名为.tar.gz即可使用WinRAR解压。
如下图:
解后的目录结构为:
./models/LAM_audio2exp/pretrained_models/LAM_audio2exp_streaming.tar
https://bailian.console.aliyun.com/?tab=model#/model-market/detail/cosyvoice-v1
当白嫖额度消耗殆尽时,可在配置文件中替换为EDGE-TTS语言合成,但速度稍慢
https://bailian.console.aliyun.com/?tab=model#/model-market/detail/qwen-vl-plus
https://openrouter.ai/qwen/qwen2.5-vl-72b-instruct:free
在登录阿里云百炼后,所使用模型的白嫖额度会显示在页面中,注意查看:
配置文件位于:config文件夹内
chat_with_openai_compatible_bailian_cosyvoice.yaml到同目录内,重命名为liteavatar.yaml若是使用OpenRouter的 LLM大模型,则要修改model_name、api_url、api_key。如下图示例:
chat_with_openai_compatible_bailian_cosyvoice.yaml到同目录内,重命名为lam.yamlLamClient:
module:client/h5_rendering_client/client_handler_lam
asset_path:"lam_samples/image.zip"
concurrent_limit:5参考下图:
4.把LiteAvatar删除,替换为LAM_Driver
LAM_Driver:
module:avatar/lam/avatar_handler_lam_audio2expression参考下图:
1. 编辑yaml配置文件
2. 把CosyVoice配置项删除,或者把CosyVoice配置项的enabled改为False
3. 把下面的Edge_TTS配置项添加到配置文件中去
Edge_TTS:
enabled: True
module: tts/edgetts/tts_handler_edgetts
voice: "zh-CN-XiaoxiaoNeural"pythonsrc/demo.py--configconfig/liteavatar.yaml
pythonsrc/demo.py--configconfig/lam.yaml
| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |