Open cngmid opened 1 year ago
I was able to reproduce it. It turns out Linux libertine
and some other fonts are not available in Windows (as you said) but available in Linux.
Until I can find an similar font for windows and put it into the codebase, you try to change it manually right after the creation of graph object as a temporary solution. In your case this would be,
import torch
device = "cpu"
from torchview import draw_graph;
model = torch.nn.Linear(in_features=1, out_features=1, device=device)
model_graph = draw_graph(model, input_size=(32, 1), device=device)
model_graph.visual_graph.node_attr["fontname"] = "Helvetica"
If you have a font suggestion that resembles Linux libertine visually and available in windows, I would appreciate it.
model_graph.visual_graph.node_attr["fontname"] = "Helvetica"
Thanks!! This works. Helvetica looks good. According to wikipedia Linux libertine is an "interpretation" of the Time New Roman font. So it might be a good idea to use "Times-Roman", which works well on my machine too.
Now that you mention times new roman, I recall that I wanted Linux libertine because its purpose was to provide open source alternative . I think Times Roman would be OK.
Just a piece of advice: Linux libertine is indeed a part of Open Fonts Project, which means that you can distribute it freely. You can include the font into your package distribution, and refer to it locally as a usual resource.
I have installed torchview on Windows using
conda install
. When diaplying a simple graph, I'm getting the following warning: (process:20416): Pango-WARNING **: 09:23:59.938: couldn't load font "Linux libertine Not-Rotated 10", falling back to "Sans Not-Rotated 10", expect ugly output. The graph is displayed correctly after the warning. Is there a way to configure the module to avoid this?Steps to reproduce the behavior:
conda install torchview
. Version installed:torchview-0.2.6
.torch.nn.Linear(in_features=1, out_features=1, device=device)
.from torchview import draw_graph; model_graph = draw_graph(model, input_size=(32, 1), device='cuda')
.model_graph.visual_graph
.