Make songforge clone-anywhere with PKG_ROOT and local ComfyUI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
swl
2026-10-10 01:44:26 +08:00
co-authored by Cursor
parent 487aacf864
commit cd2fb51575
15 changed files with 745 additions and 442 deletions
+11 -11
View File
@@ -36,18 +36,18 @@ min_p = 0.02
generate_audio_codes = true
timesignature = "4"
# 相对路径相对「workflows 父目录」(嵌套在 ComfyUI 时)或克隆仓的父目录。
# 本机 comfy_root / qc_python / music_dir 放 local.toml。
# 相对路径一律相对本仓根(clone 到哪就是哪)。
# 本机 comfy_root / qc_python / music_dir / server 放 local.toml。
[paths]
workflow_template = "urbanhiphop-身体先听懂.json"
runs_dir = "songforge/data/runs"
tmp_dir = "songforge/data/tmp"
lyrics_dir = "songforge/input/lyrics"
qc_cache_dir = "songforge/cache/qc"
style_cache_dir = "songforge/cache/style"
index_dir = "songforge/index"
catalog_file = "songforge/index/catalog.jsonl"
baseline_dir = "songforge/config/baseline"
workflow_template = "workflows/template.json"
runs_dir = "data/runs"
tmp_dir = "data/tmp"
lyrics_dir = "input/lyrics"
qc_cache_dir = "cache/qc"
style_cache_dir = "cache/style"
index_dir = "index"
catalog_file = "index/catalog.jsonl"
baseline_dir = "config/baseline"
output_prefix = "MyMusic"
output_format = "flac"
+13 -11
View File
@@ -17,8 +17,10 @@ try:
except ModuleNotFoundError: # Python < 3.11
import tomli as tomllib # type: ignore
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
CONFIG_DIR = os.path.join(ROOT, "songforge", "config")
# config/loader.py -> 仓根
PKG_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ROOT = PKG_ROOT
CONFIG_DIR = os.path.join(PKG_ROOT, "config")
DEFAULTS = {
"engine": {"server": "http://127.0.0.1:8188", "timeout_sec": 3600,
@@ -33,15 +35,15 @@ DEFAULTS = {
"encode": {"cfg_scale": 3.0, "temperature": 0.68, "top_p": 0.88,
"top_k": 50, "min_p": 0.02, "generate_audio_codes": True,
"timesignature": "4"},
"paths": {"workflow_template": "urbanhiphop-身体先听懂.json",
"runs_dir": "songforge/data/runs",
"tmp_dir": "songforge/data/tmp",
"lyrics_dir": "songforge/input/lyrics",
"qc_cache_dir": "songforge/cache/qc",
"style_cache_dir": "songforge/cache/style",
"index_dir": "songforge/index",
"catalog_file": "songforge/index/catalog.jsonl",
"baseline_dir": "songforge/config/baseline",
"paths": {"workflow_template": "workflows/template.json",
"runs_dir": "data/runs",
"tmp_dir": "data/tmp",
"lyrics_dir": "input/lyrics",
"qc_cache_dir": "cache/qc",
"style_cache_dir": "cache/style",
"index_dir": "index",
"catalog_file": "index/catalog.jsonl",
"baseline_dir": "config/baseline",
"comfy_root": None,
"qc_python": None,
"music_dir": None,
+16 -7
View File
@@ -1,10 +1,19 @@
# 复制为 local.toml(已 gitignore)。只放本机绝对路径,勿提交。
# CLI 用项目 .venv;QC 音频栈可继续指向 ComfyUI 专用 venv。
[paths]
comfy_root = "D:/CodeFiles/Thinking/ComfyUI-MiniMaxH3"
qc_python = "C:/comfyui-venv/Scripts/python.exe"
music_dir = "D:/CodeFiles/Thinking/ComfyUI-MiniMaxH3/output/MyMusic"
# 复制为 local.toml(已 gitignore)。clone 到任意目录后只改这里即可连本机 ComfyUI。
#
# 例:D:\CodeFiles\ProProjects\songforge
# copy config\local.toml.example config\local.toml
# 填好下方路径 → .\.venv\Scripts\python.exe songforge.py doctor
[engine]
# ComfyUI 已启动的地址(本机默认 8188)
server = "http://127.0.0.1:8188"
[paths]
# ComfyUI 安装根(含 models/ checkpoints、loras、custom_nodes)
comfy_root = "D:/CodeFiles/Thinking/ComfyUI-MiniMaxH3"
# QC 用的 Python(需 librosa/torch/demucs;可与 CLI .venv 分离)
qc_python = "C:/comfyui-venv/Scripts/python.exe"
# 生成音频输出目录(不填则用 <comfy_root>/output/MyMusic)
music_dir = "D:/CodeFiles/Thinking/ComfyUI-MiniMaxH3/output/MyMusic"