CivArchive
    Preview 2663739
    Preview 2663740
    Preview 2663743
    Preview 2663742
    Preview 2663744

    Updated:

    Fixed taking the original latent instead of the previous latent in the last steps. Now you should see the difference in the level of detail.

    Minor corrections:

    Denoise now does denoise rather than counting steps. Step counting fix. Fixed a bug causing next generations to degrade.

    Version 6 updates:

    The code has been completely rewritten for optimization purposes. Progress bar shows steps correctly. The slerp_latents function has been replaced with just add_latents. The value of detail_level is saved to the cache. If a second model is connected, all settings are applied to it too. Application of masks is completely fixed. Removed noise_source setting. Added missing_steps setting — number of steps to skip after steps before extra_steps start (useful if diffusion process has already finished and you need to take details from later steps). Added copilot setting — will automatically calculate optimal values of extra_steps, missing_steps and mimic_scale based on steps and cfg set by user (new values can be viewed in console).

    Quick fix: correcting dynamic thresholding values (generations may now differ from those shown on the page for obvious reasons).

    Version 5 updates:

    Fixed a bug of a deleted function in ComfyUI code. Split into two nodes: DetailedKSampler with denoise and DetailedKSamplerAdvanced with start_at_step. Adjustment of default values. Removed three sigma rule (two thresholds are not good). Two rescaling functions replaced by one dynamic threshold by mcmonkey (highly optimized, algorithm unchanged). Change to FreeU version 2. Threshold and rescaling in Fourier filter have fixed values.

    Version 4 updates:

    Added init file. Start_at_step replaced by denoise. Added second checkpoint connection (SD version must be the same for both checkpoints) for generation on extra steps. Fixed the order of loading models. Increased range of b1 and b2 values by 0.0-4.0 and 0.25-2.1.

    Version 3 updates:

    Now auto_rescale has two interrelated settings: rescale_tonemap_to and rescale_cfg_to with a range from 0 to 100. A new function auto_freeu has been added with settings: b1 from 0.8 to 1.2; b2 from 1.2 to 1.6; s1 and s2 from 0.0 to 1.4. The progress bar has been rewritten, and steps are output to the console. Minor changes in the code execution order: first FreeU, then rescale, and then the three-sigma rule.

    If you have an error with the word "ModelPatcher", it's time to update ComfyUI. If you have an error with the words "data types", it means you have an AMD graphics card, and there may be fixes in the future.

    Version 2 updates:

    Half of the code has been rewritten for optimization purposes; Model loading/unloading has been rewritten; The tone mapping function and settings have been replaced with CFG rescaling; Latent value cutoff has been added between main and additional steps based on the three sigma rule (which may affect the brightness and contrast of generations); The mask adding function has been completely removed due to its inability to be fixed (use other sampling nodes for inpainting).

    Version 1:

    Ksampler fork from extraltodeus, which is a fork of nodes from BlenderNeko.

    One model (for any version of SD); one VAE; one positive and one negative prompt; dpmpp_3m_sde karras by default; extra_steps instead of refiner_steps; VAE.decode moved to return, accordingly two output nodes: LATENT and IMAGE.

    已更新:

    修正了在最后几步中使用原始潜影而不是前一个潜影的问题。现在你应该能看到详细程度上的差异了。

    小修正:

    去噪现在是去噪,而不是计算步数。步骤计数修复。修复了一个导致下一代质量下降的错误。

    第 6 版更新:

    为优化起见,代码已完全重写。进度条能正确显示步骤。用 add_latents 代替了 slerp_latents 函数。detail_level 的值会保存到缓存中。如果连接了第二个模型,所有设置也会应用到它。完全修复了遮罩的应用。删除了噪音源设置。添加了 missing_steps 设置 — 在 extra_steps 开始前,跳过步骤后的步骤数(如果扩散过程已经结束,需要从后面的步骤中获取细节,则该设置非常有用)。添加了 copilot 设置 — 将根据用户设置的步骤和 cfg 自动计算 extra_steps、missing_steps 和 mimic_scale 的最佳值(可在控制台中查看新值)。

    快速修复:调整动态阈值(由于显而易见的原因,现在生成的图像可能与页面上显示的图像不同)。

    第 5 版更新:

    已修复 ComfyUI 代码中的错误。将其分为两个节点:带有 denoise 功能的 DetailedKSampler 和带有 start_at_step 功能的 DetailedKSamplerAdvanced。默认值进行了调整。删除了三倍标准差规则(两个阈值并不好)。两个重新缩放函数被替换为一个动态阈值,由 mcmonkey 编写(进行了大量优化,算法未更改)。转换为 FreeU 版本 2。傅里叶滤波器中的阈值和缩放具有固定值。

    第 4 版更新:

    添加了初始文件。用 denoise 替换了 Start_at_step。添加了第二个检查点连接(两个检查点的 SD 版本必须相同),以便在额外步骤中生成。修正了加载模型的顺序。将 b1 和 b2 值的范围分别扩大了 0.0-4.0 和 0.25-2.1。

    版本 3 更新:

    现在,auto_rescale 有两个相互关联的设置:rescale_tonemap_to 和 rescale_cfg_to,范围从 0 到 100。添加了一个新的函数auto_freeu,具有以下设置:b1 从0.8到 1.2;b2 从 1.2 到 1.6;s1 和s2从 0.0 到 1.4。进度条已被重写,步骤输出到控制台。代码执行顺序的微小更改:首先是 FreeU,然后是 rescale,最后是三西格玛规则。

    如果出现带有 "ModelPatcher" 字样的错误,则表示需要更新 ComfyUI。如果出现带有 "data types" 字样的错误,则表示您使用的是 AMD 显卡,将来可能会有修复方法。

    版本 2 更新:

    为了优化,一半的代码已被重写;模型的加载/卸载已被重写;色调映射功能和设置已被替换为 CFG 重新缩放;在主要和附加步骤之间添加了基于三西格玛规则的潜在值截断(可能会影响生成物的亮度和对比度);由于无法修复,添加掩模功能已被完全删除(对于修复图像,请使用其他采样节点)。

    版本 1:

    来自 extraltodeus 的 Ksampler 分支,它是 BlenderNeko 的节点的分支。

    一个模型(适用于任何版本的 SD);一个 VAE;一个正面和一个负面的提示;默认情况下使用 dpmpp_3m_sde karras;使用 extra_steps 代替 refiner_steps;VAE.decode 移动到返回,相应地有两个输出节点:LATENT 和 IMAGE。

    Обновлено:

    Исправлено взятие исходного латента вместо предыдущего на последних шагах. Вот теперь должна быть заметна разница в уровне детализации.

    Небольшие исправления:

    Денойз теперь делает денойз, а не пересчитывает шаги. Исправление подсчёта шагов. Исправлен баг, приводящий к ухудшению следующих генераций.

    Обновления версии 6:

    Код полностью переписан в целях оптимизации. Прогресс-бар показывает шаги правильно. Функция slerp_latents заменена на просто add_latents. Значение detail_level сохраняется в кэш. Если подключена вторая модель, то все настройки применяются и к ней тоже. Применение масок полностью исправлено. Убрана настройка noise_source. Добавлена настройка missing_steps — количество шагов, которые нужно пропустить после steps перед тем, как начнутся extra_steps (полезно, если процесс диффузии уже завершился, и нужно взять детализацию из более поздних шагов). Добавлена настройка copilot — автоматически посчитает оптимальные значения extra_steps, missing_steps и mimic_scale на основе выставленных пользователем steps и cfg (новые значения можно посмотреть в консоли).

    Быстрый фикс: корректировка значений динамического порога (генерации теперь могут отличаться от представленных на странице по понятным причинам).

    Обновления версии 5:

    Исправлена ошибка удалённой в коде ComfyUI функции. Разделение на две ноды: DetailedKSampler с denoise и DetailedKSamplerAdvanced с start_at_step. Корректировка значений по умолчанию. Удалено правило трёх сигм (два порога не есть хорошо). Две функции ремасштабирования заменены на один динамический порог авторства mcmonkey (сильно оптимизировал, алгоритм без изменений). Переход на FreeU версии 2. Порог и масштабирование в фильтре Фурье имеют фиксированные значения.

    Обновления версии 4:

    Добавлен файл init. Start_at_step заменён на denoise. Добавлено подключение второго чекпоинта (версия SD должна быть одинаковой для обоих чекпоинтов) для генерации на дополнительных шагах. Исправлен порядок загрузки моделей. Увеличен диапазон значений b1 и b2 на 0.0-4.0 и 0.25-2.1.

    Обновления версии 3:

    Теперь auto_rescale имеет две взаимосвязанные настройки: rescale_tonemap_to и rescale_cfg_to с диапазоном от 0 до 100. Добавлена новая функция auto_freeu с настройками: b1 от 0.8 до 1.2; b2 от 1.2 до 1.6; s1 и s2 от 0.0 до 1.4. Переписан прогрессбар, шаги выводятся в консоль. Незначительные изменения порядка выполнения кода: сперва FreeU, затем rescale, потом правило трёх сигм.

    Если у вас возникла ошибка со словом "ModelPatcher", значит, пришло время обновить ComfyUI. Если у вас возникла ошибка со словами "data types", значит, у вас видеокарта AMD, и в будущем могут появиться исправления.

    Обновления версии 2:

    Половина кода переписана в целях оптимизации; Переписана загрузка/выгрузка моделей в память; Функция и настройки тонового отображения заменены на ремасштабирование CFG; Между основными и дополнительными шагами добавлено отсечение значений латента по правилу трёх сигм (смею предположить, что это может оказывать влияние на яркость и контрастность генераций); Функция добавления маски полностью удалена по причине невозможности исправить её (для инпейнтинга используйте другие ноды семплинга).

    Версия 1:

    Форк Ksampler от extraltodeus, который является форком нод от BlenderNeko.

    Одна модель (для любой версии SD); один VAE; один положительный и один отрицательный промпт; dpmpp_3m_sde karras по умолчанию; extra_steps вместо refiner_steps; VAE.decode перенесен в return, соответственно, два выходных узла: LATENT и IMAGE.

    Description

    FAQ

    Comments (24)

    bugmAIsterSep 25, 2023
    CivitAI
    What is AUTOFREEU? When this is turned on I get the following error: Error occurred when executing DetailedKSampler: 'ModelPatcher' object has no attribute 'set_model_output_block_patch' File "E:\ComfyULT\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "E:\ComfyULT\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "E:\ComfyULT\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "E:\ComfyULT\ComfyUI\custom_nodes\DetailedKSampler.py", line 196, in detailed_sample m.set_model_output_block_patch(output_block_patch). Off works fine. Thanks in advance!
    xebemacozydyqy
    Author
    Sep 25, 2023· 1 reaction

    This is just a copy of the new node from the "_for_testing" tab, try running it, does it work? What kind of video card do you have?

    bugmAIsterSep 25, 2023

    @Z_phyr RX6650XT but searching FreeU I discovered that my comfyui was outdated, and it didn't have that feature, new errors now, I'm going to do a clean install to solve the problems. Thanks again!

    xebemacozydyqy
    Author
    Sep 26, 2023

    @bugmaister Are these errors related to data types?

    bugmAIsterSep 27, 2023

    @Z_phyr The error now is due to lack of memory, Yesterday I read that freeUI works well with --force-fp32, and here I have to run --force-fp16 to be able to generate something, with --force-fp32, even though I try to generate a 64x64, 512x512 image, cmd.exe closes without any error. With freeUI turned off everything runs fine. Remembering that it is an RX6650XT, the solution is to wait for some improvement in relation to RADEONs or buy an NVIDIA! ;0)

    bugmAIsterSep 27, 2023

    @Z_phyr I did not find "_for_testing"

    nishuSep 25, 2023
    CivitAI

    Error occurred when executing DetailedKSampler: 'ModelPatcher' object has no attribute 'set_model_output_block_patch'

    xebemacozydyqy
    Author
    Sep 26, 2023

    Could you please clarify what kind of video card you have and how long ago did you update ComfyUI?

    EricRollei21Sep 29, 2023
    CivitAI

    That's cool you have added the FreeU already. I'm confused about the rescale_CFG and rescale tone_map settings. The values you put there are like the mimic values? And for FreeU, I've found for SDXL that the useful range of B1 can be 0-4, B2 from .25 - 2.1 outside of that range it can break the image but can do some really cool effects past what you allow. Wish there were a way to add the refiner to this sampler. Thanks!

    xebemacozydyqy
    Author
    Sep 29, 2023

    Because cfg has the same values, but in practice there is no point in setting it higher than 30.
    I don't think there is any point in using FreeU for XL in general, as the effect is insignificant.
    Refiner, well, it's possible, but I'm not sure how to make such a switch yet.

    EricRollei21Sep 29, 2023

    @Z_phyr Well that's not true at all about FreeU. It can have a very big effect depending on the settings at least from what I have seen in my own images. But ymmv As far as CFG, my question was how does your scaling work and what values do you recommend? How is it compared to dynamic thresholding which is also available for ComfyUI?

    xebemacozydyqy
    Author
    Sep 29, 2023· 1 reaction

    @EricRollei21 "Rescale" is responsible for scaling the final output of the function based on standard deviations. "Tonemap" is responsible for adjusting the upper value, which in turn affects the scaling of the length of the vector difference between the conditional and unconditional inputs.

    EricRollei21Sep 29, 2023

    @Z_phyr  Thanks, that wasn't enough detail for me to understand how it works, nor know what values to use for intended purposes.

    xebemacozydyqy
    Author
    Sep 30, 2023· 1 reaction

    @EricRollei21 The defaults are optimal, the higher the cfg, the lower the tonemap and the higher the rescale, because, although it's not technically correct, rescale allows deviation and tonemap forbids it.

    slackalopeSep 30, 2023
    CivitAI

    Awesome work! How difficult would it be to add a variation seed and control after generate for it that gets maintained in the embedded image workflow data for reproducibility?

    xebemacozydyqy
    Author
    Sep 30, 2023

    I didn't understand, should I make the seed the input of the node or make the result repeatable on other samplers and interfaces?

    Beast01Oct 3, 2023
    CivitAI

    in comfyui, DetailedKSampler mission, tell me solution, I try to use manager but not working

    Beast01Oct 3, 2023

    i also search in internet but not found DetailedKSampler, please help me to resolved this issue

    xebemacozydyqy
    Author
    Oct 3, 2023

    Have you tried just putting the .py file in the custom_nodes folder?

    Beast01Oct 3, 2023

    @Z_phyr  no, but now i putting the .py file in the custom_nodes folder, and its work perfectly. thank you for this workflow. this is very simple and fast image generating workflow.
    Can I request you a custom workflow?
    I search lots in internet but can find below mention workflow, everywhere I find that is too much complex workflow, that is very difficult to understand and that come with many unnecessary nodes that consume too much resource and time. That workflow image generation time more than 10 mins. I just need simple and efficient workflow just like your workflow.
    I need
    "checkpoint + vae + clip skip + lora (min. 2 no.) + highres.fix + refiner + FaceDetailer + FreeU + upscale(which can easily bypass able)" combine together in simple & efficient worflow.
    If you keep my request, I will be thankful to you.

    Beast01Oct 3, 2023
    CivitAI

    Can I request you a custom workflow?
    I search lots in internet but can find below mention workflow, everywhere I find that is too much complex workflow, that is very difficult to understand and that come with many unnecessary nodes that consume too much resource and time. That workflow image generation time more than 10 mins. I just need simple and efficient workflow just like your workflow.
    I need
    "checkpoint + vae + clip skip + lora (min. 2 no.) + highres.fix + refiner + FaceDetailer + FreeU + upscale(which can easily bypass able)" combine together in simple & efficient worflow.
    If you keep my request, I will be thankful to you.

    Beast01Oct 3, 2023

    actually I have 4GB vRAM.

    xebemacozydyqy
    Author
    Oct 4, 2023· 1 reaction

    https://pastebin.com/2hM6zvyb It should probably look like this, but you should realize that the more requirements there are, the more nodes and connections between them, and that the less video memory there is, the slower the generation will be, in any case it cannot be avoided. I'm sure that my node uses correct loading and unloading of models into video memory, but I can't be responsible for other nodes, of course.

    Beast01Oct 4, 2023

    @Z_phyr thank you this workflow😊. bro just you forget to connect VAE Decode in face detailer with refinder detailed ksampler. I connect the missing connection and its work perfectly.
    Again thank you❤️.

    Other
    SDXL 1.0

    Details

    Downloads
    301
    Platform
    CivitAI
    Platform Status
    Available
    Created
    9/25/2023
    Updated
    5/12/2026
    Deleted
    -

    Files

    comfyuiDetailed_detailedksamplerv3.zip

    Mirrors

    Available On (1 platform)

    Same model published on other platforms. May have additional downloads or version variants.