wildcards limit max recursion

This commit is contained in:
Vladimir Mandic
2024-05-14 13:03:55 -04:00
parent 76cbf11559
commit 1ad27d4b25
2 changed files with 15 additions and 12 deletions
+11 -9
View File
@@ -25,16 +25,18 @@ Thanks to @BinaryQuantumSoul for his hard work on this project!
### New built-in features
- HiDiffusion allows generating very-high resolution images out-of-the-box using standard models
- Perturbed-Attention Guidance (PAG) enhances sample quality in addition to standard CFG scale
- IP adapter masking allows to use multiple input images for each segment of the input image
- IP adapter InstantStyle implementation
- Token Downsampling (ToDO) provides significant speedups with minimal-to-none quality loss
- Samplers optimizations that allow normal samplers to complete work in 1/3 of the steps!
- **Gallery**: extremely fast built-in gallery viewer
List, preview, search through all your images and videos!
- **HiDiffusion** allows generating very-high resolution images out-of-the-box using standard models
- **Perturbed-Attention Guidance** (PAG) enhances sample quality in addition to standard CFG scale
- **IP adapter masking** allows to use multiple input images for each segment of the input image
- IP adapter **InstantStyle** implementation
- **Token Downsampling** (ToDO) provides significant speedups with minimal-to-none quality loss
- **Samplers optimizations** that allow normal samplers to complete work in 1/3 of the steps!
Yup, even popular DPM++2M can now run in 10 steps with quality equaling 30 steps
- Native wildcards support
- Improved built-in Face HiRes
- Better outpainting
- Native **wildcards** support
- Improved built-in **Face HiRes**
- Better **outpainting**
- And much more...
For details of above features and full list, see [Changelog](https://github.com/vladmandic/automatic/blob/dev/CHANGELOG.md)
+4 -3
View File
@@ -42,7 +42,7 @@ def apply_styles_to_prompt(prompt, styles):
return prompt
def apply_file_wildcards(prompt, replaced = [], not_found = []):
def apply_file_wildcards(prompt, replaced = [], not_found = [], recursion=0):
def check_files(prompt, wildcard, files):
for file in files:
if wildcard == os.path.splitext(os.path.basename(file))[0] if os.path.sep not in wildcard else wildcard in file:
@@ -58,7 +58,8 @@ def apply_file_wildcards(prompt, replaced = [], not_found = []):
return prompt, True
return prompt, False
if not shared.opts.wildcards_enabled:
recursion += 1
if not shared.opts.wildcards_enabled or recursion >= 10:
return prompt, replaced, not_found
matches = re.findall(r'__(.*?)__', prompt, re.DOTALL)
matches = [m for m in matches if m not in not_found]
@@ -72,7 +73,7 @@ def apply_file_wildcards(prompt, replaced = [], not_found = []):
not_found.remove(m)
elif not found and m not in not_found:
not_found.append(m)
prompt, replaced, not_found = apply_file_wildcards(prompt, replaced, not_found) # recursive until we get early return
prompt, replaced, not_found = apply_file_wildcards(prompt, replaced, not_found, recursion) # recursive until we get early return
return prompt, replaced, not_found