Open znwang25 opened 1 month ago
Nice catch. I think we can use the original filename via the argument filename
and get suffix with Path(filename).suffix. Do you want to submit the fix?
I think this will get it fixed.
if filename is not None:
filename = Path(filename)
graph.render(
filename.with_suffix(''), view=False, cleanup=True, format=filename.suffix[1:]
) # remove leading period from suffix
Is it necessary to remove suffix in the filename?
Without removing it, filename=“Example.png” will generate “Example.png.png”. I did not do enough tests, but removing the suffix works for my use cases.
On Mon, Jul 8, 2024 at 1:28 PM Du Phan @.***> wrote:
Is it necessary to remove suffix in the filename?
— Reply to this email directly, view it on GitHub https://github.com/pyro-ppl/numpyro/issues/1831#issuecomment-2215219098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYUSMIBRT4UMDYUIE4HIKLZLLY75AVCNFSM6AAAAABKRN767SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJVGIYTSMBZHA . You are receiving this because you authored the thread.Message ID: @.***>
Thanks! Sorry for the slow response. Do you want to submit the fix?
When calling
numpyro.render_model(model, filename=my_path)
I was expecting the generated file to be saved inmy_path
. But it does not.Reading the source code, it seems that it deliberately use
filename.stem
instead of user provided file path. Is this the intended behavior? Unable to save the file to the path user requested make the filename option useless.