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
3144e2a4
Unverified
Commit
3144e2a4
authored
Dec 12, 2023
by
Bruce MacDonald
Committed by
GitHub
Dec 12, 2023
Browse files
exponential back-off (#1484)
parent
c0960e29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
llm/llama.go
llm/llama.go
+3
-2
No files found.
llm/llama.go
View file @
3144e2a4
...
...
@@ -545,8 +545,7 @@ type prediction struct {
}
const
maxBufferSize
=
512
*
format
.
KiloByte
const
maxRetries
=
3
const
retryDelay
=
1
*
time
.
Second
const
maxRetries
=
6
type
PredictOpts
struct
{
Prompt
string
...
...
@@ -610,9 +609,11 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred
request
[
"grammar"
]
=
jsonGrammar
}
retryDelay
:=
100
*
time
.
Microsecond
for
retries
:=
0
;
retries
<
maxRetries
;
retries
++
{
if
retries
>
0
{
time
.
Sleep
(
retryDelay
)
// wait before retrying
retryDelay
*=
2
// exponential backoff
}
// Handling JSON marshaling with special characters unescaped.
...
...
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