mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
framepack: patch solver for unsupported gpus
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+3
-2
@@ -54,10 +54,11 @@
|
||||
- **Fixes**
|
||||
- ui: fix image metadata display when switching selected image in control tab
|
||||
- framepack: add explicit hf-login before framepack load
|
||||
- framepack: patch solver for unsupported gpus
|
||||
- benchmark: remove forced sampler from system info benchmark
|
||||
- xyz-grid: fix xyz grid with random seeds
|
||||
- fix download for sd15/sdxl reference models
|
||||
|
||||
- reference: fix download for sd15/sdxl reference models
|
||||
|
||||
## Update for 2025-09-15
|
||||
|
||||
### Highlights for 2025-09-15
|
||||
|
||||
@@ -54,7 +54,7 @@ def worker(
|
||||
|
||||
from modules.framepack.pipeline import hunyuan
|
||||
from modules.framepack.pipeline import utils
|
||||
from modules.framepack.pipeline.k_diffusion_hunyuan import sample_hunyuan
|
||||
from modules.framepack.pipeline import k_diffusion_hunyuan
|
||||
|
||||
is_f1 = variant == 'forward-only'
|
||||
total_generated_frames = 0
|
||||
@@ -244,7 +244,7 @@ def worker(
|
||||
transformer.initialize_teacache(enable_teacache=use_teacache, num_steps=steps, rel_l1_thresh=shared.opts.teacache_thresh)
|
||||
|
||||
t_sample = time.time()
|
||||
generated_latents = sample_hunyuan(
|
||||
generated_latents = k_diffusion_hunyuan.sample_hunyuan(
|
||||
transformer=transformer,
|
||||
sampler='unipc',
|
||||
width=width,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
import torch
|
||||
|
||||
import numpy as np
|
||||
from tqdm.auto import trange
|
||||
|
||||
|
||||
@@ -13,6 +13,36 @@ def expand_dims(v, dims):
|
||||
return v[(...,) + (None,) * (dims - 1)]
|
||||
|
||||
|
||||
torch_linalg_solve = None
|
||||
|
||||
|
||||
def test_solver():
|
||||
from modules import devices, shared
|
||||
try:
|
||||
a = torch.randn(50, 50).to(device=devices.device, dtype=torch.float32)
|
||||
b = torch.randn(50, 2).to(device=devices.device, dtype=torch.float32)
|
||||
_x = torch.linalg.solve(a, b)
|
||||
return True
|
||||
except Exception as e:
|
||||
shared.log.debug(f'FramePack: solver=cpu {e}')
|
||||
return False
|
||||
|
||||
|
||||
def linalg_solve(A, B, device):
|
||||
global torch_linalg_solve # pylint: disable=global-statement
|
||||
if torch_linalg_solve is None:
|
||||
torch_linalg_solve = test_solver()
|
||||
if torch_linalg_solve:
|
||||
X = torch.linalg.solve(A, B)
|
||||
return X
|
||||
else:
|
||||
A_np = A.float().cpu().numpy()
|
||||
B_np = B.float().cpu().numpy()
|
||||
X_np = np.linalg.solve(A_np, B_np)
|
||||
X = torch.from_numpy(X_np).to(device=device, dtype=A.dtype)
|
||||
return X
|
||||
|
||||
|
||||
class FlowMatchUniPC:
|
||||
def __init__(self, model, extra_args, variant='bh1'):
|
||||
self.model = model
|
||||
@@ -78,7 +108,7 @@ class FlowMatchUniPC:
|
||||
if order == 2:
|
||||
rhos_p = torch.tensor([0.5], device=b.device)
|
||||
else:
|
||||
rhos_p = torch.linalg.solve(R[:-1, :-1], b[:-1])
|
||||
rhos_p = linalg_solve(R[:-1, :-1], b[:-1], x.device)
|
||||
else:
|
||||
D1s = None
|
||||
rhos_p = None
|
||||
@@ -86,7 +116,7 @@ class FlowMatchUniPC:
|
||||
if order == 1:
|
||||
rhos_c = torch.tensor([0.5], device=b.device)
|
||||
else:
|
||||
rhos_c = torch.linalg.solve(R, b)
|
||||
rhos_c = linalg_solve(R, b, x.device)
|
||||
|
||||
x_t_ = expand_dims(t / t_prev_0, dims) * x - expand_dims(h_phi_1, dims) * model_prev_0
|
||||
|
||||
|
||||
+1
-1
Submodule wiki updated: 3df7dbfc9c...bd99059328
Reference in New Issue
Block a user