all credits go to https://civarchive.com/user/dogmantc
i changed the code from https://civarchive.com/models/130192/lora-wildcard-maker-randomize-loras?modelVersionId=142792
it uses the .json file instead
usages the weight and all trigger words from the file
also uses this format
<lora:LookingDisgusted_V1:0.8>, ((looking disgusted)), very angry, disappointed
Description
Now you will be promt to choice a Input folder (Lora folder)
and output folder (wildcard folder)
FAQ
Comments (3)
It works great now. Did you not have the UI? or am I confusing the original with your updated version? I'd like the ability to do the JSON or normal txt files and the UI to switch between them easier but for now this is really great.
Update: It doesn't seem to be writing many of the Lora files and I am unsure why. They do have existing entries both from civit locally and on the website. Also, where are the weights coming from?
sorry the original has the ui my version only use the .json file and the weights came also from the .json file
It did not work until I changed that code in line 22 to:
with open(file_path, "r", encoding="utf-8") as file:
just adding that encoding bit in there.
However, it still did not produce good wildcards for loras without preferred weights (saying "none" where there should be a number value), so I changed this at line 25 and that fixed it. It just defaults ones without values to 1.
activation_text = json_data.get("activation text") weight = json_data.get("preferred weight") if weight is None: cleaned_weight = 1 if weight is not None: cleaned_weight = weight if activation_text is not None: cleaned_text = activation_text.strip() file_name = filename.rsplit('.', 1)[0].replace(".json", "") lora = f"<lora:{file_name}:{cleaned_weight}>"