Skip to content

generate_picture and output_path error FileNotFound #22

@Presjar

Description

@Presjar

Hello!

I have been following along the bouncing ball of getting PaperPiAI setup on a RPI 2W with the latest Raspbian OS 64bit (Trixie Lite).

It runs python 3.13.5

When running the generation venv/bin/python src/generate_picture.py --width=480 --height=800 --prompt=space /home/rpi/PaperPiAI/genImages
the output eventually results in the below. This folder exists and I can cd to it via the full path shown in the output. I also get the same error when trying to use output directory as /tmp and also when provided no prompt.


Creating image with prompt 'space'
Using seed 2196
Saving to /home/rpi/PaperPiAI/genImages/space_seed_2196_steps_5.png
Running command:
OnnxStream/src/build/sd --xl --turbo --models-path models/stable-diffusion-xl-turbo  -1.0-anyshape-onnxstream --rpi-lowmem --prompt space --seed 2196 --output /home/rpi/PaperPiAI/genImages/space_seed_2196_steps_5.png --steps 5 --res 480x800
----------------[start]-------------------
positive_prompt: space
SDXL turbo doesn't support negative_prompts
output_path: /home/rpi/PaperPiAI/genImages/space_seed_2196_steps_5.png
steps: 5
seed: 2196
using FP32 arithmetic (FP16 not detected)
----------------[prompt]------------------
Token: "space</w>"
----------------[diffusion]---------------
step:0          840688ms
Command executed successfully.
Traceback (most recent call last):
  File "/home/rpi/PaperPiAI/src/generate_picture.py", line 63, in <module>
    shutil.copyfile(fullpath, shared_fullpath)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/shutil.py", line 260, in copyfile
    with open(src, 'rb') as fsrc:
         ~~~~^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/rpi/PaperPiAI/genImages/space_seed_2196_steps_5.png'

As the original install method used in your setup script for install of XNNPACK and OnnxStream results in compilation errors due to issues on the XNNPACK side of things, vitoplantamura/OnnxStream provided a fix to build XNNPACK and then ONNXStream in one go. https://github.com/vitoplantamura/OnnxStream/issues/133#issuecomment-3716914971 which I now have setup. This involved updating GCC and G++ to v15.

Do you have any ideas on this? Thanks :)

This is the install script I completed in parts

#!/bin/bash

INSTALL_DIR="$PWD"
echo Installing to "$INSTALL_DIR"

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install tmux vim
sudo apt-get -y install cmake
sudo apt-get -y install python3-dev python3-venv python3-pip
sudo apt-get -y install imagemagick
sudo apt-get -y install git git-lfs
sudo apt-get -y install libopencv-dev  python3-opencv

cd "$INSTALL_DIR"
python3 -m venv venv
. venv/bin/activate

python -m pip install opencv_contrib_python
python -m pip install inky[rpi]==1.5.0
python -m pip install pillow

# Following updated instructions taken directly from [OnnxStream repo](https://github.com/vitoplantamura/OnnxStream).

git clone https://github.com/vitoplantamura/OnnxStream.git
cd OnnxStream/src
mkdir build
cd build
cmake ..
cmake --build . --config Release

cd "$INSTALL_DIR"
mkdir models
cd models
git clone --depth=1 https://huggingface.co/vitoplantamura/stable-diffusion-xl-turbo-1.0-anyshape-onnxstream

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions