mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-30 19:07:25 +08:00
Merge branch 'master' into feat/load3d-model-info-output
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
This commit is contained in:
commit
f323abcdc3
@ -1,5 +1,20 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
_CK_STOCHASTIC_ROUNDING_AVAILABLE = False
|
||||||
|
try:
|
||||||
|
import comfy_kitchen as ck
|
||||||
|
_ck_stochastic_rounding_fp8 = ck.stochastic_rounding_fp8
|
||||||
|
_CK_STOCHASTIC_ROUNDING_AVAILABLE = True
|
||||||
|
except (AttributeError, ImportError):
|
||||||
|
logging.warning("comfy_kitchen does not support stochastic FP8 rounding, please update comfy_kitchen.")
|
||||||
|
|
||||||
|
if not _CK_STOCHASTIC_ROUNDING_AVAILABLE:
|
||||||
|
def _ck_stochastic_rounding_fp8(value, rng, dtype):
|
||||||
|
raise NotImplementedError("comfy_kitchen does not support stochastic FP8 rounding")
|
||||||
|
|
||||||
|
|
||||||
def calc_mantissa(abs_x, exponent, normal_mask, MANTISSA_BITS, EXPONENT_BIAS, generator=None):
|
def calc_mantissa(abs_x, exponent, normal_mask, MANTISSA_BITS, EXPONENT_BIAS, generator=None):
|
||||||
mantissa_scaled = torch.where(
|
mantissa_scaled = torch.where(
|
||||||
normal_mask,
|
normal_mask,
|
||||||
@ -57,6 +72,10 @@ def stochastic_rounding(value, dtype, seed=0):
|
|||||||
if dtype == torch.float8_e4m3fn or dtype == torch.float8_e5m2:
|
if dtype == torch.float8_e4m3fn or dtype == torch.float8_e5m2:
|
||||||
generator = torch.Generator(device=value.device)
|
generator = torch.Generator(device=value.device)
|
||||||
generator.manual_seed(seed)
|
generator.manual_seed(seed)
|
||||||
|
if _CK_STOCHASTIC_ROUNDING_AVAILABLE:
|
||||||
|
rng = torch.randint(0, 256, value.size(), dtype=torch.uint8, layout=value.layout, device=value.device, generator=generator)
|
||||||
|
return _ck_stochastic_rounding_fp8(value, rng, dtype)
|
||||||
|
|
||||||
output = torch.empty_like(value, dtype=dtype)
|
output = torch.empty_like(value, dtype=dtype)
|
||||||
num_slices = max(1, (value.numel() / (4096 * 4096)))
|
num_slices = max(1, (value.numel() / (4096 * 4096)))
|
||||||
slice_size = max(1, round(value.shape[0] / num_slices))
|
slice_size = max(1, round(value.shape[0] / num_slices))
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
comfyui-frontend-package==1.44.19
|
comfyui-frontend-package==1.44.19
|
||||||
comfyui-workflow-templates==0.9.85
|
comfyui-workflow-templates==0.9.91
|
||||||
comfyui-embedded-docs==0.5.1
|
comfyui-embedded-docs==0.5.1
|
||||||
torch
|
torch
|
||||||
torchsde
|
torchsde
|
||||||
@ -22,7 +22,7 @@ alembic
|
|||||||
SQLAlchemy>=2.0.0
|
SQLAlchemy>=2.0.0
|
||||||
filelock
|
filelock
|
||||||
av>=16.0.0
|
av>=16.0.0
|
||||||
comfy-kitchen>=0.2.8
|
comfy-kitchen==0.2.9
|
||||||
comfy-aimdo==0.4.5
|
comfy-aimdo==0.4.5
|
||||||
requests
|
requests
|
||||||
simpleeval>=1.0.0
|
simpleeval>=1.0.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user