From 9d778b0b3117942ec17dd41093d05d4adfeab1a8 Mon Sep 17 00:00:00 2001 From: sudowind Date: Thu, 26 Jun 2025 22:41:16 +0800 Subject: [PATCH] feat: support download model from modelscope rather than git lfs --- .gitignore | 5 ++++- README.md | 10 ++++++++++ download_model.bat | 21 +++++++++++++++++++++ download_model.sh | 19 ++++++++++++++++--- 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 download_model.bat diff --git a/.gitignore b/.gitignore index ec60f13..5e344c9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ __pycache__ lm.pb model_1.onnx -model.pb \ No newline at end of file +model.pb +*.msc +lite_avatar_weights/ +*.mv \ No newline at end of file diff --git a/README.md b/README.md index 309c9c1..bf3ee98 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,16 @@ We recommend a python version = 3.10 and cuda version = 11.8. Then build environ ```shell pip install -r requirements.txt ``` + +## Model Preparation +```shell +# for windows +download_model.bat + +# for linux +bash download_model.sh +``` + ## Inference ``` python lite_avatar.py --data_dir /path/to/sample_data --audio_file /path/to/audio.wav --result_dir /path/to/result diff --git a/download_model.bat b/download_model.bat new file mode 100644 index 0000000..1a9f2bc --- /dev/null +++ b/download_model.bat @@ -0,0 +1,21 @@ +@echo off +REM Download LiteAvatar model files using modelscope + +echo Downloading LiteAvatar model files... + +modelscope download --model HumanAIGC-Engineering/LiteAvatarGallery lite_avatar_weights/lm.pb lite_avatar_weights/model_1.onnx lite_avatar_weights/model.pb --local_dir ./ +if %errorlevel% neq 0 ( + echo Error downloading lite_avatar_weights + pause + exit /b 1 +) + +@REM move file +move lite_avatar_weights\lm.pb ./weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/lm/ +move lite_avatar_weights\model_1.onnx ./weights/ +move lite_avatar_weights\model.pb ./weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/ + +@REM remove folder +rmdir lite_avatar_weights + +echo All model files downloaded successfully! diff --git a/download_model.sh b/download_model.sh index 20d8831..4a6fdc4 100644 --- a/download_model.sh +++ b/download_model.sh @@ -1,3 +1,16 @@ -modelscope download --model HumanAIGC-Engineering/LiteAvatarGallery lite_avatar_weights/lm.pb --local_dir ./weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/lm/ -modelscope download --model HumanAIGC-Engineering/LiteAvatarGallery lite_avatar_weights/model_1.onnx --local_dir ./weights/ -modelscope download --model HumanAIGC-Engineering/LiteAvatarGallery lite_avatar_weights/model.pb --local_dir ./weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/ \ No newline at end of file +#!/bin/bash + +# download model +echo "Downloading LiteAvatar model files..." + +modelscope download --model HumanAIGC-Engineering/LiteAvatarGallery lite_avatar_weights/lm.pb lite_avatar_weights/model_1.onnx lite_avatar_weights/model.pb --local_dir ./ + +# move file +mv lite_avatar_weights/lm.pb ./weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/lm/ +mv lite_avatar_weights/model_1.onnx ./weights/ +mv lite_avatar_weights/model.pb ./weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/ + +# remove folder +rm -rf lite_avatar_weights + +echo "All model files downloaded successfully!"