Skip to content

Instantly share code, notes, and snippets.

@MarcScott
Last active July 3, 2024 10:26
Show Gist options
  • Save MarcScott/4023f4486fb402c2201bffc19df9ceba to your computer and use it in GitHub Desktop.
Save MarcScott/4023f4486fb402c2201bffc19df9ceba to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo apt install cmake git-lfs -y
cd /home/$USER
git clone https://github.com/google/XNNPACK.git
cd XNNPACK
git checkout 579de32260742a24166ecd13213d2e60af862675
mkdir build
cd build
cmake -DXNNPACK_BUILD_TESTS=OFF -DXNNPACK_BUILD_BENCHMARKS=OFF ..
cmake --build . --config Release
cd /home/$USER
git clone https://github.com/vitoplantamura/OnnxStream.git
cd OnnxStream
cd src
mkdir build
cd build
cmake -DMAX_SPEED=ON -DXNNPACK_DIR=/home/$USER/XNNPACK ..
cmake --build . --config Release
cd /home/$USER
git lfs install
git clone --depth=1 https://huggingface.co/AeroX2/stable-diffusion-xl-turbo-1.0-onnxstream
# Define the content of the first script
script_content='#!/bin/bash
# Ask the user for the prompt
read -p "Enter the prompt: " user_prompt
# Ask the user for the number of steps
read -p "Enter the number of steps: " steps
# Ask the user for the output image file name
read -p "Enter the output image file name: " output_image
# Run the command with the user inputs
./OnnxStream/src/build/sd --turbo --models-path /home/$USER/stable-diffusion-xl-turbo-1.0-onnxstream --prompt "$user_prompt" --steps "$steps" --output "$output_image"
'
# Write the content to the first script
echo "$script_content" > run_sd.sh
# Make the first script executable
chmod +x run_sd.sh
# Notify the user
echo "The script run_sd.sh has been created and is executable."
echo "You can run Stable Diffusion by typing ./run_sd.sh from your home directory"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment