Error Running

#4
by LiveRock - opened

python3 ./run_rknn-lcm.py -i ./model -o ./images --num-inference-steps 4 -s 512x512 --prompt "Majestic mountain landscape with snow-capped peaks, autumn foliage in vibrant reds and oranges, a turquoise river winding through a valley, crisp and serene atmosphere, ultra-realistic style."
I:main:Setting random seed to 93
user_specified_scheduler LCMScheduler {
"_class_name": "LCMScheduler",
"_diffusers_version": "0.35.2",
"beta_end": 0.012,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"clip_sample": false,
"clip_sample_range": 1.0,
"dynamic_thresholding_ratio": 0.995,
"num_train_timesteps": 1000,
"original_inference_steps": 50,
"prediction_type": "epsilon",
"rescale_betas_zero_snr": false,
"sample_max_value": 1.0,
"set_alpha_to_one": true,
"steps_offset": 1,
"thresholding": false,
"timestep_scaling": 10.0,
"timestep_spacing": "leading",
"trained_betas": null
}

I:main:Loading ./model/text_encoder
/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py:41: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
W rknn-toolkit-lite2 version: 2.3.2
I RKNN: [17:10:50.260] RKNN Runtime Information, librknnrt version: 2.3.2 (429f97ae6b@2025-04-09T09:09:27)
I RKNN: [17:10:50.260] RKNN Driver Information, version: 0.9.7
E RKNN: [17:10:50.260] parseRKNN: invalid RKNN_MAGIC!
E RKNN: [17:10:50.260] parseRKNN from buffer: Invalid RKNN format!
E RKNN: [17:10:50.260] rknn_init, load model failed!
E Catch exception when init runtime!
E Traceback (most recent call last):
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py", line 157, in init_runtime
self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)
File "rknnlite/api/rknn_runtime.py", line 921, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph
Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID

I:main:Done. Took 0.1 seconds.
I:main:Loading ./model/unet
W rknn-toolkit-lite2 version: 2.3.2
I RKNN: [17:10:50.311] RKNN Runtime Information, librknnrt version: 2.3.2 (429f97ae6b@2025-04-09T09:09:27)
I RKNN: [17:10:50.311] RKNN Driver Information, version: 0.9.7
E RKNN: [17:10:50.311] parseRKNN: invalid RKNN_MAGIC!
E RKNN: [17:10:50.311] parseRKNN from buffer: Invalid RKNN format!
E RKNN: [17:10:50.311] rknn_init, load model failed!
E Catch exception when init runtime!
E Traceback (most recent call last):
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py", line 157, in init_runtime
self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)
File "rknnlite/api/rknn_runtime.py", line 921, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph
Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID

I:main:Done. Took 0.1 seconds.
I:main:Loading ./model/vae_decoder
W rknn-toolkit-lite2 version: 2.3.2
I RKNN: [17:10:50.365] RKNN Runtime Information, librknnrt version: 2.3.2 (429f97ae6b@2025-04-09T09:09:27)
I RKNN: [17:10:50.365] RKNN Driver Information, version: 0.9.7
E RKNN: [17:10:50.365] parseRKNN: invalid RKNN_MAGIC!
E RKNN: [17:10:50.365] parseRKNN from buffer: Invalid RKNN format!
E RKNN: [17:10:50.365] rknn_init, load model failed!
E Catch exception when init runtime!
E Traceback (most recent call last):
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py", line 157, in init_runtime
self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)
File "rknnlite/api/rknn_runtime.py", line 921, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph
Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID

I:main:Done. Took 0.1 seconds.
I:main:Beginning image generation.
input 0 shape: (1, 77)
E Catch exception when setting inputs.
E Traceback (most recent call last):
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py", line 209, in inference
self.rknn_runtime.set_inputs(inputs, data_type, data_format, inputs_pass_through=inputs_pass_through)
File "rknnlite/api/rknn_runtime.py", line 998, in rknnlite.api.rknn_runtime.RKNNRuntime.set_inputs
File "rknnlite/api/rknn_runtime.py", line 1222, in rknnlite.api.rknn_runtime.RKNNRuntime.get_in_out_num
ctypes.ArgumentError: argument 1: TypeError: 'NoneType' object cannot be interpreted as an integer

