Comments (3)
seems complex but it's fine if it works. thank you!
from sd-dynamic-prompts.
You can currently do this inline with jinja2 templates (just be sure to check the enable Jinja2 templates checkbox)
If you want blue 30% of the time, red 60% of the time (0.9 - 0.3), and yellow 10% of the time (1 - 0.9)
e.g.
{% with r = random() %}
{% for val, weight in [('blue', 0.3), ('red', 0.9), ('yellow', 1)] %}
{% if r < weight %}
{% prompt %}{{ r }} I love {{ val }} roses{% endprompt %}
{% endif %}
{% endfor %}
{% endwith %}
or
{% set ns = namespace(r=random(), chosen=false, total=0) %}
{% for val, weight in [('blue', 0.3), ('red', 0.6), ('yellow', 0.1)] %}
{% set ns.total = ns.total + weight %}
{% if ns.r < ns.total and ns.chosen==false %}
{% prompt %}I love {{ val }} roses{% endprompt %}
{% set ns.chosen = 1 %}
{% endif %}
{% endfor %}
Not sure if it makes sense to do it inside of wildcard files
from sd-dynamic-prompts.
Does the above suggestion work for you? I know it's more complicated than the basic syntax, but it seems that the use case is quite niche so probably not worth adding more complexity to the regular syntax
from sd-dynamic-prompts.
Related Issues (20)
- A1111 1.8 : Error Expected end of text, found '_' (at char 11), (line:1, col:12) HOT 1
- Wildcard Manager (auto)search takes ages for short search terms with large amount of wildcards HOT 2
- The double wildcard doesn't seem to be recognized.
- "TypeError: BFloat16 is not supported on MPS" HOT 2
- Weighting problem
- It's can't work. HOT 1
- Colab issue tooks 9 minutes to complete HOT 6
- Dynamic Installation Error - Version: 0.29.0 --- Requires: 0.30.4 HOT 3
- [Feature Request] Dynamic Resolutions HOT 4
- the Transformers transitive dependency takes a lot of time to complete HOT 1
- Parse exception when using % HOT 2
- Are complex prompts borken? HOT 3
- not working with a1111 dev branch HOT 1
- Cannot See what prompts actually used in ComfyUI image HOT 1
- not working with a1111 1.9-rc dev bruch HOT 5
- Completely fails when any part of wildcard has "__" HOT 1
- Wildcards being treated as combination
- [Request] Make PromptWriter add Template data as a newline HOT 1
- Conflict with embedding-merge after 1567e787 HOT 1
- Dynamic Prompt tab is not appearing, ERROR HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sd-dynamic-prompts.