mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-22 11:57:44 +08:00
Compare commits
5 Commits
fa368cb01b
...
dd028c04e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd028c04e2 | ||
|
|
f5030e26fd | ||
|
|
66e1b07402 | ||
|
|
be4345d1c9 | ||
|
|
7d493629a4 |
@ -3,6 +3,7 @@ import comfy.text_encoders.llama
|
|||||||
from comfy import sd1_clip
|
from comfy import sd1_clip
|
||||||
import torch
|
import torch
|
||||||
import math
|
import math
|
||||||
|
import comfy.utils
|
||||||
|
|
||||||
|
|
||||||
def sample_manual_loop_no_classes(
|
def sample_manual_loop_no_classes(
|
||||||
@ -42,6 +43,8 @@ def sample_manual_loop_no_classes(
|
|||||||
for x in range(model_config.num_hidden_layers):
|
for x in range(model_config.num_hidden_layers):
|
||||||
past_key_values.append((torch.empty([embeds.shape[0], model_config.num_key_value_heads, embeds.shape[1] + min_tokens, model_config.head_dim], device=device, dtype=execution_dtype), torch.empty([embeds.shape[0], model_config.num_key_value_heads, embeds.shape[1] + min_tokens, model_config.head_dim], device=device, dtype=execution_dtype), 0))
|
past_key_values.append((torch.empty([embeds.shape[0], model_config.num_key_value_heads, embeds.shape[1] + min_tokens, model_config.head_dim], device=device, dtype=execution_dtype), torch.empty([embeds.shape[0], model_config.num_key_value_heads, embeds.shape[1] + min_tokens, model_config.head_dim], device=device, dtype=execution_dtype), 0))
|
||||||
|
|
||||||
|
progress_bar = comfy.utils.ProgressBar(max_new_tokens)
|
||||||
|
|
||||||
for step in range(max_new_tokens):
|
for step in range(max_new_tokens):
|
||||||
outputs = model.transformer(None, attention_mask, embeds=embeds.to(execution_dtype), num_tokens=num_tokens, intermediate_output=None, dtype=execution_dtype, embeds_info=embeds_info, past_key_values=past_key_values)
|
outputs = model.transformer(None, attention_mask, embeds=embeds.to(execution_dtype), num_tokens=num_tokens, intermediate_output=None, dtype=execution_dtype, embeds_info=embeds_info, past_key_values=past_key_values)
|
||||||
next_token_logits = model.transformer.logits(outputs[0])[:, -1]
|
next_token_logits = model.transformer.logits(outputs[0])[:, -1]
|
||||||
@ -90,6 +93,7 @@ def sample_manual_loop_no_classes(
|
|||||||
attention_mask = torch.cat([attention_mask, torch.ones((2, 1), device=device, dtype=attention_mask.dtype)], dim=1)
|
attention_mask = torch.cat([attention_mask, torch.ones((2, 1), device=device, dtype=attention_mask.dtype)], dim=1)
|
||||||
|
|
||||||
output_audio_codes.append(token - audio_start_id)
|
output_audio_codes.append(token - audio_start_id)
|
||||||
|
progress_bar.update_absolute(step)
|
||||||
|
|
||||||
return output_audio_codes
|
return output_audio_codes
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,24 @@ class StringMultiline(io.ComfyNode):
|
|||||||
return io.NodeOutput(value)
|
return io.NodeOutput(value)
|
||||||
|
|
||||||
|
|
||||||
|
class RandInt(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="PrimitiveRandomInt",
|
||||||
|
display_name="RandomInt",
|
||||||
|
category="utils/primitive",
|
||||||
|
inputs=[
|
||||||
|
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize, control_after_generate=True),
|
||||||
|
],
|
||||||
|
outputs=[io.Int.Output()],
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, value: int) -> io.NodeOutput:
|
||||||
|
return io.NodeOutput(value)
|
||||||
|
|
||||||
|
|
||||||
class Int(io.ComfyNode):
|
class Int(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
@ -48,7 +66,7 @@ class Int(io.ComfyNode):
|
|||||||
display_name="Int",
|
display_name="Int",
|
||||||
category="utils/primitive",
|
category="utils/primitive",
|
||||||
inputs=[
|
inputs=[
|
||||||
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize, control_after_generate=True),
|
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize),
|
||||||
],
|
],
|
||||||
outputs=[io.Int.Output()],
|
outputs=[io.Int.Output()],
|
||||||
)
|
)
|
||||||
@ -100,6 +118,7 @@ class PrimitivesExtension(ComfyExtension):
|
|||||||
return [
|
return [
|
||||||
String,
|
String,
|
||||||
StringMultiline,
|
StringMultiline,
|
||||||
|
RandInt,
|
||||||
Int,
|
Int,
|
||||||
Float,
|
Float,
|
||||||
Boolean,
|
Boolean,
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
# This file is automatically generated by the build process when version is
|
# This file is automatically generated by the build process when version is
|
||||||
# updated in pyproject.toml.
|
# updated in pyproject.toml.
|
||||||
__version__ = "0.11.1"
|
__version__ = "0.12.0"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "ComfyUI"
|
name = "ComfyUI"
|
||||||
version = "0.11.1"
|
version = "0.12.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { file = "LICENSE" }
|
license = { file = "LICENSE" }
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
comfyui-frontend-package==1.37.11
|
comfyui-frontend-package==1.37.11
|
||||||
comfyui-workflow-templates==0.8.27
|
comfyui-workflow-templates==0.8.31
|
||||||
comfyui-embedded-docs==0.4.0
|
comfyui-embedded-docs==0.4.0
|
||||||
torch
|
torch
|
||||||
torchsde
|
torchsde
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user