-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat(p2p): Federation and AI swarms #2723
Conversation
a2df4ad
to
9704512
Compare
✅ Deploy Preview for localai ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
8599e8e
to
f04c4da
Compare
core/p2p/p2p_disabled.go
Outdated
@@ -19,3 +19,11 @@ func LLamaCPPRPCServerDiscoverer(ctx context.Context, token string) error { | |||
func BindLLamaCPPWorker(ctx context.Context, host, port, token string) error { | |||
return fmt.Errorf("not implemented") | |||
} | |||
|
|||
func GetAvailableNodes() []NodeData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mudler if you have a sec, do you mind explaining why p2p_disabled.go
is... useful? Mostly for my own understanding here - I'd have either just checked if p2p was enabled when GetAvailableNodes
was called, or if performance was to be optimized, dump both versions in the same file and select the mock vs the full impl based on that setting. I'm probably missing something interesting here 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's actually because it is behind the GO_TAGS
user flag. If GO_TAGS
contains p2p then the p2p.go
file is built, otherwise the other one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for pointing out this is a compile time option vs a config setting
3af5fe7
to
c61ccbe
Compare
|
||
func copyStream(closer chan struct{}, dst io.Writer, src io.Reader) { | ||
defer func() { closer <- struct{}{} }() // connection is closed, send signal to stop proxy | ||
io.Copy(dst, src) |
Check warning
Code scanning / gosec
Errors unhandled. Warning
<-closer | ||
|
||
tunnelConn.Close() | ||
conn.Close() |
Check warning
Code scanning / gosec
Errors unhandled. Warning
go copyStream(closer, conn, tunnelConn) | ||
<-closer | ||
|
||
tunnelConn.Close() |
Check warning
Code scanning / gosec
Errors unhandled. Warning
ok I pushed a bit more =) this is actually adding LocalAI federation too. Let me wrap this up and update the description. UI is kinda messy at the moment, needs improvement:
|
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
How does it work ?
Start LocalAI with
--p2p
, and for sharing an instance with federation, start with--federated
. A token have to be configured for workers and node joining a network (with theTOKEN
environment variable).At first start, if a token isn't supplied it is generated automatically, and can be used when navigating over the Swarm dashboard page.
Video 1 Federation
https://youtu.be/pH8Bv__9cnA
Video 1 Llama.cpp workers:
https://youtu.be/ePH8PGqMSpo
Additional notes
This is a WIP branch, my goal here is to have a very minimal dashboard + general enhancements direction is:
This is a continuation of #2343
Also adds a fix for #2733