Skip to content

Commit c178911

Browse files
committed
Add reroll button
Sampling is non-deterministic, but seed isn't exposed. Properly fixing this is a high priority, but until I figure it out, a reroll button has been added as a temporary fix that will mark the node as stale. Removed the cast from model load. It seems to force a copy which slows down the initial load. Remove an errant space from the README
1 parent f045e1b commit c178911

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
ComfyUI implementation for Orpheus TTS. Heavily WIP.
33

44
- Place [snac-24khz](https://huggingface.co/Annuvin/snac-24khz-ST/blob/main/model.safetensors) in models/vae
5-
- Requires Orpheus -8b.safetensors (either pt or ft). Options are being considered for distribution.
5+
- Requires Orpheus-8b.safetensors (either pt or ft). Options are being considered for distribution.

nodes.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,24 @@ def loadorpheus(self, model):
156156
conf = os.path.join(os.path.split(__file__)[0], 'orpheus-config.json')
157157
config = PretrainedConfig.from_json_file(conf)
158158
sd = safetensors.torch.load_file(model)
159-
model = LlamaForCausalLM.from_pretrained(None, config=config, state_dict=sd, torch_dtype=torch.float16)
159+
model = LlamaForCausalLM.from_pretrained(None, config=config, state_dict=sd)
160160
return model,
161161

162162
class OrpheusSample:
163163
@classmethod
164164
def INPUT_TYPES(s):
165165
return {"required": {"model": ("ORPH_MODEL",),
166166
"prompt": ("ORPH_TOKENS",),
167-
"add_start_token": ("BOOLEAN", {"default": True})},}
167+
"add_start_token": ("BOOLEAN", {"default": True}),
168+
},
169+
"hidden": {"seed": "seed"}}
168170
FUNCTION = "sample"
169171
RETURN_TYPES = ("ORPH_TOKENS","ORPH_TOKENS", "ORPH_TOKENS")
170172
RETURN_NAMES = ("full", "chunk", "generated")
171173
CATEOGRY = "Orpheus"
172-
def sample(self, model, prompt, add_start_token):
174+
def sample(self, model, prompt, add_start_token, seed=None):
175+
#Seed is not something reproducible. Just a "reroll" counter
176+
#TODO: Figure out seed. Likely requires migrating away from transformers
173177
if add_start_token:
174178
prompt += [TOKENS['start_of_ai'], TOKENS['start_of_speech']]
175179
chunk_index = len(prompt)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-orpheus"
33
description = "Nodes for using Orpheus-TTS in ComfyUI"
4-
version = "0.1.1"
4+
version = "0.1.2"Q
55
classifiers = [
66
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)"
77
]

web/orpheus.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ app.registerExtension({
3737
}
3838
})
3939
})
40+
} else if (nodeData?.name == "ORPH_Sample") {
41+
chainCallback(nodeType.prototype, "onNodeCreated", function () {
42+
let w = this.addWidget("button", "reroll", "seed", () => w.value++)
43+
w.value = 0
44+
})
4045
}
4146
},
4247
})

0 commit comments

Comments
 (0)