WasmEdge / wasmedge-stable-diffusion

A Rust library for using stable diffusion functions when the Wasi is being executed on WasmEdge.
6 stars 2 forks source link

Unable to run the examples #14

Open primeagen-rustaceans opened 1 month ago

primeagen-rustaceans commented 1 month ago

I am getting the following error.

[2024-10-01 22:34:25.586] [error] WasmEdge-Stable-Diffusion plugin not installed. Please install the plugin and restart WasmEdge.
thread 'main' panicked at src/main.rs:10:79:
called `Result::unwrap()` on an `Err` value: WasmedgeSdErrno { code: 1, name: "INVALID_ARGUMENT", message: "" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2024-10-01 22:34:25.588] [error] execution failed: unreachable, Code: 0x40a
[2024-10-01 22:34:25.588] [error]     In instruction: unreachable (0x00) , Bytecode offset: 0x00004967
[2024-10-01 22:34:25.588] [error]     When executing function name: "_start"

Steps followed are mentioned below.

  1. Cloned the repository.
  2. Downloaded both the model and checkpoint files.
    curl -L -O https://huggingface.co/second-state/stable-diffusion-v-1-4-GGUF/resolve/main/sd-v1-4.ckpt
    curl -L -O https://huggingface.co/second-state/stable-diffusion-v-1-4-GGUF/resolve/main/stable-diffusion-v1-4-Q8_0.gguf
  3. Installed wasmEdge as mentioned in official site.
    curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
  4. Running
    // from inside rust folder
    cargo build --release
    // from inside examples folder 
    cargo build --target wasm32-wasi --release

Please let me know what am I missing. System Info :

uname -a
Linux ad 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
hydai commented 1 month ago

Hi @primeagen-rustaceans

If you don't want to build the plugin from source like our README said: https://github.com/WasmEdge/wasmedge-stable-diffusion?tab=readme-ov-file#set-up-wasmedge

You have to download the plugin manually from the release page: https://github.com/WasmEdge/WasmEdge/releases/tag/0.14.1

And put it into the wasmedge installation folder such as ~/.wasmedge/plugin

FYI: https://github.com/LlamaEdge/sd-api-server?tab=readme-ov-file#setup

primeagen-rustaceans commented 1 month ago

Originally I wanted to build the plugin but I am stuck there as well. Followed the below steps.

  1. Cloned the repo and made WasmEdge as working directory as mentioned in below lines.
    git clone https://github.com/WasmEdge/WasmEdge.git
    cd WasmEdge
  2. cmake build command returning errors.

    
    fatal: No names found, cannot describe anything.
    -- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
    -- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 
    -- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
    -- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 
    CMake Error at lib/llvm/CMakeLists.txt:11 (find_package):
    Could not find a package configuration file provided by "LLD" with any of
    the following names:
    
    LLDConfig.cmake
    lld-config.cmake
    
    Add the installation prefix of "LLD" to CMAKE_PREFIX_PATH or set "LLD_DIR"
    to a directory containing one of the above files.  If "LLD" provides a
    separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!

Note : I had previously ran the below commands to install cmake, ninja and llvm. I guess llvm installation has not happened correctly. 

sudo apt install cmake sudo apt install ninja-build sudo apt-get install libllvm-18-ocaml-dev libllvm18 llvm-18 llvm-18-dev llvm-18-doc llvm-18-examples llvm-18-runtime

hydai commented 1 month ago

You also need liblld-18-dev and curl.