Skip to content
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

Fix trying to strip newline from empty prompt and cfg prompt file content #3534

Merged

Conversation

KerfuffleV2
Copy link
Collaborator

If the prompt or CFG negative prompt file options are set to an empty file, attempting to strip a newline currently causes a memory error. This small fix just makes sure the files aren't empty. I found this out the fun way (don't ask why I set -f /dev/null).

Also, GCC's address sanitizer is pretty handy. Maybe there should be a LLAMA_ADDRESS_SANITIZER option that just adds -fsanitize=address -g to the CFLAGS and CXXFLAGS. I believe this will work with Clang also. It even seems to work when compiling with optimizations turned on and is way faster than Valgrind.

@KerfuffleV2 KerfuffleV2 added the bug Something isn't working label Oct 7, 2023
@cebtenzzre
Copy link
Collaborator

Maybe there should be a LLAMA_ADDRESS_SANITIZER option that just adds -fsanitize=address -g to the CFLAGS and CXXFLAGS.

The cmake build script has LLAMA_SANITIZE_ADDRESS.

@KerfuffleV2
Copy link
Collaborator Author

The cmake build script has LLAMA_SANITIZE_ADDRESS.

Ahh, I'm not a fan of cmake. Maybe I'll see about making the normal Makefile support it as well. Thanks for the information.

@KerfuffleV2 KerfuffleV2 merged commit a16e89c into ggerganov:master Oct 7, 2023
@KerfuffleV2 KerfuffleV2 deleted the fix-empty-prompt-strip-nl branch November 17, 2023 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants