@@ -158,13 +158,13 @@ func installCuda(c *config.Config, s llb.State, merge llb.State) (llb.State, llb
158
158
}
159
159
160
160
func installExllama (c * config.Config , s llb.State , merge llb.State ) llb.State {
161
- backend := "exllama"
161
+ backend := utils . BackendExllama
162
162
exllamaRepo := "https://github.com/turboderp/exllama"
163
163
exllamaTag := "master"
164
164
for b := range c .Backends {
165
165
if c .Backends [b ] == utils .BackendExllamaV2 {
166
166
exllamaRepo = "https://github.com/turboderp/exllamav2"
167
- backend = "exllama2"
167
+ backend = utils . BackendExllamaV2
168
168
exllamaTag = "v0.0.11"
169
169
}
170
170
}
@@ -173,7 +173,7 @@ func installExllama(c *config.Config, s llb.State, merge llb.State) llb.State {
173
173
s = s .Run (sh ("apt-get update && apt-get install --no-install-recommends -y git ca-certificates python3-pip python3-dev g++ && apt-get clean" ), llb .IgnoreCache ).Root ()
174
174
175
175
// clone localai exllama backend only
176
- s = s . Run ( shf ( "git clone --filter=blob:none --no-checkout %[1]s /tmp/localai/ && cd /tmp/localai && git sparse-checkout init --cone && git sparse-checkout set backend/python/%[2]s && git checkout %[3]s && rm -rf .git" , localAIRepo , backend , localAIVersion )). Root ( )
176
+ s = cloneLocalAI ( s , backend )
177
177
178
178
// clone exllama to localai exllama backend path and install python dependencies
179
179
s = s .Run (shf ("git clone --depth 1 %[1]s --branch %[2]s /tmp/%[3]s && mv /tmp/%[3]s/* /tmp/localai/backend/python/%[3]s && rm -rf /tmp/%[3]s && cd /tmp/localai/backend/python/%[3]s && rm -rf .git && pip3 install grpcio protobuf typing-extensions sympy mpmath setuptools numpy --break-system-packages && pip3 install -r /tmp/localai/backend/python/%[3]s/requirements.txt --break-system-packages" , exllamaRepo , exllamaTag , backend )).Root ()
@@ -183,12 +183,11 @@ func installExllama(c *config.Config, s llb.State, merge llb.State) llb.State {
183
183
}
184
184
185
185
func installMamba (s llb.State , merge llb.State ) llb.State {
186
- backend := "mamba"
187
186
savedState := s
188
187
// libexpat1 is requirement but git is not. however libexpat1 is a dependency of git
189
188
s = s .Run (sh ("apt-get install --no-install-recommends -y git python3 python3-dev python3-pip libssl3 openssl && apt-get clean" ), llb .IgnoreCache ).Root ()
190
189
191
- s = s . Run ( shf ( "git clone --filter=blob:none --no-checkout %[1]s /tmp/localai/ && cd /tmp/localai && git sparse-checkout init --cone && git sparse-checkout set backend/python/%[2]s && git checkout %[3]s && rm -rf .git" , localAIRepo , backend , localAIVersion )). Root ( )
190
+ s = cloneLocalAI ( s , utils . BackendMamba )
192
191
193
192
s = s .Run (shf ("pip3 install packaging numpy torch==2.1.0 grpcio protobuf --break-system-packages && pip3 install causal-conv1d==1.0.0 mamba-ssm==1.0.1 --break-system-packages" )).Root ()
194
193
@@ -249,6 +248,10 @@ func addLocalAI(c *config.Config, s llb.State, merge llb.State) (llb.State, llb.
249
248
return s , llb .Merge ([]llb.State {merge , diff })
250
249
}
251
250
251
+ func cloneLocalAI (s llb.State , backend string ) llb.State {
252
+ return s .Run (shf ("git clone --filter=blob:none --no-checkout %[1]s /tmp/localai/ && cd /tmp/localai && git sparse-checkout init --cone && git sparse-checkout set backend/python/%[2]s && git checkout %[3]s && rm -rf .git" , localAIRepo , backend , localAIVersion )).Root ()
253
+ }
254
+
252
255
func shf (cmd string , v ... interface {}) llb.RunOption {
253
256
return llb .Args ([]string {"/bin/sh" , "-c" , fmt .Sprintf (cmd , v ... )})
254
257
}
0 commit comments