New feature for X/Y Plot: comparison of 3rd party models with activation tokens #5123
Replies: 1 comment 3 replies
-
So I am not a coder but trying to work out some script changes with the notorious chatGPT myself. I want to populate lists for a dropdown menu and increase the number of options that can be ran at once. This seems like a super powerful tool that is a great sequencer concept. You could populate a list of embeddings or tokens or templates or whatever too.- The code defines two functions, "apply_sampler" and "confirm_samplers". The "apply_sampler" function takes in three arguments, "p", "x", and "xs". It uses the "get()" method to check if the lowercase version of "x" exists in a dictionary called "samplers_map". If it does not exist, it raises a "RuntimeError" with the message "Unknown sampler: {x}". If it does exist, it sets the "sampler_name" attribute of the "p" object to the value of "sampler_name". The "confirm_samplers" function takes in two arguments, "p" and "xs". It iterates through each item "x" in "xs" and checks if the lowercase version of "x" exists in the "samplers_map" dictionary. If it does not, it raises a "RuntimeError" with the message "Unknown sampler: {x}". This function is likely used to confirm that all items in "xs" are valid entries in the "samplers_map" dictionary. i'd like to be able to populate the list of samplers from a folder location Copy code def populate_samplers_list(folder_path): samplers_list = populate_samplers_list("path/to/folder") You can then use this list in the confirm_samplers function to check if the sampler is valid or not. Copy code Copy code for a dropdown menu too instead of having to type the names in sorry Here is an example of how you might implement a dropdown menu using Tkinter: Copy code def select_sampler(samplers_list):
samplers_list = populate_samplers_list("path/to/folder") Please note that this is just an example, you will have to adjust it to your specific use case and also you will have to import the tkinter module and install it if not already installed. does this help to figure out how to properly write that? import modules.scripts as scripts from modules import images, paths, sd_samplers, processing, sd_models, sd_vae from modules.ui_components import ToolButton fill_values_symbol = "\U0001f4d2" # 📒 def apply_field(field):
This code appears to be part of a larger project that uses various modules, including gradio, PIL, numpy, csv, io, and itertools. The apply_field function is defined, which takes in one argument, "field" and returns a nested function, "fun". The returned function takes in three arguments, "p", "x" and "xs" and it uses the setattr() function to set the attribute of "p" object to the value of "x" which is passed as an argument. This function is likely being used to set specific attributes of an object "p" based on user input. The apply_field function allows to define a function that sets an attribute of an object, by passing the name of the attribute as an argument and it returns a new function that can be used to set that attribute. The code also imports various modules, including modules.scripts, modules.images, modules.paths, modules.sd_samplers, modules.processing, modules.sd_models, modules.sd_vae, modules.hypernetworks, modules.processing, modules.shared, modules.sd_samplers, modules.sd_models, modules.sd_vae, modules.ui_components and glob, os, re . It also defines a variable fill_values_symbol which is set to the Unicode character for a notebook. It is not clear how this variable is used in the larger context of the program. I think the fill values is for tokenizing and translating text image prompt It's used to replace certain parts of a text string with a symbol, such as fill_values_symbol, so that the user can easily identify the parts of the text that need to be filled in. This can be helpful for creating interactive prompts or forms, where the user needs to input specific information. The filled in values can then be translated into image with the help of libraries like PIL, numpy etc. It's not clear from the provided code snippet how this variable is used in the larger context of the program, but it seems like it's related to the text-image prompt generation. i'm just trying to populate those modules with a list from file locations in the program and create a buttons that drop down from the lists You can use the glob module to dynamically find all the modules in a given folder location, and then use the importlib module to import those modules. Here's an example of how you might do this: Copy code def populate_modules_list(folder_path): modules_list = populate_modules_list("path/to/folder") Then, you can use this list to create a dropdown menu in a GUI library such as Tkinter, PyQt, or wxPython, to allow the user to select a module from the list. Here's an example of how you might create a dropdown menu using Tkinter: Copy code def create_module_dropdown(modules_list):
modules_list = populate_modules_list("path/to/folder") Please note that this is just an example, you will have to adjust it to your specific use case and also you will have to import the tkinter module and install it if not already installed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, the X/Y Plot script for AUTOMATIC1111 can already compare multiple models with the
Checkpoint name
type.It works well if you are comparing models that have no activation tokens (e.g.: SD 1.4 vs 1.5 vs 2.0).
But it doesn't work well if, for example, you want to compare
classicAnim-v1.ckpt
vsmoDi-v1-pruned.ckpt
vsrobo-diffusion-v1.ckpt
, etc. And that's because these checkpoint need an activation token:classic disney style
,modern disney style
,nousr robot
, etc.You could theoretically use
Checkpoint name
for the X type andPrompt S/R
for the Y type, but it would produce a lot of unnecessary outputs.It would be much better if the X/Y Plot script could associate an activation token to each checkpoint in the X type.
Beta Was this translation helpful? Give feedback.
All reactions