fastsdcpu Version
v1.0.0 beta 281
Bug Description
When the environment variable GGUF_THREADS is set, the application crashes during GGUF model initialization. This is due to a type mismatch where the environment variable is passed as a string to the new_sd_ctx function in the C++ backend, which expects an integer.
Suggested Fix
Explicitly cast the environment variable to an integer in src/constants.py:
Current code (src/constants.py):
GGUF_THREADS = environ.get("GGUF_THREADS", cpus)
Suggested Fix:
GGUF_THREADS = int(environ.get("GGUF_THREADS", cpus))
Steps to Reproduce
- Export the environment variable: export GGUF_THREADS=4 (or any value).
- Run fastsdcpu.
- Attempt to generate an image using a GGUF model (e.g., Flux).
- See ctypes.ArgumentError: argument 14: TypeError: wrong type.
Expected Behavior
Expected the program to use the variable and execute.
Logs / Error Output
File "/src/backend/gguf/gguf_diffusion.py", line 146, in __init__
self.sd_ctx = self.libsdcpp.new_sd_ctx(
^^^^^^^^^^^^^^^^^^^^^^^^^
ctypes.ArgumentError: argument 14: TypeError: wrong type
Operating System
Linux
Hardware / CPU
No response
Checklist
fastsdcpu Version
v1.0.0 beta 281
Bug Description
When the environment variable GGUF_THREADS is set, the application crashes during GGUF model initialization. This is due to a type mismatch where the environment variable is passed as a string to the new_sd_ctx function in the C++ backend, which expects an integer.
Suggested Fix
Explicitly cast the environment variable to an integer in src/constants.py:
Current code (src/constants.py):
GGUF_THREADS = environ.get("GGUF_THREADS", cpus)
Suggested Fix:
GGUF_THREADS = int(environ.get("GGUF_THREADS", cpus))
Steps to Reproduce
Expected Behavior
Expected the program to use the variable and execute.
Logs / Error Output
Operating System
Linux
Hardware / CPU
No response
Checklist