Skip to content

[bug] render_model cannot show ∈ symbol in the saved file #3092

@dilaragokay

Description

@dilaragokay

Issue Description

I created a simple model and rendered it the following way in Colab.

import pyro
import torch
from pyro.distributions import constraints, Uniform, LogNormal

def model(data):
    low = torch.tensor(0.)
    high = torch.tensor(5.)
    z = pyro.sample("difficulty", Uniform(low, high))

    sigma_grades = pyro.param("sigma_grades", torch.tensor(10.), constraint = constraints.positive)
    with pyro.plate("data", data.size(0)):
        pyro.sample("grades", LogNormal(90 - 10 * z, sigma_grades), obs = data)

data = torch.rand(70) * 100

pyro.render_model(model, model_args=(data,), filename='my_render.png',render_distributions=True, render_params=True)

I see in the notebook that the file is rendered the following way
Screenshot 2022-05-23 at 12 16 25

The above image is from a screenshot. When I download my_render.png and open the file, I see that the ∈ symbol is not shown correctly.
my_render

Edit 1: I have just tried with a few more file extensions. Saving as an SVG works perfectly. Saving as a PDF does not work either.
Edit 2: This might be a GraphViz issue actually: https://stackoverflow.com/questions/55456467/how-to-include-element-symbol-in-graphviz

Environment

I am running this experiment on Colab. I installed Pyro in the first cell with !pip3 install pyro-ppl.

  • Python version: 3.7.13
  • PyTorch version: 1.11.0+cu113
  • Pyro version: 1.8.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions