Skip to content

Adding linenoise.cpp to llama-run#11252

Merged
ericcurtin merged 1 commit into
ggml-org:masterfrom
ericcurtin:linenoise.cpp
Jan 18, 2025
Merged

Adding linenoise.cpp to llama-run#11252
ericcurtin merged 1 commit into
ggml-org:masterfrom
ericcurtin:linenoise.cpp

Conversation

@ericcurtin
Copy link
Copy Markdown
Collaborator

This is a fork of linenoise that is C++17 compatible. I intend on adding it to llama-run so we can do things like traverse prompt history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

@ericcurtin
Copy link
Copy Markdown
Collaborator Author

Linked issue:

containers/ramalama#586

@ericcurtin ericcurtin force-pushed the linenoise.cpp branch 8 times, most recently from fdaa9ba to bd3e9ae Compare January 15, 2025 17:23
@ericcurtin ericcurtin force-pushed the linenoise.cpp branch 2 times, most recently from 14dc5f3 to 29d40de Compare January 15, 2025 19:49
@rhatdan
Copy link
Copy Markdown

rhatdan commented Jan 15, 2025

This does not work on Windows? I guess inside of a container it would work.

@ericcurtin
Copy link
Copy Markdown
Collaborator Author

ericcurtin commented Jan 15, 2025

This does not work on Windows? I guess inside of a container it would work.

I couldn't find any library like linenoise that had Windows support. Plenty have macOS/Linux support. But yeah if using a container or WSL2, etc. we'd be fine.

I didn't kill Windows native support here, but you don't get the cool features like being able to cycle through prompt history with up and down arrows.

Comment thread examples/run/linenoise.h Outdated
Comment on lines 22 to 25
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will require adding a notice in the releases.

Copy link
Copy Markdown
Collaborator Author

@ericcurtin ericcurtin Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can I copy that in? I think the license is compatible once we include these copyrights

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this is usually handled, I guess we could add a file with all 3rd party copyright notices and copy it to the release packages.

Copy link
Copy Markdown
Collaborator Author

@ericcurtin ericcurtin Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the same issue with CURL if we start distributing it for Windows FWIW, from curl license: "Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies."

@ggerganov you were speaking about shipping curl on Windows recently.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't know what is the common way to handle this. Probably look for how other projects do it.

Btw, each llama.cpp release already includes a copy of the full source code in this repo so I think all licenses are technically already included in the release packages? Again, we can make this more explicit if necessary - feel free to improve.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with that technique, there's no standard technique. Everybody does it a little different.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a lawyer, but I am not convinced that's enough. We already copy our own LICENSE file to the release packages as llama.cpp.txt, so it shouldn't be a problem to also add the 3rd party licenses there.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slaren can you show me the script where that copy occurs? We can just check in:

https://github.com/ericcurtin/linenoise.cpp/blob/main/LICENSE

and copy that file to linenoise.cpp.txt maybe ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks my searching tool skips hidden directories, sometimes I forget this. I hope it's good now, it should do the copy of the LICENSE now I think.

@ericcurtin ericcurtin force-pushed the linenoise.cpp branch 2 times, most recently from 27812c8 to 6360829 Compare January 15, 2025 20:52
@rhatdan
Copy link
Copy Markdown

rhatdan commented Jan 15, 2025

Most of the time windows will be using a container so this should not be an issue.

@ericcurtin ericcurtin force-pushed the linenoise.cpp branch 3 times, most recently from 4127d6a to 1aa42d3 Compare January 16, 2025 10:38
@ericcurtin
Copy link
Copy Markdown
Collaborator Author

What unblocks this from getting merged @slaren and @ggerganov ?

@github-actions github-actions Bot added the devops improvements to build systems and github actions label Jan 16, 2025
@ericcurtin
Copy link
Copy Markdown
Collaborator Author

Yay green build and licensing file copied @slaren @ggerganov

Comment thread .github/workflows/build.yml Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only affect the Windows releases, but the macOS and linux releases should also be updated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about now?

@ericcurtin
Copy link
Copy Markdown
Collaborator Author

Haven't been able to reproduce the other one.

@ngxson
Copy link
Copy Markdown
Contributor

ngxson commented Jan 17, 2025

The error with model load could be a false positive described in https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow , where one part of the app is built without ASAN enabled (could be gguf.cpp in this case)

@ggerganov Did you try deleting the build folder?

@github-actions github-actions Bot added build Compilation issues ggml changes relating to the ggml tensor library for machine learning labels Jan 17, 2025
@ericcurtin
Copy link
Copy Markdown
Collaborator Author

Nonetheless I pushed the list change 😄

This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
@slaren
Copy link
Copy Markdown
Member

slaren commented Jan 17, 2025

The error with model load could be a false positive described in https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow , where one part of the app is built without ASAN enabled (could be gguf.cpp in this case)

Now that you mention it, the llama.cpp files are built without sanitizer flags. This needs to be fixed as well.

@ericcurtin
Copy link
Copy Markdown
Collaborator Author

The error with model load could be a false positive described in https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow , where one part of the app is built without ASAN enabled (could be gguf.cpp in this case)

@ggerganov Did you try deleting the build folder?

You could be right, things do run fine without asan

@ggerganov
Copy link
Copy Markdown
Member

The error with model load could be a false positive described in Wiki: AddressSanitizerContainerOverflow (google/sanitizers) , where one part of the app is built without ASAN enabled (could be gguf.cpp in this case)

Now that you mention it, the llama.cpp files are built without sanitizer flags. This needs to be fixed as well.

I'll push a fix on master.

@ngxson
Copy link
Copy Markdown
Contributor

ngxson commented Jan 17, 2025

For the msg_strs problem, I would prefer constructing the vector/list inside apply_chat_template because it's more aligned with functional programming approach. common_chat_apply_template does the same thing too (though, it's up to you to decide if you want to use or not)

@ggerganov
Copy link
Copy Markdown
Member

#11279 resolves the sanitizer error on mac.

@JohannesGaessler
Copy link
Copy Markdown
Contributor

Is my understanding correct that the issue with the GGUF code turned out to be a false positive that has now been fixed?

@ericcurtin
Copy link
Copy Markdown
Collaborator Author

Is my understanding correct that the issue with the GGUF code turned out to be a false positive that has now been fixed?

Yes and I think all the issues discussed in this PR are resolved now.

@ericcurtin ericcurtin merged commit a1649cc into ggml-org:master Jan 18, 2025
@ericcurtin ericcurtin deleted the linenoise.cpp branch January 18, 2025 14:42
anagri pushed a commit to BodhiSearch/llama.cpp that referenced this pull request Jan 26, 2025
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Feb 26, 2025
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
phibya pushed a commit to ziee-ai/llama.cpp that referenced this pull request May 29, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
This is a fork of linenoise that is C++17 compatible. I intend on
adding it to llama-run so we can do things like traverse prompt
history via the up and down arrows:

https://github.com/ericcurtin/linenoise.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Compilation issues devops improvements to build systems and github actions examples ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants