-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsafe code To safe code #1
Comments
Currently I don't have any plans on doing this. |
I see your point, but it still needs to be worked on a bit. |
Do you have a specific example of such an error? The only ones I've encountered so far (and they would fit your description of not being catchable) are access violations (which is just another name for segmentation fault) and these can not be catched as they indicate a corrupted stack. There where some (officially unrecommended) options to enable exception handling for them, but they are no longer available in modern .net. All cases of these need to be fixed and can't be handled by application itself. If the error also occurs in the example application of stable-diffusion.cpp (like it's the case with unsupported chars in the prompt) it needs to be fixed there (nothing I can do), if not it might be a marshalling mistake and would require some steps to reproduce the error. |
Well, for example if the negative prompt is null it chashes after giving this: Also, there's a known bug in stablediffusion.cpp wich makes image generation fail when width/height is too high, when using cuda or rocm (see leejet/stable-diffusion.cpp#156) I guess it can also happen when the user hasn't enough vram |
I tested both of them (null negative prompt and high image size). What I can do ofc is to validate as much input as possible beforehand. Passing null as the negative prompt should already prompt a warning as it's defined as a non-nullable type, but I'll make sure it's not possible. |
I'm one of the individuals directly involved in the development of sd.cpp, and I recognize that the project has many limitations and numerous cases mishandled. With time and more assistance from the community, we could surely achieve something more stable. Currently, the main barrier is the lack of documentation and the code's structure (almost unreadable code) we currently have. We're exploring better ways to refactor the code for improved readability and to enhance aspects like memory management, as many parts still assume fixed buffer sizes, leading to unexpected behaviors at times. Some resolutions might cause issues across different models since kernels behave differently and may not account for cases with large tensors (especially in the hip backend of ggml, which hasn't been extensively tested), leading to illegal memory accesses. |
There are some unsafe code, would you like to change it to safe code only?
The text was updated successfully, but these errors were encountered: