Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion openevolve/llm/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async def generate_with_context(
def _sample_model(self) -> LLMInterface:
"""Sample a model from the ensemble based on weights"""
index = self.random_state.choices(range(len(self.models)), weights=self.weights, k=1)[0]
return self.models[index]
sampled_model = self.models[index]
logger.info(f"Sampled model: {vars(sampled_model)['model']}")
return sampled_model

async def generate_multiple(self, prompt: str, n: int, **kwargs) -> List[str]:
"""Generate multiple texts in parallel"""
Expand Down
29 changes: 28 additions & 1 deletion scripts/templates/program_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,36 @@ <h2>Code:</h2>
<pre>{{ program_data.code }}</pre>
<h2>Prompts:</h2>
<ul>
{#-- recursive “display” macro --#}
{% macro display(val) %}
{% if val is mapping %}
<ul>
{% for k, v in val.items() %}
<li>
<strong>{{ k|e }}:</strong>
{{ display(v) }}
</li>
{% endfor %}
</ul>
{% elif val is sequence and not val is string %}
<ul>
{% for item in val %}
<li>{{ display(item) }}</li>
{% endfor %}
</ul>
{% else %}
<pre>{{ val|e }}</pre>
{% endif %}
{% endmacro %}
{#-- loop over every prompts --#}
<div class="prompts">
{% for key, value in program_data.prompts.items() %}
<li><strong>{{ key }}:</strong> <pre style="white-space: pre-wrap; word-break: break-word;">{{ value }}</pre></li>
<section>
<h3>{{ key|title }}</h3>
{{ display(value) }}
</section>
{% endfor %}
</div>
</ul>
{% if artifacts_json %}
<h2>Artifacts:</h2>
Expand Down