andrewm4894
03/04/2024, 12:46 PMwith tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmpfile:
plot_model(model, to_file=tmpfile.name, show_shapes=True, show_layer_names=True)
wandb.log({f"{prefix}Architecture{suffix}": wandb.Image(tmpfile.name)})
os.remove(tmpfile.name)
it works apart from when run by Flyte where i get:
/pillow/pillow/PIL/Image.py", line 3305, in open
raise UnidentifiedImageError(msg)
Message:
cannot identify image file '/opt/spark/work-dir/tmpf5ir4qhc.png'
User error.
Just wondering - Is there anything specific to Flyte around working with temp files?andrewm4894
03/04/2024, 12:49 PMandrewm4894
03/04/2024, 12:53 PMdir='.'
in NamedTemporaryFile()
when i leave it out it tries to use a tmp dir but has same issue:
cannot identify image file '/tmp/tmp5lh79axa.png'
L godlike
03/04/2024, 12:58 PML godlike
03/04/2024, 12:59 PMandrewm4894
03/04/2024, 1:02 PML godlike
03/04/2024, 1:03 PML godlike
03/04/2024, 1:03 PMandrewm4894
03/04/2024, 1:05 PMTypeError: expected str, bytes or os.PathLike object, not _io.BytesIO
L godlike
03/04/2024, 1:06 PML godlike
03/04/2024, 1:06 PML godlike
03/04/2024, 1:07 PML godlike
03/04/2024, 1:07 PM/tmp
is not writableandrewm4894
03/04/2024, 1:07 PML godlike
03/04/2024, 1:08 PMFROM python:3.9-slim-buster
USER root
WORKDIR /root
ENV PYTHONPATH /root
RUN apt-get update && apt-get install build-essential -y
RUN apt-get install git -y
RUN pip install -U git+<https://github.com/flyteorg/flytekit.git@c9972bf023d10bef3aefa9fa6763c6b35aec5693>
L godlike
03/04/2024, 1:08 PMandrewm4894
03/04/2024, 1:08 PML godlike
03/04/2024, 1:08 PML godlike
03/04/2024, 1:08 PMandrewm4894
03/04/2024, 1:08 PMandrewm4894
03/04/2024, 1:09 PM