diff --git a/.gitattributes b/.gitattributes index f69af18..e69de29 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +0,0 @@ -*.pth filter=lfs diff=lfs merge=lfs -text -*.pb filter=lfs diff=lfs merge=lfs -text -*.onnx filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/.gitignore b/.gitignore index 699b799..5e344c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ *.pyc __pycache__ -/results/ \ No newline at end of file +/results/ + +lm.pb +model_1.onnx +model.pb +*.msc +lite_avatar_weights/ +*.mv \ No newline at end of file diff --git a/README.md b/README.md index a005be7..d4c8910 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,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 new file mode 100644 index 0000000..4a6fdc4 --- /dev/null +++ b/download_model.sh @@ -0,0 +1,16 @@ +#!/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!" diff --git a/weights/model_1.onnx b/weights/model_1.onnx deleted file mode 100644 index 67addc8..0000000 --- a/weights/model_1.onnx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:312f0213a23a1c17ecb66f9edf8413b8ef193c0d4d2f5f9dd6714a178492c34c -size 184415825 diff --git a/weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/lm/lm.pb b/weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/lm/lm.pb deleted file mode 100644 index 1414f72..0000000 --- a/weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/lm/lm.pb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5b59db5f607fde57bd8d6c8df8f22ce5b37ec7adcdb7b4ee785a4478f06c1c50 -size 237373385 diff --git a/weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pb b/weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pb deleted file mode 100644 index 0bcfb7b..0000000 --- a/weights/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5bba782a5e9196166233b9ab12ba04cadff9ef9212b4ff6153ed9290ff679025 -size 880502012