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
b71c67b6
Commit
b71c67b6
authored
Jul 21, 2023
by
Michael Yang
Browse files
allocate a large enough tokens slice
parent
6d6b0d33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
llama/llama.go
llama/llama.go
+1
-1
No files found.
llama/llama.go
View file @
b71c67b6
...
@@ -168,7 +168,7 @@ func (llm *llama) tokenize(prompt string) []C.llama_token {
...
@@ -168,7 +168,7 @@ func (llm *llama) tokenize(prompt string) []C.llama_token {
cPrompt
:=
C
.
CString
(
prompt
)
cPrompt
:=
C
.
CString
(
prompt
)
defer
C
.
free
(
unsafe
.
Pointer
(
cPrompt
))
defer
C
.
free
(
unsafe
.
Pointer
(
cPrompt
))
tokens
:=
make
([]
C
.
llama_token
,
l
lm
.
NumCtx
)
tokens
:=
make
([]
C
.
llama_token
,
l
en
(
prompt
)
+
1
)
if
n
:=
C
.
llama_tokenize
(
llm
.
ctx
,
cPrompt
,
unsafe
.
SliceData
(
tokens
),
C
.
int
(
len
(
tokens
)),
true
);
n
>
0
{
if
n
:=
C
.
llama_tokenize
(
llm
.
ctx
,
cPrompt
,
unsafe
.
SliceData
(
tokens
),
C
.
int
(
len
(
tokens
)),
true
);
n
>
0
{
return
tokens
[
:
n
]
return
tokens
[
:
n
]
}
}
...
...
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