Traceback (most recent call last):
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/./run_rknn-lcm.py", line 632, in
main(args)
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/./run_rknn-lcm.py", line 584, in main
image = pipe(
^^^^^
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/./run_rknn-lcm.py", line 424, in call
prompt_embeds = self._encode_prompt(
^^^^^^^^^^^^^^^^^^^^
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/./run_rknn-lcm.py", line 206, in _encode_prompt
prompt_embeds = self.text_encoder(input_ids=text_input_ids.astype(np.int32))[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/./run_rknn-lcm.py", line 56, in call
for res in results:
TypeError: 'NoneType' object is not iterable

Please help me as I am lost on what to do next. Thank you

I changed to version 2.3.0 like :python3 ./run_rknn-lcm.py -i ./model -o ./images --num-inference-steps 4 -s 512x512 --prompt "Majestic mountain landscape with snow-capped peaks, autumn foliage in vibrant reds and oranges, a turquoise river winding through a valley, crisp and serene atmosphere, ultra-realistic style."
2025-10-23 18:59:34.639580074 [W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: "/sys/class/drm/card1/device/vendor"
I:main:Setting random seed to 93
user_specified_scheduler LCMScheduler {
"_class_name": "LCMScheduler",
"_diffusers_version": "0.35.2",
"beta_end": 0.012,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"clip_sample": false,
"clip_sample_range": 1.0,
"dynamic_thresholding_ratio": 0.995,
"num_train_timesteps": 1000,
"original_inference_steps": 50,
"prediction_type": "epsilon",
"rescale_betas_zero_snr": false,
"sample_max_value": 1.0,
"set_alpha_to_one": true,
"steps_offset": 1,
"thresholding": false,
"timestep_scaling": 10.0,
"timestep_spacing": "leading",
"trained_betas": null
}

I:main:Loading ./model/text_encoder
/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py:41: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
W rknn-toolkit-lite2 version: 2.3.0
I RKNN: [18:59:36.853] RKNN Runtime Information, librknnrt version: 2.3.0 (c949ad889d@2024-11-07T11:35:33)
I RKNN: [18:59:36.854] RKNN Driver Information, version: 0.9.7
E RKNN: [18:59:36.854] parseRKNN: invalid RKNN_MAGIC!
E RKNN: [18:59:36.854] parseRKNN from buffer: Invalid RKNN format!
E RKNN: [18:59:36.854] rknn_init, load model failed!
E Catch exception when init runtime!
E Traceback (most recent call last):
File "/home/peterlum/Stable-Diffusion-1.5-LCM-ONNX-RKNN2/sd15/lib/python3.12/site-packages/rknnlite/api/rknn_lite.py", line 157, in init_runtime
self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)
File "rknnlite/api/rknn_runtime.py", line 921, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph
Exception: RKNN init failed. error code: RKNN_ERR_MODEL_INVALID

Still having issues..

The models you downloaded are likely corrupted. You can check the hash to verify if this is this case.

How do I update the RKNN driver to 0.9.8?

How do I update the RKNN driver to 0.9.8?

You don't need to.

Thanks. I redo the whole steps but install with "rknn-toolkit-lite2==2.3.0" and it works!

Thanks!

The RK3588 chip runs Stable Diffusion too slowly. You might consider their competitor, the AX650N. For a 512*512 image, the result can be generated within 5 seconds.
https://huggingface.co/AXERA-TECH/lcm-lora-sdv1-5
@LiveRock

Where to buy this? Any more info?

Where to buy this? Any more info?

https://docs.m5stack.com/en/ai_hardware/LLM-8850_Card

Sign up or log in to comment