vitoplantamura / OnnxStream

Lightweight inference library for ONNX files, written in C++. It can run Stable Diffusion XL 1.0 on a RPI Zero 2 (or in 298MB of RAM) but also Mistral 7B on desktops and servers. ARM, x86, WASM, RISC-V supported. Accelerated by XNNPACK.
https://yolo.vitoplantamura.com/
Other
1.86k stars 84 forks source link

Warning token: "X" was ignored. What does it mean? #81

Closed WildEgor closed 3 months ago

WildEgor commented 3 months ago

Call generate.sh like:

./generate.sh -s 3 -p "MYSUPERPROMPT"

generate.sh

#!/bin/bash

START_TIMESTAMP=$(date "+%s")

RESULT_DIR="/app/out"
NEG="ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face, blurry, draft, grainy"
STEPS=5
PROMPT=""
MODELS=/app/weights

while [ $# -gt 0 ]; do
  case "$1" in
    -s)
      STEPS=$2
      shift 2
      ;;
    -p)
      PROMPT=$2
      shift 2
      ;;
    -mp)
      MODELS=$2
      shift 2
      ;;
    *)
      echo "Unknown option: $1"
      exit 1
      ;;
  esac
done

RPI=""
if [ "$(uname -m)" = "armv7l" ]; then
    RPI="--rpi-lowmem"
fi

if [ "$(uname -m)" = "aarch64" ]; then
    RPI="--rpi"
fi

/app/OnnxStream/src/build/sd --turbo --models-path $MODELS --steps $STEPS $RPI --neg-prompt "$NEG" --prompt "$PROMPT" --output "${RESULT_DIR}/result.png"

END_TIMESTAMP=$(date "+%s")

echo "${START_TIMESTAMP} ${END_TIMESTAMP}"

Logs

----------------[start]------------------
builder-1  | positive_prompt: MYSUPERPROMPT
builder-1  | SDXL turbo doesn't support negative_prompts                                                                                                                                                               
builder-1  | output_png_path: /app/out/result.png                                                                                                                                                                      
builder-1  | steps: 5                                                                                                                                                                                                  
builder-1  | seed: 329728
builder-1  | ----------------[prompt]------------------                                                                                                                                                                
builder-1  | Token: "M"                                                                                                                                                                                                
builder-1  | Warning token: "M" was ignored
... here rest of warnings ...                                                                                                                                                                     
builder-1  | ----------------[diffusion]---------------                                                                                                                                                                
builder-1  | step:0             32329ms
builder-1  | step:1             16512ms
builder-1  | step:2             16134ms
builder-1  | step:3             17584ms
builder-1  | step:4             18284ms
builder-1  | ----------------[decode]------------------
builder-1  | ----------------[close]-------------------                                                                                                                                                                
builder-1  | 1722144066 1722144210

And I get the wrong result.

vitoplantamura commented 3 months ago

hi,

this is really strange: I tried with the last commit of the project and specifying your prompt (MYSUPERPROMPT) and it works correctly.

Could you check that the two files vocab.txt and merges.txt are not corrupt?

Could you also try running the application directly, without using the shell script?

Thanks, Vito

WildEgor commented 3 months ago

Hi, @vitoplantamura!

Both files (vocab.txt and merges.txt) can be opened correctly, but even when using a direct call (sd) get same result with warnings.

See how I build and run it using Docker: https://gist.github.com/WildEgor/6895dd10fe5e65c866d1a846d7f5a729

WildEgor commented 3 months ago

I found that if I use the weights inside the container (instead of just mounting the volume with the weights), everything works well. So, I guess the problem lies in my docker-compose configuration.