{"id":24708,"date":"2025-02-11T21:59:00","date_gmt":"2025-02-11T13:59:00","guid":{"rendered":"http:\/\/139.9.1.231\/?p=24708"},"modified":"2025-02-11T17:59:44","modified_gmt":"2025-02-11T09:59:44","slug":"inspiremusic-music-gen","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2025\/02\/11\/inspiremusic-music-gen\/","title":{"rendered":"InspireMusic&#8211;\u963f\u91cc\u901a\u4e49\u5f00\u6e90\u97f3\u4e50\u751f\u6210\u6846\u67b6"},"content":{"rendered":"\n<p><strong>InspireMusic<\/strong>\u662f\u7531\u901a\u4e49\u5b9e\u9a8c\u5ba4\u5f00\u6e90\u7684\u97f3\u4e50\u751f\u6210\u6280\u672f\uff0c\u65e8\u5728\u6253\u9020\u4e00\u6b3e\u96c6<strong>\u97f3\u4e50\u751f\u6210\u3001\u6b4c\u66f2\u751f\u6210\u3001\u97f3\u9891\u751f\u6210\u80fd\u529b<\/strong>\u4e3a\u4e00\u4f53\u7684\u5f00\u6e90AIGC\u5de5\u5177\u5305\u3002<\/p>\n\n\n\n<p>\u4e3a\u7814\u7a76\u8005\u548c\u5f00\u53d1\u8005\u63d0\u4f9b<strong>\u97f3\u4e50\/\u6b4c\u66f2\/\u97f3\u9891\u751f\u6210\u6a21\u578b\u7684\u8bad\u7ec3\u548c\u8c03\u4f18\u5de5\u5177\u53ca\u6a21\u578b<\/strong>\uff0c\u65b9\u4fbf\u4f18\u5316\u751f\u6210\u6548\u679c\uff1b\u540c\u65f6\u4e3a\u97f3\u4e50\u7231\u597d\u8005\u63d0\u4f9b\u4e00\u4e2a\u6613\u4e8e\u4f7f\u7528\u7684\u6587\u672c\u751f\u6210\u97f3\u4e50\/\u6b4c\u66f2\/\u97f3\u9891\u521b\u4f5c\u5de5\u5177\uff0c\u53ef\u901a\u8fc7\u6587\u5b57\u63cf\u8ff0\u6216\u97f3\u9891\u63d0\u793a\u6765\u63a7\u5236\u751f\u6210\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u76ee\u524d\uff0cInspireMusic\u5df2<strong>\u5f00\u6e90\u4e86\u97f3\u4e50\u751f\u6210\u7684\u8bad\u7ec3\u548c\u63a8\u7406\u4ee3\u7801\uff0c\u652f\u6301\u901a\u8fc7\u7b80\u5355\u7684\u6587\u5b57\u63cf\u8ff0\u6216\u97f3\u9891\u63d0\u793a\uff0c\u5feb\u901f\u751f\u6210\u591a\u79cd\u98ce\u683c\u7684\u97f3\u4e50\u4f5c\u54c1\u3002<\/strong><\/p>\n\n\n\n<p>InspireMusic\u7684<strong>\u6587\u751f\u97f3\u4e50\u521b\u4f5c\u6a21\u5f0f<\/strong>\u6db5\u76d6\u4e86\u591a\u79cd\u66f2\u98ce\u3001\u60c5\u611f\u8868\u8fbe\u548c\u590d\u6742\u7684\u97f3\u4e50\u7ed3\u6784\u63a7\u5236\uff0c\u63d0\u4f9b\u4e86\u6781\u5927\u7684\u521b\u4f5c\u81ea\u7531\u5ea6\u548c\u7075\u6d3b\u6027\u3002\u672a\u6765\u8ba1\u5212\u8fdb\u4e00\u6b65\u5f00\u653e\u6b4c\u5531\u751f\u6210\u548c\u97f3\u9891\u751f\u6210\u7684\u57fa\u7840\u6a21\u578b\uff0c\u6b22\u8fce\u7814\u7a76\u8005\u3001\u5f00\u53d1\u8005\u53ca\u7528\u6237\u79ef\u6781\u53c2\u4e0e\u4f53\u9a8c\u548c\u7814\u53d1\u3002\u8be5\u5f00\u6e90\u5de5\u5177\u5305\u4e3a\u793e\u533a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6280\u672f\u8d44\u6e90\uff0c\u652f\u6301\u4ece\u5b66\u672f\u7814\u7a76\u5230\u4ea7\u54c1\u5f00\u53d1\u7684\u5e7f\u6cdb\u5e94\u7528\u3002<\/p>\n\n\n\n<h3><strong>\ud83c\udfb6 \u4e3b\u8981\u7279\u70b9<\/strong><\/h3>\n\n\n\n<ul><li><strong>\u7edf\u4e00\u7684\u97f3\u9891\u751f\u6210\u6846\u67b6<\/strong>\uff1a\u57fa\u4e8e\u97f3\u9891\u5927\u6a21\u578b\u6280\u672f\uff0cInspireMusic\u652f\u6301\u97f3\u4e50\u3001\u6b4c\u66f2\u53ca\u97f3\u9891\u7684\u751f\u6210\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u591a\u6837\u5316\u9009\u62e9\uff1b<\/li><li><strong>\u7075\u6d3b\u53ef\u63a7\u751f\u6210<\/strong>\uff1a\u57fa\u4e8e\u6587\u672c\u63d0\u793a\u548c\u97f3\u4e50\u7279\u5f81\u63cf\u8ff0\uff0c\u7528\u6237\u53ef\u7cbe\u51c6\u63a7\u5236\u751f\u6210\u97f3\u4e50\u7684\u98ce\u683c\u548c\u7ed3\u6784\uff1b<\/li><li><strong>\u7b80\u5355\u6613\u7528<\/strong>\uff1a\u7b80\u4fbf\u7684\u6a21\u578b\u5fae\u8c03\u548c\u63a8\u7406\u5de5\u5177\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u9ad8\u6548\u7684\u8bad\u7ec3\u4e0e\u8c03\u4f18\u5de5\u5177\u3002<\/li><\/ul>\n\n\n\n<h3><strong>\ud83c\udf1f\u4ee3\u7801\u4ed3\u5e93<\/strong><\/h3>\n\n\n\n<ul><li><strong>GitHub \u4ed3\u5e93<\/strong><em>\uff1a<strong>InspireMusic\uff08<a href=\"https:\/\/github.com\/FunAudioLLM\/InspireMusic\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/FunAudioLLM\/InspireMusic<\/a>\uff09<\/strong><\/em><\/li><li><strong>Online Demo:ModelScope\u521b\u7a7a\u95f4\uff1a<em><a href=\"https:\/\/modelscope.cn\/studios\/iic\/InspireMusic\/summary\">https:\/\/modelscope.cn\/studios\/iic\/InspireMusic\/summary<\/a><\/em><\/strong><\/li><\/ul>\n\n\n\n<h3><strong>\u6838\u5fc3\u6a21\u578b<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"315\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2025\/02\/image-40-1024x315.png\" alt=\"\" class=\"wp-image-24713\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2025\/02\/image-40-1024x315.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2025\/02\/image-40-300x92.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2025\/02\/image-40-768x236.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2025\/02\/image-40-1536x473.png 1536w, http:\/\/139.9.1.231\/wp-content\/uploads\/2025\/02\/image-40.png 1843w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>InspireMusic\u7531\u97f3\u9891tokenizer\u3001\u81ea\u56de\u5f52Transformer\u6a21\u578b\u3001\u57fa\u4e8e\u5e38\u5fae\u5206\u65b9\u7a0b\u7684\u6269\u6563\u6a21\u578b\u5373Conditional Flow Matching (CFM)\u6a21\u578b\u3001Vocoder\u6240\u7ec4\u6210\uff0c\u53ef\u652f\u6301\u6587\u672c\u751f\u6210\u97f3\u4e50\u3001\u97f3\u4e50\u7eed\u5199\u7b49\u4efb\u52a1\u3002\u901a\u8fc7\u5177\u6709\u9ad8\u538b\u7f29\u6bd4\u7684\u5355\u7801\u672cWavTokenizer\u5c06\u8f93\u5165\u7684\u8fde\u7eed\u97f3\u9891\u7279\u5f81\u8f6c\u6362\u6210\u79bb\u6563\u97f3\u9891token\uff0c\u7136\u540e\u5229\u7528\u57fa\u4e8eQwen\u6a21\u578b\u521d\u59cb\u5316\u7684\u81ea\u56de\u5f52Transformer\u6a21\u578b\u9884\u6d4b\u97f3\u9891token\uff0c\u518d\u7531CFM\u6269\u6563\u6a21\u578b\u91cd\u5efa\u97f3\u9891\u7684\u6f5c\u5c42\u7279\u5f81\uff0c\u6700\u7ec8\u901a\u8fc7Vocoder\u8f93\u51fa\u9ad8\u8d28\u91cf\u7684\u97f3\u9891\u6ce2\u5f62\u3002\u4e24\u79cd\u63a8\u7406\u6a21\u5f0f\u7684\u8bbe\u8ba1\uff1afast\u6a21\u578b\u548c\u9ad8\u97f3\u8d28\u6a21\u578b\uff0c\u4e3a\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6237\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u9009\u62e9\u3002<\/p>\n\n\n\n<h2><strong>\u5de5\u5177\u5305\u5b89\u88c5\u4f7f\u7528\u6307\u5357<\/strong><\/h2>\n\n\n\n<p><strong>\u7b2c\u4e00\u6b65\uff1a\u4e0b\u8f7d\u4ee3\u7801\u5e93<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">git clone --recursive https:\/\/github.com\/FunAudioLLM\/InspireMusic.git\r\n# If you failed to clone submodule due to network failures, please run the following command until success\r\ncd InspireMusic\r\ngit submodule update --init --recursive<\/pre>\n\n\n\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a\u5b89\u88c5\u4ee3\u7801\u5e93<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">conda create -n inspiremusic python=3.8\r\nconda activate inspiremusic\r\ncd InspireMusic\r\n# pynini is required by WeTextProcessing, use conda to install it as it can be executed on all platforms.\r\nconda install -y -c conda-forge pynini==2.1.5\r\npip install -r requirements.txt -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/ --trusted-host=mirrors.aliyun.com\r\n# install flash attention to speedup training, support version 2.6.3\r\npip install flash-attn --no-build-isolation<\/pre>\n\n\n\n<p><strong>\u7b2c\u4e09\u6b65\uff1a\u4e0b\u8f7d\u6a21\u578b<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>InspireMusic-Base\u6a21\u578b\uff08https:<em>\/\/www.modelscope.cn\/iic\/InspireMusic\uff09<\/em><\/code>\n<code><em># git\u6a21\u578b\u4e0b\u8f7d\uff0c\u8bf7\u786e\u4fdd\u5df2\u5b89\u88c5git lfs<\/em><\/code>\n<code>mkdir -p pretrained_models<\/code>\n<code>git clone https:<em>\/\/www.modelscope.cn\/iic\/InspireMusic.git pretrained_models\/InspireMusic-Base<\/em><\/code><\/pre>\n\n\n\n<p><strong>\u7b2c\u56db\u6b65\uff1a\u57fa\u672c\u7528\u6cd5\u8bf4\u660e<\/strong><strong>\u5feb\u901f\u5f00\u59cb<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd InspireMusic\/examples\/music_generation\/<\/code>\n<code>bash run.sh<\/code><\/pre>\n\n\n\n<p><strong>\u8bad\u7ec3LLM\u548cflow matching\u6a21\u578b\u6837\u4f8b\u811a\u672c\u3002<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">torchrun --nnodes=1 --nproc_per_node=8 \\\r\n    --rdzv_id=1024 --rdzv_backend=\"c10d\" --rdzv_endpoint=\"localhost:0\" \\\r\n    inspiremusic\/bin\/train.py \\\r\n    --train_engine \"torch_ddp\" \\\r\n    --config conf\/inspiremusic.yaml \\\r\n    --train_data data\/train.data.list \\\r\n    --cv_data data\/dev.data.list \\\r\n    --model llm \\\r\n    --model_dir `pwd`\/exp\/music_generation\/llm\/ \\\r\n    --tensorboard_dir `pwd`\/tensorboard\/music_generation\/llm\/ \\\r\n    --ddp.dist_backend \"nccl\" \\\r\n    --num_workers 8 \\\r\n    --prefetch 100 \\\r\n    --pin_memory \\\r\n    --deepspeed_config .\/conf\/ds_stage2.json \\\r\n    --deepspeed.save_states model+optimizer \\\r\n    --fp16\n\ntorchrun --nnodes=1 --nproc_per_node=8 \\\r\n    --rdzv_id=1024 --rdzv_backend=\"c10d\" --rdzv_endpoint=\"localhost:0\" \\\r\n    inspiremusic\/bin\/train.py \\\r\n    --train_engine \"torch_ddp\" \\\r\n    --config conf\/inspiremusic.yaml \\\r\n    --train_data data\/train.data.list \\\r\n    --cv_data data\/dev.data.list \\\r\n    --model flow \\\r\n    --model_dir `pwd`\/exp\/music_generation\/flow\/ \\\r\n    --tensorboard_dir `pwd`\/tensorboard\/music_generation\/flow\/ \\\r\n    --ddp.dist_backend \"nccl\" \\\r\n    --num_workers 8 \\\r\n    --prefetch 100 \\\r\n    --pin_memory \\\r\n    --deepspeed_config .\/conf\/ds_stage2.json \\\r\n    --deepspeed.save_states model+optimizer<\/pre>\n\n\n\n<p><strong>\u63a8\u7406\u811a\u672c<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd InspireMusic\/examples\/music_generation\/\r\nbash infer.sh<\/pre>\n\n\n\n<p><strong>\u5e26\u6709CFM\u7684\u63a8\u7406\u6a21\u5f0f<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pretrained_model_dir = \"pretrained_models\/InspireMusic\/\"\r\nfor task in 'text-to-music' 'continuation'; do\r\n  python inspiremusic\/bin\/inference.py --task $task \\\r\n      --gpu 0 \\\r\n      --config conf\/inspiremusic.yaml \\\r\n      --prompt_data data\/test\/parquet\/data.list \\\r\n      --flow_model $pretrained_model_dir\/flow.pt \\\r\n      --llm_model $pretrained_model_dir\/llm.pt \\\r\n      --music_tokenizer $pretrained_model_dir\/music_tokenizer \\\r\n      --wavtokenizer $pretrained_model_dir\/wavtokenizer \\\r\n      --result_dir `pwd`\/exp\/inspiremusic\/${task}_test \\\r\n      --chorus verse \\\r\n      --min_generate_audio_seconds 8 \\\r\n      --max_generate_audio_seconds 30 \r\ndone<\/pre>\n\n\n\n<p><strong>\u4e0d\u5e26CFM\u7684fast\u63a8\u7406\u6a21\u5f0f<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pretrained_model_dir = \"pretrained_models\/InspireMusic\/\"\r\nfor task in 'text-to-music' 'continuation'; do\r\n  python inspiremusic\/bin\/inference.py --task $task \\\r\n      --gpu 0 \\\r\n      --config conf\/inspiremusic.yaml \\\r\n      --prompt_data data\/test\/parquet\/data.list \\\r\n      --flow_model $pretrained_model_dir\/flow.pt \\\r\n      --llm_model $pretrained_model_dir\/llm.pt \\\r\n      --music_tokenizer $pretrained_model_dir\/music_tokenizer \\\r\n      --wavtokenizer $pretrained_model_dir\/wavtokenizer \\\r\n      --result_dir `pwd`\/exp\/inspiremusic\/${task}_test \\\r\n      --chorus verse \\\r\n      --fast \\\r\n      --min_generate_audio_seconds 8 \\\r\n      --max_generate_audio_seconds 30 \r\ndone<\/pre>\n\n\n\n<p><strong>\u200d<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>InspireMusic\u662f\u7531\u901a\u4e49\u5b9e\u9a8c\u5ba4\u5f00\u6e90\u7684\u97f3\u4e50\u751f\u6210\u6280\u672f\uff0c\u65e8\u5728\u6253\u9020\u4e00\u6b3e\u96c6\u97f3\u4e50\u751f\u6210\u3001\u6b4c\u66f2\u751f\u6210\u3001\u97f3\u9891\u751f\u6210\u80fd\u529b\u4e3a\u4e00\u4f53 &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2025\/02\/11\/inspiremusic-music-gen\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">InspireMusic&#8211;\u963f\u91cc\u901a\u4e49\u5f00\u6e90\u97f3\u4e50\u751f\u6210\u6846\u67b6<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40,4,9,38,34],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/24708"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=24708"}],"version-history":[{"count":5,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/24708\/revisions"}],"predecessor-version":[{"id":24714,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/24708\/revisions\/24714"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=24708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=24708"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=24708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}