You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+64
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,70 @@ if __name__ == "__main__":
303
303
run()
304
304
```
305
305
306
+
## Optionals
307
+
308
+
## Stochastic Similarity Filter
309
+
310
+

311
+
312
+
Stochastic Similarity Filter reduces processing during video input by minimizing conversion operations when there is little change from the previous frame, thereby alleviating GPU processing load, as shown by the red frame in the above GIF. The usage is as follows:
There are the following parameters that can be set as arguments in the function:
324
+
325
+
### similar_image_filter_threshold
326
+
327
+
- The threshold for similarity between the previous frame and the current frame before the processing is paused.
328
+
329
+
### similar_image_filter_max_skip_frame
330
+
331
+
- The maximum interval during the pause before resuming the conversion.
332
+
333
+
## Residual CFG (RCFG)
334
+
335
+

336
+
337
+
RCFG is a method for approximately realizing CFG with competitive computational complexity compared to cases where CFG is not used. It can be specified through the cfg_type argument in the StreamDiffusion. There are two types of RCFG: one with no specified items for negative prompts RCFG Self-Negative and one where negative prompts can be specified RCFG Onetime-Negative. In terms of computational complexity, denoting the complexity without CFG as N and the complexity with a regular CFG as 2N, RCFG Self-Negative can be computed in N steps, while RCFG Onetime-Negative can be computed in N+1 steps.
338
+
339
+
The usage is as follows:
340
+
341
+
```
342
+
# w/0 CFG
343
+
cfg_type = "none"
344
+
345
+
# CFG
346
+
cfg_type = "full"
347
+
348
+
# RCFG Self-Negative
349
+
cfg_type = "self"
350
+
351
+
# RCFG Onetime-Negative
352
+
cfg_type = "initialize"
353
+
354
+
stream = StreamDiffusion(
355
+
pipe,
356
+
[32, 45],
357
+
torch_dtype=torch.float16,
358
+
cfg_type = cfg_type
359
+
)
360
+
361
+
stream.prepare(
362
+
prompt = "1girl, purple hair",
363
+
guidance_scale = guidance_scale,
364
+
delta = delta,
365
+
)
366
+
```
367
+
368
+
The delta has a moderating effect on the effectiveness of RCFG.
0 commit comments