faint-cat-74485
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?faint-cat-74485
03/04/2024, 12:49 PMfaint-cat-74485
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'
damp-lion-88352
03/04/2024, 12:58 PMdamp-lion-88352
03/04/2024, 12:59 PMfaint-cat-74485
03/04/2024, 1:02 PMdamp-lion-88352
03/04/2024, 1:03 PMdamp-lion-88352
03/04/2024, 1:03 PMfaint-cat-74485
03/04/2024, 1:05 PMTypeError: expected str, bytes or os.PathLike object, not _io.BytesIO
damp-lion-88352
03/04/2024, 1:06 PMdamp-lion-88352
03/04/2024, 1:06 PMdamp-lion-88352
03/04/2024, 1:07 PMdamp-lion-88352
03/04/2024, 1:07 PM/tmp
is not writablefaint-cat-74485
03/04/2024, 1:07 PMdamp-lion-88352
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>
damp-lion-88352
03/04/2024, 1:08 PMfaint-cat-74485
03/04/2024, 1:08 PMdamp-lion-88352
03/04/2024, 1:08 PMdamp-lion-88352
03/04/2024, 1:08 PMfaint-cat-74485
03/04/2024, 1:08 PMfaint-cat-74485
03/04/2024, 1:09 PM