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

Add llama.cpp backend #2723

Open
wants to merge 92 commits into
base: main
Choose a base branch
from
Open

Add llama.cpp backend #2723

wants to merge 92 commits into from

Conversation

mfuntowicz
Copy link
Member

@mfuntowicz mfuntowicz commented Nov 4, 2024

This PR is an initial implementation of llama.cpp as potential backend for TGI.

It mostly targets CPU inference in a single/multi stream scheduling fashion, potentially spawning multiple instances of the same model over a non-overlapping subset of the CPU cores.

The current implementation only allows a single request to be running on a working, this constraint will be removed later on.
The current implementation also dupplicate the weights for each worker, this constraint can potentially be removed later on.

# Conflicts:
#	Cargo.lock
@mfuntowicz mfuntowicz marked this pull request as ready for review November 22, 2024 13:47
@mfuntowicz mfuntowicz requested a review from angt November 22, 2024 15:02
Copy link
Member

@Hugoch Hugoch left a comment

Choose a reason for hiding this comment

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

Thanks @mfuntowicz ! I can't get a correct generation using the Docker so I think something is wrong with tokenizer. I'll dig deeper later today!

Dockerfile.llamacpp Outdated Show resolved Hide resolved
backends/llamacpp/src/backend.rs Outdated Show resolved Hide resolved
Dockerfile.llamacpp Outdated Show resolved Hide resolved
Dockerfile.llamacpp Show resolved Hide resolved
backends/llamacpp/src/backend.rs Outdated Show resolved Hide resolved
Copy link

@co42 co42 left a comment

Choose a reason for hiding this comment

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

Nice !

backends/llamacpp/src/main.rs Outdated Show resolved Hide resolved
None => break,
Some((ctx, sender)) => {
if let Err(e) = backlog.send((ctx, sender)).await {
todo!("What do we do")
Copy link

Choose a reason for hiding this comment

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

Looks like it can only happen id the channel is closed (all receivers are drop), so I guess you can break the loop and just return / exit

Co-authored-by: Corentin REGAL <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants