Merge pull request #77 from ryanontheinside/feat/lm-param

feat: lm params in text encode
This commit is contained in:
RyanOnTheInside
2026-02-07 07:42:37 -05:00
committed by GitHub
4 changed files with 1694 additions and 416 deletions
File diff suppressed because one or more lines are too long
+455 -413
View File
@@ -1,8 +1,8 @@
{
"id": "1321ed79-5bbf-44b4-a7f2-cc6914f8ed3c",
"revision": 0,
"last_node_id": 18,
"last_link_id": 24,
"last_node_id": 21,
"last_link_id": 37,
"nodes": [
{
"id": 1,
@@ -31,7 +31,7 @@
"name": "CLIP",
"type": "CLIP",
"links": [
2
32
]
},
{
@@ -75,7 +75,7 @@
"name": "duration"
},
"links": [
4
34
]
}
],
@@ -204,157 +204,6 @@
"euler"
]
},
{
"id": 12,
"type": "RandomNoise",
"pos": [
1881.1492814143214,
84.68943578981373
],
"size": [
315,
82
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "NOISE",
"type": "NOISE",
"links": [
14
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "RandomNoise"
},
"widgets_values": [
990,
"fixed"
]
},
{
"id": 13,
"type": "ModelSamplingAuraFlow",
"pos": [
1491.5184221515126,
124.43989184642457
],
"size": [
330,
60
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 19
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
9,
10
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "ModelSamplingAuraFlow"
},
"widgets_values": [
3
]
},
{
"id": 5,
"type": "ConditioningZeroOut",
"pos": [
1546.6533669910605,
572.241559278368
],
"size": [
204.134765625,
26
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"link": 6
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
12
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "ConditioningZeroOut"
},
"widgets_values": []
},
{
"id": 15,
"type": "Knob",
"pos": [
2774.678850395049,
285.9556615665655
],
"size": [
270,
122
],
"flags": {},
"order": 16,
"mode": 0,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 22
}
],
"outputs": [
{
"name": "AUDIO",
"type": "AUDIO",
"links": [
24
]
}
],
"properties": {
"cnr_id": "comfyui_ryanontheinside",
"ver": "951b1318f8958bfc441c0bcbbf2fc0695e1d9278",
"Node name for S&R": "Knob"
},
"widgets_values": [
0.2,
0.05
]
},
{
"id": 11,
"type": "MarkdownNote",
@@ -367,7 +216,7 @@
400
],
"flags": {},
"order": 4,
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [],
@@ -444,7 +293,7 @@
"name": "detected_bpm_rounded",
"type": "INT",
"links": [
3
33
]
},
{
@@ -486,7 +335,7 @@
"name": "detected_key",
"type": "COMBO",
"links": [
5
35
]
}
],
@@ -499,112 +348,6 @@
30
]
},
{
"id": 17,
"type": "PreviewAudio",
"pos": [
3124.678850395049,
485.9556615665655
],
"size": [
270,
88
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 23
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "PreviewAudio"
},
"widgets_values": []
},
{
"id": 4,
"type": "ACEStep15TaskTextEncode",
"pos": [
830,
200
],
"size": [
400,
358
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 2
},
{
"name": "bpm",
"shape": 7,
"type": "INT",
"widget": {
"name": "bpm"
},
"link": 3
},
{
"name": "duration",
"shape": 7,
"type": "INT",
"widget": {
"name": "duration"
},
"link": 4
},
{
"name": "keyscale",
"shape": 7,
"type": "COMBO",
"widget": {
"name": "keyscale"
},
"link": 5
}
],
"outputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"links": [
6,
11
]
}
],
"properties": {
"cnr_id": "comfyui_ryanontheinside",
"ver": "418dd269462f0f08096ae5ab899f991500f3a44c",
"Node name for S&R": "ACEStep15TaskTextEncode"
},
"widgets_values": [
"continue the melodic electronic track with soft synths",
"repaint",
"",
"",
120,
60,
"C major",
"4",
"en",
0,
"fixed"
]
},
{
"id": 16,
"type": "VHS_LoadAudioUpload",
@@ -617,7 +360,7 @@
204
],
"flags": {},
"order": 5,
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [
@@ -655,103 +398,6 @@
}
}
},
{
"id": 8,
"type": "ACEStep15NativeEditGuider",
"pos": [
1841.1492814143214,
504.68943578981373
],
"size": [
449.1958984375,
214
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 10
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 11
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 12
},
{
"name": "source_latents",
"type": "LATENT",
"link": 13
}
],
"outputs": [
{
"name": "guider",
"type": "GUIDER",
"links": [
15
]
},
{
"name": "output_latent",
"type": "LATENT",
"links": [
18
]
}
],
"properties": {
"cnr_id": "comfyui_ryanontheinside",
"ver": "98474ec06548c527400ca866ca65f2b4c477712b",
"Node name for S&R": "ACEStep15NativeEditGuider"
},
"widgets_values": [
1,
10,
20,
-1,
-1
]
},
{
"id": 18,
"type": "SaveAudioMP3",
"pos": [
3104.678850395049,
225.9556615665654
],
"size": [
550,
150
],
"flags": {},
"order": 17,
"mode": 0,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 24
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "SaveAudioMP3"
},
"widgets_values": [
"audio/ace_step_edit",
"V0"
]
},
{
"id": 10,
"type": "SamplerCustomAdvanced",
@@ -855,6 +501,394 @@
"Node name for S&R": "VAEDecodeAudio"
},
"widgets_values": []
},
{
"id": 12,
"type": "RandomNoise",
"pos": [
1881.1492814143214,
84.68943578981373
],
"size": [
315,
82
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "NOISE",
"type": "NOISE",
"links": [
14
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "RandomNoise"
},
"widgets_values": [
990,
"fixed"
]
},
{
"id": 13,
"type": "ModelSamplingAuraFlow",
"pos": [
1483.3770112170293,
213.99568542833242
],
"size": [
330,
60
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 19
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
9,
10
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "ModelSamplingAuraFlow"
},
"widgets_values": [
3
]
},
{
"id": 5,
"type": "ConditioningZeroOut",
"pos": [
1549.6438846171673,
522.8995242470139
],
"size": [
204.134765625,
26
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"link": 37
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
12
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "ConditioningZeroOut"
},
"widgets_values": []
},
{
"id": 8,
"type": "ACEStep15NativeEditGuider",
"pos": [
1841.1492814143214,
504.68943578981373
],
"size": [
449.1958984375,
214
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 10
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 36
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 12
},
{
"name": "source_latents",
"type": "LATENT",
"link": 13
}
],
"outputs": [
{
"name": "guider",
"type": "GUIDER",
"links": [
15
]
},
{
"name": "output_latent",
"type": "LATENT",
"links": [
18
]
}
],
"properties": {
"cnr_id": "comfyui_ryanontheinside",
"ver": "98474ec06548c527400ca866ca65f2b4c477712b",
"Node name for S&R": "ACEStep15NativeEditGuider"
},
"widgets_values": [
1,
50,
0,
-1,
-1
]
},
{
"id": 17,
"type": "PreviewAudio",
"pos": [
3095.4712065784292,
649.9685267381775
],
"size": [
270,
88
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 23
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "PreviewAudio"
},
"widgets_values": []
},
{
"id": 18,
"type": "SaveAudioMP3",
"pos": [
3104.678850395049,
225.9556615665654
],
"size": [
550,
150
],
"flags": {},
"order": 17,
"mode": 4,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 24
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "SaveAudioMP3"
},
"widgets_values": [
"audio/ace_step_edit",
"V0"
]
},
{
"id": 15,
"type": "Knob",
"pos": [
2774.678850395049,
285.9556615665655
],
"size": [
270,
122
],
"flags": {},
"order": 16,
"mode": 0,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 22
}
],
"outputs": [
{
"name": "AUDIO",
"type": "AUDIO",
"links": [
24,
31
]
}
],
"properties": {
"cnr_id": "comfyui_ryanontheinside",
"ver": "951b1318f8958bfc441c0bcbbf2fc0695e1d9278",
"Node name for S&R": "Knob"
},
"widgets_values": [
0.2,
0.05
]
},
{
"id": 20,
"type": "PreviewAudio",
"pos": [
3135.2957876492387,
456.13105221252147
],
"size": [
512.6491099499931,
95.86364427610226
],
"flags": {},
"order": 18,
"mode": 0,
"inputs": [
{
"name": "audio",
"type": "AUDIO",
"link": 31
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.12.2",
"Node name for S&R": "PreviewAudio"
},
"widgets_values": []
},
{
"id": 21,
"type": "ACEStep15TaskTextEncode",
"pos": [
803.9301858347135,
103.54510660775249
],
"size": [
400,
454
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 32
},
{
"name": "bpm",
"shape": 7,
"type": "INT",
"widget": {
"name": "bpm"
},
"link": 33
},
{
"name": "duration",
"shape": 7,
"type": "INT",
"widget": {
"name": "duration"
},
"link": 34
},
{
"name": "keyscale",
"shape": 7,
"type": "COMBO",
"widget": {
"name": "keyscale"
},
"link": 35
}
],
"outputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"links": [
36,
37
]
}
],
"properties": {
"cnr_id": "comfyui_ryanontheinside",
"ver": "dfb20755f852feb95d88bc39f9c00a6dc1a96d9d",
"Node name for S&R": "ACEStep15TaskTextEncode"
},
"widgets_values": [
"continue the melodic electronic track with soft synths",
"repaint",
"",
"",
120,
60,
"C major",
"4",
"en",
0,
"fixed",
2,
0.85,
0.9,
0
]
}
],
"links": [
@@ -866,46 +900,6 @@
0,
"AUDIO"
],
[
2,
1,
1,
4,
0,
"CLIP"
],
[
3,
3,
8,
4,
1,
"INT"
],
[
4,
2,
0,
4,
2,
"INT"
],
[
5,
3,
16,
4,
3,
"COMBO"
],
[
6,
4,
0,
5,
0,
"CONDITIONING"
],
[
7,
16,
@@ -938,14 +932,6 @@
0,
"MODEL"
],
[
11,
4,
0,
8,
1,
"CONDITIONING"
],
[
12,
5,
@@ -1049,6 +1035,62 @@
18,
0,
"AUDIO"
],
[
31,
15,
0,
20,
0,
"AUDIO"
],
[
32,
1,
1,
21,
0,
"CLIP"
],
[
33,
3,
8,
21,
1,
"INT"
],
[
34,
2,
0,
21,
2,
"INT"
],
[
35,
3,
16,
21,
3,
"COMBO"
],
[
36,
21,
0,
8,
1,
"CONDITIONING"
],
[
37,
21,
0,
5,
0,
"CONDITIONING"
]
],
"groups": [
@@ -1121,10 +1163,10 @@
"config": {},
"extra": {
"ds": {
"scale": 0.4177248169415674,
"scale": 0.6699734054070322,
"offset": [
605.3831100907462,
1103.4212377905055
367.6347128636378,
406.24180511074536
]
},
"workflowRendererVersion": "LG",
+17 -2
View File
@@ -975,7 +975,8 @@ class ACEStep15TaskTextEncodeNode:
"required": {
"clip": ("CLIP",),
"text": ("STRING", {"multiline": True, "dynamicPrompts": True, "default": "A melodic electronic track with soft synths"}),
"task_type": (["text2music", "repaint", "cover"],), # TODO: Re-enable "extract", "lego" when ready
"task_type": (["text2music", "repaint", "cover"],
{"tooltip": "text2music/repaint use LM audio code generation (cfg_scale, temperature, top_p, top_k apply). cover uses precomputed semantic hints from source audio instead."}), # TODO: Re-enable "extract", "lego" when ready
},
"optional": {
"track_name": (["", "vocals", "drums", "bass", "guitar", "keyboard", "strings",
@@ -989,6 +990,14 @@ class ACEStep15TaskTextEncodeNode:
"timesignature": ("COMBO", {"default": "4", "options": s.VALID_TIME_SIGNATURES}),
"language": ("COMBO", {"default": "en", "options": s.VALID_LANGUAGES}),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffff}),
"cfg_scale": ("FLOAT", {"default": 2.0, "min": 0.0, "max": 100.0, "step": 0.1,
"tooltip": "Controls how closely the generated audio follows your text prompt. Higher values produce output that matches your description more literally, lower values allow more freedom. No effect on cover/extract/lego tasks, which use semantic hints from source audio instead of generating new audio codes."}),
"temperature": ("FLOAT", {"default": 0.85, "min": 0.0, "max": 2.0, "step": 0.01,
"tooltip": "Controls randomness and creativity in the generated audio. Lower values (0.7-0.85) produce more consistent, predictable results. Higher values (0.9-1.1) produce more varied, surprising output. No effect on cover/extract/lego tasks, which use semantic hints from source audio instead of generating new audio codes."}),
"top_p": ("FLOAT", {"default": 0.9, "min": 0.0, "max": 1.0, "step": 0.01,
"tooltip": "Limits how many possible audio choices are considered at each step. Lower values (e.g. 0.8) produce safer, more predictable output. Higher values allow more diversity. 1.0 disables this filter. No effect on cover/extract/lego tasks, which use semantic hints from source audio instead of generating new audio codes."}),
"top_k": ("INT", {"default": 0, "min": 0, "max": 100,
"tooltip": "Restricts each generation step to only the top K most likely choices. 0 disables this filter. Lower values (e.g. 40) reduce unlikely outputs while keeping variety. No effect on cover/extract/lego tasks, which use semantic hints from source audio instead of generating new audio codes."}),
}
}
@@ -998,7 +1007,8 @@ class ACEStep15TaskTextEncodeNode:
CATEGORY = "conditioning"
def encode(self, clip, text, task_type, track_name="", lyrics="", bpm=120,
duration=60, keyscale="C major", timesignature="4", language="en", seed=0):
duration=60, keyscale="C major", timesignature="4", language="en", seed=0,
cfg_scale=2.0, temperature=0.85, top_p=0.9, top_k=0):
# Validate track_name for extract/lego tasks
if task_type in ["extract", "lego"] and not track_name:
logger.debug(f"[ACE15_TEXT_ENCODE] Warning: track_name not specified for {task_type} task, using default instruction")
@@ -1017,9 +1027,14 @@ class ACEStep15TaskTextEncodeNode:
"seed": seed,
"task_type": task_type,
"track_name": track_name if track_name else None,
"cfg_scale": cfg_scale,
"temperature": temperature,
"top_p": top_p,
"top_k": top_k,
}
logger.debug(f"[ACE15_TEXT_ENCODE] Encoding with task_type={task_type}, track_name={track_name or 'N/A'}")
print(f"[ACE15_TEXT_ENCODE] LM params: cfg_scale={cfg_scale}, temperature={temperature}, top_p={top_p}, top_k={top_k}")
# Import to get task instruction for verification
from .patches import get_task_instruction, is_patched
+3
View File
@@ -214,9 +214,11 @@ def _create_patched_tokenizer(original_tokenize_with_weights):
# Strip our custom kwargs before forwarding to the stock tokenizer
stock_kwargs = {k: v for k, v in kwargs.items() if k not in ("task_type", "track_name")}
print(f"[ACE15_PATCHED_TOKENIZER] stock_kwargs LM params: cfg_scale={stock_kwargs.get('cfg_scale', 'MISSING')}, temperature={stock_kwargs.get('temperature', 'MISSING')}, top_p={stock_kwargs.get('top_p', 'MISSING')}, top_k={stock_kwargs.get('top_k', 'MISSING')}")
# Call the original tokenizer to get baseline output with all expected keys
out = original_tokenize_with_weights(self, text, return_word_ids, **stock_kwargs)
print(f"[ACE15_PATCHED_TOKENIZER] lm_metadata after stock tokenizer: {out.get('lm_metadata', 'MISSING')}")
# Get appropriate instruction for task type
instruction = get_task_instruction(task_type, track_name)
@@ -247,6 +249,7 @@ def _create_patched_tokenizer(original_tokenize_with_weights):
out["task_type"] = task_type
out["track_name"] = track_name
print(f"[ACE15_PATCHED_TOKENIZER] FINAL lm_metadata: {out.get('lm_metadata', 'MISSING')}")
return out
return patched_tokenize_with_weights