Skip to content

[Bug]: artifacts displaying on Generation Strategy Graph of compute_analyses #5198

Open

Description

@jessica-moylan

What happened?

There seems to be artifacts displayed on the Generation Strategy Graph when running compute_analyses. No other graphs appear to have this problem

Image

Please provide a minimal, reproducible example of the unexpected behavior.

This is pulled from the getting started code

from ax.api.client import Client
from ax.api.configs import RangeParameterConfig

client = Client()

client.configure_experiment(
    name="booth_function",
    parameters=[
        RangeParameterConfig(
            name="x1",
            bounds=(-10.0, 10.0),
            parameter_type="float",
        ),
        RangeParameterConfig(
            name="x2",
            bounds=(-10.0, 10.0),
            parameter_type="float",
        ),
    ],
)

client.configure_optimization(objective="-1 * booth")

for _ in range(20):
    for trial_index, parameters in client.get_next_trials(max_trials=1).items():
        client.complete_trial(
            trial_index=trial_index,
            raw_data={
                "booth": (parameters["x1"] + 2 * parameters["x2"] - 7) ** 2
                + (2 * parameters["x1"] + parameters["x2"] - 5) ** 2
            },
        )

client.compute_analyses()

Please paste any relevant traceback/logs produced by the example provided.

Ax Version

1.2.4

Python Version

3.13.13

Operating System

Linux

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

None

Code of Conduct

  • I agree to follow Ax's Code of Conduct

Activity

  1. prabhaks commented on Jul 2, 2026

    @prabhaks

    Hi! I can take a stab at this.

    Hypothesis / proposed fix: the “Generation Strategy Graph” card is rendered via Graphviz → SVG, and GraphvizAnalysisCard._body_html() appears to embed the raw result of Source.pipe(format="svg"). In some environments pipe() returns bytes, so the notebook ends up rendering b'...svg...' (and/or other garbled output) as “artifacts”.

    Proposed change: decode the SVG bytes before embedding in HTML, e.g. svg = svg.decode("utf-8", errors="replace") when isinstance(svg, (bytes, bytearray)).

    Test plan: add a small unit test that either (a) mocks pipe() to return bytes and asserts the HTML does not contain "b'", or (b) generates a tiny Digraph and asserts the output HTML contains "<svg" and no "b'".

    If that sounds right, I’ll open a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions