Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
05e39020
Unverified
Commit
05e39020
authored
Jul 31, 2023
by
Michael Yang
Committed by
GitHub
Jul 31, 2023
Browse files
Merge pull request #250 from jmorganca/fixes
Fixes
parents
99681537
87201163
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
llama/llama.go
llama/llama.go
+1
-1
server/images.go
server/images.go
+17
-5
No files found.
llama/llama.go
View file @
05e39020
package
llama
package
llama
/*
/*
#cgo CPPFLAGS: -O3 -Wall -Wextra
-Werror
-Wno-unused-function -Wno-unused-variable -DNDEBUG -DGGML_USE_K_QUANTS
#cgo CPPFLAGS: -O3 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -DNDEBUG -DGGML_USE_K_QUANTS
#cgo CXXFLAGS: -std=gnu++11
#cgo CXXFLAGS: -std=gnu++11
#cgo darwin CPPFLAGS: -DGGML_USE_ACCELERATE
#cgo darwin CPPFLAGS: -DGGML_USE_ACCELERATE
#cgo darwin,arm64 CPPFLAGS: -DGGML_USE_METAL -DGGML_METAL_NDEBUG
#cgo darwin,arm64 CPPFLAGS: -DGGML_USE_METAL -DGGML_METAL_NDEBUG
...
...
server/images.go
View file @
05e39020
...
@@ -271,7 +271,19 @@ func CreateModel(name string, path string, fn func(resp api.ProgressResponse)) e
...
@@ -271,7 +271,19 @@ func CreateModel(name string, path string, fn func(resp api.ProgressResponse)) e
layers
=
append
(
layers
,
newLayer
)
layers
=
append
(
layers
,
newLayer
)
}
}
}
}
case
"license"
,
"template"
,
"system"
,
"prompt"
:
case
"license"
:
fn
(
api
.
ProgressResponse
{
Status
:
fmt
.
Sprintf
(
"creating model %s layer"
,
c
.
Name
)})
// remove the prompt layer if one exists
mediaType
:=
fmt
.
Sprintf
(
"application/vnd.ollama.image.%s"
,
c
.
Name
)
layer
,
err
:=
CreateLayer
(
strings
.
NewReader
(
c
.
Args
))
if
err
!=
nil
{
return
err
}
layer
.
MediaType
=
mediaType
layers
=
append
(
layers
,
layer
)
case
"template"
,
"system"
,
"prompt"
:
fn
(
api
.
ProgressResponse
{
Status
:
fmt
.
Sprintf
(
"creating model %s layer"
,
c
.
Name
)})
fn
(
api
.
ProgressResponse
{
Status
:
fmt
.
Sprintf
(
"creating model %s layer"
,
c
.
Name
)})
// remove the prompt layer if one exists
// remove the prompt layer if one exists
mediaType
:=
fmt
.
Sprintf
(
"application/vnd.ollama.image.%s"
,
c
.
Name
)
mediaType
:=
fmt
.
Sprintf
(
"application/vnd.ollama.image.%s"
,
c
.
Name
)
...
@@ -590,6 +602,9 @@ func DeleteModel(name string) error {
...
@@ -590,6 +602,9 @@ func DeleteModel(name string) error {
}
}
return
nil
return
nil
})
})
if
err
!=
nil
{
return
err
}
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -873,14 +888,11 @@ func checkBlobExistence(mp ModelPath, digest string, regOpts *RegistryOptions) (
...
@@ -873,14 +888,11 @@ func checkBlobExistence(mp ModelPath, digest string, regOpts *RegistryOptions) (
return
resp
.
StatusCode
==
http
.
StatusOK
,
nil
return
resp
.
StatusCode
==
http
.
StatusOK
,
nil
}
}
func
uploadBlobChunked
(
mp
ModelPath
,
location
string
,
layer
*
Layer
,
regOpts
*
RegistryOptions
,
fn
func
(
api
.
ProgressResponse
))
error
{
func
uploadBlobChunked
(
mp
ModelPath
,
url
string
,
layer
*
Layer
,
regOpts
*
RegistryOptions
,
fn
func
(
api
.
ProgressResponse
))
error
{
// TODO allow resumability
// TODO allow resumability
// TODO allow canceling uploads via DELETE
// TODO allow canceling uploads via DELETE
// TODO allow cross repo blob mount
// TODO allow cross repo blob mount
// Create URL
url
:=
location
fp
,
err
:=
GetBlobsPath
(
layer
.
Digest
)
fp
,
err
:=
GetBlobsPath
(
layer
.
Digest
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment