Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dilaragokay opened this issue May 23, 2022 · 3 comments
Closed

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

dilaragokay opened this issue May 23, 2022 · 3 comments

Comments

@dilaragokay
Copy link
Contributor

dilaragokay commented May 23, 2022

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
@fehiepsi
Copy link
Member

I guess we can add a note in the docs that it is better to use svg format when render_params=True.

@fritzo
Copy link
Member

fritzo commented May 25, 2022

we could just use a : symbol as in type theory and avoid the ∈ issue

@eb8680
Copy link
Member

eb8680 commented Jun 2, 2022

Should be addressed by #3097

@eb8680 eb8680 closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants