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
c63f8119
Commit
c63f8119
authored
Jul 11, 2023
by
Jeffrey Morgan
Browse files
return error if model fails to load
parent
7c71c10d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
llama/llama.go
llama/llama.go
+7
-0
No files found.
llama/llama.go
View file @
c63f8119
...
@@ -123,7 +123,14 @@ func New(model string, opts api.Options) (*llama, error) {
...
@@ -123,7 +123,14 @@ func New(model string, opts api.Options) (*llama, error) {
defer
C
.
free
(
unsafe
.
Pointer
(
cModel
))
defer
C
.
free
(
unsafe
.
Pointer
(
cModel
))
llm
.
model
=
C
.
llama_load_model_from_file
(
cModel
,
params
)
llm
.
model
=
C
.
llama_load_model_from_file
(
cModel
,
params
)
if
llm
.
model
==
nil
{
return
nil
,
errors
.
New
(
"failed to load model"
)
}
llm
.
ctx
=
C
.
llama_new_context_with_model
(
llm
.
model
,
params
)
llm
.
ctx
=
C
.
llama_new_context_with_model
(
llm
.
model
,
params
)
if
llm
.
ctx
==
nil
{
return
nil
,
errors
.
New
(
"failed to create context"
)
}
// warm up the model
// warm up the model
bos
:=
[]
C
.
llama_token
{
C
.
llama_token_bos
()}
bos
:=
[]
C
.
llama_token
{
C
.
llama_token_bos
()}
...
...
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