Replies: 3 comments 5 replies
-
The XYZ PLOT extension only shows options from the first tab of ADetailer because the axis = [
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 1st",
str,
partial(set_value, field="ad_model"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 1st",
str,
partial(set_value, field="ad_prompt"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 1st",
str,
partial(set_value, field="ad_negative_prompt"),
),
xyz_grid.AxisOption(
"[ADetailer] Prompt S/R (AD 1st)",
str,
partial(search_and_replace_prompt, replace_in_main_prompt=False),
),
xyz_grid.AxisOption(
"[ADetailer] Prompt S/R (AD 1st and main prompt)",
str,
partial(search_and_replace_prompt, replace_in_main_prompt=True),
),
xyz_grid.AxisOption(
"[ADetailer] Mask erosion / dilation 1st",
int,
partial(set_value, field="ad_dilate_erode"),
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint denoising strength 1st",
float,
partial(set_value, field="ad_denoising_strength"),
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint only masked 1st",
str,
partial(set_value, field="ad_inpaint_only_masked"),
choices=lambda: ["True", "False"],
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint only masked padding 1st",
int,
partial(set_value, field="ad_inpaint_only_masked_padding"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer sampler 1st",
str,
partial(set_value, field="ad_sampler"),
choices=lambda: samplers,
),
xyz_grid.AxisOption(
"[ADetailer] ControlNet model 1st",
str,
partial(set_value, field="ad_controlnet_model"),
choices=lambda: ["None", "Passthrough", *get_cn_models()],
),
] This code does not include any options for the second or third tabs, which is why the XYZ PLOT extension only shows options from the first tab [1]. Additionally, there is a similar unsolved discussion on this topic that you might find useful: Adding ADetailer (AD 2nd) to XYZ Plot? [2]. |
Beta Was this translation helpful? Give feedback.
-
oh....wow... am i seeing you sednimg me some code which can make it work ?
i am sadly not knowledgabel with coding at all. but i really really would like to try .... how can i find instructions that are more geared towards an ignorant bafoon like myself?
wow
On 11 Sep 2024, at 20:45, dosubot[bot] ***@***.***> wrote:
Yes, the XYZ PLOT extension does not currently include options for the second and third tabs of ADetailer because these options were never added in the first place. To include these options, the make_axis_on_xyz_grid function in the scripts/!adetailer.py file needs to be extended to define axis options for the second and third tabs.
Here is an example of how you can extend the make_axis_on_xyz_grid function to include options for the second and third tabs:
def make_axis_on_xyz_grid():
xyz_grid = None
for script in scripts.scripts_data:
if script.script_class.__module__ == "xyz_grid.py":
xyz_grid = script.module
break
if xyz_grid is None:
return
model_list = ["None", *model_mapping.keys()]
samplers = [sampler.name for sampler in all_samplers]
axis = [
# Existing options for the 1st tab
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 1st",
str,
partial(set_value, field="ad_model"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 1st",
str,
partial(set_value, field="ad_prompt"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 1st",
str,
partial(set_value, field="ad_negative_prompt"),
),
xyz_grid.AxisOption(
"[ADetailer] Prompt S/R (AD 1st)",
str,
partial(search_and_replace_prompt, replace_in_main_prompt=False),
),
xyz_grid.AxisOption(
"[ADetailer] Prompt S/R (AD 1st and main prompt)",
str,
partial(search_and_replace_prompt, replace_in_main_prompt=True),
),
xyz_grid.AxisOption(
"[ADetailer] Mask erosion / dilation 1st",
int,
partial(set_value, field="ad_dilate_erode"),
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint denoising strength 1st",
float,
partial(set_value, field="ad_denoising_strength"),
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint only masked 1st",
str,
partial(set_value, field="ad_inpaint_only_masked"),
choices=lambda: ["True", "False"],
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint only masked padding 1st",
int,
partial(set_value, field="ad_inpaint_only_masked_padding"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer sampler 1st",
str,
partial(set_value, field="ad_sampler"),
choices=lambda: samplers,
),
xyz_grid.AxisOption(
"[ADetailer] ControlNet model 1st",
str,
partial(set_value, field="ad_controlnet_model"),
choices=lambda: ["None", "Passthrough", *get_cn_models()],
),
# New options for the 2nd tab
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 2nd",
str,
partial(set_value, field="ad_model_2nd"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 2nd",
str,
partial(set_value, field="ad_prompt_2nd"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 2nd",
str,
partial(set_value, field="ad_negative_prompt_2nd"),
),
# New options for the 3rd tab
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 3rd",
str,
partial(set_value, field="ad_model_3rd"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 3rd",
str,
partial(set_value, field="ad_prompt_3rd"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 3rd",
str,
partial(set_value, field="ad_negative_prompt_3rd"),
),
]
if not any(x.label.startswith("[ADetailer]") for x in xyz_grid.axis_options):
xyz_grid.axis_options.extend(axis)
By adding these options, the XYZ PLOT extension can be upgraded to include parameters from the second and third tabs of ADetailer [1] <https://github.com/Bing-su/adetailer/blob/main/scripts/!adetailer.py>.
To continue talking to Dosu <https://dosu.dev/>, mention @dosu <https://github.com/dosu>.
—
Reply to this email directly, view it on GitHub <#710 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ANLIMFOA44JT2CEYBG2MYVDZWCFWPAVCNFSM6AAAAABOBOQR6GVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANRRG44TSNI>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
how can i backup this file before,and how would i restore that file, in case that i make a mistake?
the chance for me to make a mistake is 100%
:(
On 11 Sep 2024, at 20:53, dosubot[bot] ***@***.***> wrote:
To help you implement the changes, here are step-by-step instructions:
Locate the scripts/!adetailer.py File:
Navigate to the directory where your ADetailer repository is cloned.
Open the scripts folder and find the !adetailer.py file.
Edit the make_axis_on_xyz_grid Function:
Open the !adetailer.py file in a text editor.
Find the make_axis_on_xyz_grid function. If it doesn't exist, you can add it at the end of the file.
Add the New Axis Options:
Copy and paste the following code into the make_axis_on_xyz_grid function or create the function if it doesn't exist:
from functools import partial
def set_value(p, x: Any, xs: Any, *, field: str):
if not hasattr(p, "_ad_xyz"):
p._ad_xyz = {}
p._ad_xyz[field] = x
def search_and_replace_prompt(p, x: Any, xs: Any, replace_in_main_prompt: bool):
if replace_in_main_prompt:
p.prompt = p.prompt.replace(xs[0], x)
p.negative_prompt = p.negative_prompt.replace(xs[0], x)
if not hasattr(p, "_ad_xyz_prompt_sr"):
p._ad_xyz_prompt_sr = []
p._ad_xyz_prompt_sr.append(PromptSR(s=xs[0], r=x))
def make_axis_on_xyz_grid():
xyz_grid = None
for script in scripts.scripts_data:
if script.script_class.__module__ == "xyz_grid.py":
xyz_grid = script.module
break
if xyz_grid is None:
return
model_list = ["None", *model_mapping.keys()]
samplers = [sampler.name for sampler in all_samplers]
axis = [
# Existing options for the 1st tab
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 1st",
str,
partial(set_value, field="ad_model"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 1st",
str,
partial(set_value, field="ad_prompt"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 1st",
str,
partial(set_value, field="ad_negative_prompt"),
),
xyz_grid.AxisOption(
"[ADetailer] Prompt S/R (AD 1st)",
str,
partial(search_and_replace_prompt, replace_in_main_prompt=False),
),
xyz_grid.AxisOption(
"[ADetailer] Prompt S/R (AD 1st and main prompt)",
str,
partial(search_and_replace_prompt, replace_in_main_prompt=True),
),
xyz_grid.AxisOption(
"[ADetailer] Mask erosion / dilation 1st",
int,
partial(set_value, field="ad_dilate_erode"),
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint denoising strength 1st",
float,
partial(set_value, field="ad_denoising_strength"),
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint only masked 1st",
str,
partial(set_value, field="ad_inpaint_only_masked"),
choices=lambda: ["True", "False"],
),
xyz_grid.AxisOption(
"[ADetailer] Inpaint only masked padding 1st",
int,
partial(set_value, field="ad_inpaint_only_masked_padding"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer sampler 1st",
str,
partial(set_value, field="ad_sampler"),
choices=lambda: samplers,
),
xyz_grid.AxisOption(
"[ADetailer] ControlNet model 1st",
str,
partial(set_value, field="ad_controlnet_model"),
choices=lambda: ["None", "Passthrough", *get_cn_models()],
),
# New options for the 2nd tab
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 2nd",
str,
partial(set_value, field="ad_model_2nd"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 2nd",
str,
partial(set_value, field="ad_prompt_2nd"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 2nd",
str,
partial(set_value, field="ad_negative_prompt_2nd"),
),
# New options for the 3rd tab
xyz_grid.AxisOption(
"[ADetailer] ADetailer model 3rd",
str,
partial(set_value, field="ad_model_3rd"),
choices=lambda: model_list,
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer prompt 3rd",
str,
partial(set_value, field="ad_prompt_3rd"),
),
xyz_grid.AxisOption(
"[ADetailer] ADetailer negative prompt 3rd",
str,
partial(set_value, field="ad_negative_prompt_3rd"),
),
]
if not any(x.label.startswith("[ADetailer]") for x in xyz_grid.axis_options):
xyz_grid.axis_options.extend(axis)
Save the File:
Save the changes you made to the !adetailer.py file.
Restart the Application:
Restart the application or service that uses ADetailer to apply the changes.
By following these steps, you should be able to add options for the second and third tabs of ADetailer to the XYZ PLOT extension [1] <https://github.com/Bing-su/adetailer/blob/main/scripts/!adetailer.py>.
To continue talking to Dosu <https://dosu.dev/>, mention @dosu <https://github.com/dosu>.
—
Reply to this email directly, view it on GitHub <#710 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ANLIMFKO62SWWYWIMOGYF3LZWCGSPAVCNFSM6AAAAABOBOQR6GVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANRRHAYDIOA>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
i have a stupid question: when i use XYZ PLOT extension with adetailer variations, the first tab of adetailer does show as options to pick from with inside that xyz plot extension. but when i use the second or even 3rd tab with adetailer , where i do an additional adetailer option, that adetailer 2nd tab, or 3rd tab, does not show as a pickable option within that xyz plot extension scroll down window . would this be an issue for adetailer, to supply a component to whoever created xyz plot extension ? so that the creator of the xyz plot extension could implement it into its scroll down window, like the many other adetailer options, which are already placed there (sadly only for 1st tab of adetailer choosable...as in ..... "[ADetailer] ADetailer prompt 1st"..... . in other words there are no .... "[ADetailer] ADetailer prompt 2nd"..... only from 1st tab, see screenshot below:
.
.
.
Beta Was this translation helpful? Give feedback.
All reactions