mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-30 08:10:21 +08:00
Merge branch 'comfyanonymous:master' into master
This commit is contained in:
commit
6f38e729cc
@ -128,11 +128,12 @@ def precompute_freqs_cis(head_dim, position_ids, theta, rope_dims=None, device=N
|
|||||||
|
|
||||||
|
|
||||||
def apply_rope(xq, xk, freqs_cis):
|
def apply_rope(xq, xk, freqs_cis):
|
||||||
|
org_dtype = xq.dtype
|
||||||
cos = freqs_cis[0]
|
cos = freqs_cis[0]
|
||||||
sin = freqs_cis[1]
|
sin = freqs_cis[1]
|
||||||
q_embed = (xq * cos) + (rotate_half(xq) * sin)
|
q_embed = (xq * cos) + (rotate_half(xq) * sin)
|
||||||
k_embed = (xk * cos) + (rotate_half(xk) * sin)
|
k_embed = (xk * cos) + (rotate_half(xk) * sin)
|
||||||
return q_embed, k_embed
|
return q_embed.to(org_dtype), k_embed.to(org_dtype)
|
||||||
|
|
||||||
|
|
||||||
class Attention(nn.Module):
|
class Attention(nn.Module):
|
||||||
|
|||||||
@ -162,7 +162,12 @@ def easycache_sample_wrapper(executor, *args, **kwargs):
|
|||||||
logging.info(f"{easycache.name} [verbose] - output_change_rates {len(output_change_rates)}: {output_change_rates}")
|
logging.info(f"{easycache.name} [verbose] - output_change_rates {len(output_change_rates)}: {output_change_rates}")
|
||||||
logging.info(f"{easycache.name} [verbose] - approx_output_change_rates {len(approx_output_change_rates)}: {approx_output_change_rates}")
|
logging.info(f"{easycache.name} [verbose] - approx_output_change_rates {len(approx_output_change_rates)}: {approx_output_change_rates}")
|
||||||
total_steps = len(args[3])-1
|
total_steps = len(args[3])-1
|
||||||
logging.info(f"{easycache.name} - skipped {easycache.total_steps_skipped}/{total_steps} steps ({total_steps/(total_steps-easycache.total_steps_skipped):.2f}x speedup).")
|
# catch division by zero for log statement; sucks to crash after all sampling is done
|
||||||
|
try:
|
||||||
|
speedup = total_steps/(total_steps-easycache.total_steps_skipped)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
speedup = 1.0
|
||||||
|
logging.info(f"{easycache.name} - skipped {easycache.total_steps_skipped}/{total_steps} steps ({speedup:.2f}x speedup).")
|
||||||
easycache.reset()
|
easycache.reset()
|
||||||
guider.model_options = orig_model_options
|
guider.model_options = orig_model_options
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user