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
fa2f095b
Commit
fa2f095b
authored
Dec 10, 2023
by
Jeffrey Morgan
Browse files
fix model name returned by `/api/generate` being different than the model name provided
parent
045b855d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
llm/llama.go
llm/llama.go
+0
-4
server/routes.go
server/routes.go
+2
-4
No files found.
llm/llama.go
View file @
fa2f095b
...
...
@@ -545,7 +545,6 @@ type prediction struct {
const
maxBufferSize
=
512
*
format
.
KiloByte
type
PredictOpts
struct
{
Model
string
Prompt
string
Format
string
CheckpointStart
time
.
Time
...
...
@@ -553,7 +552,6 @@ type PredictOpts struct {
}
type
PredictResult
struct
{
Model
string
CreatedAt
time
.
Time
TotalDuration
time
.
Duration
LoadDuration
time
.
Duration
...
...
@@ -651,7 +649,6 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred
if
p
.
Content
!=
""
{
fn
(
PredictResult
{
Model
:
predict
.
Model
,
CreatedAt
:
time
.
Now
()
.
UTC
(),
Content
:
p
.
Content
,
})
...
...
@@ -659,7 +656,6 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred
if
p
.
Stop
{
fn
(
PredictResult
{
Model
:
predict
.
Model
,
CreatedAt
:
time
.
Now
()
.
UTC
(),
TotalDuration
:
time
.
Since
(
predict
.
CheckpointStart
),
...
...
server/routes.go
View file @
fa2f095b
...
...
@@ -260,7 +260,7 @@ func GenerateHandler(c *gin.Context) {
}
resp
:=
api
.
GenerateResponse
{
Model
:
r
.
Model
,
Model
:
r
eq
.
Model
,
CreatedAt
:
r
.
CreatedAt
,
Done
:
r
.
Done
,
Response
:
r
.
Content
,
...
...
@@ -288,7 +288,6 @@ func GenerateHandler(c *gin.Context) {
// Start prediction
predictReq
:=
llm
.
PredictOpts
{
Model
:
model
.
Name
,
Prompt
:
prompt
,
Format
:
req
.
Format
,
CheckpointStart
:
checkpointStart
,
...
...
@@ -985,7 +984,7 @@ func ChatHandler(c *gin.Context) {
loaded
.
expireTimer
.
Reset
(
sessionDuration
)
resp
:=
api
.
ChatResponse
{
Model
:
r
.
Model
,
Model
:
r
eq
.
Model
,
CreatedAt
:
r
.
CreatedAt
,
Done
:
r
.
Done
,
Metrics
:
api
.
Metrics
{
...
...
@@ -1007,7 +1006,6 @@ func ChatHandler(c *gin.Context) {
// Start prediction
predictReq
:=
llm
.
PredictOpts
{
Model
:
model
.
Name
,
Prompt
:
prompt
,
Format
:
req
.
Format
,
CheckpointStart
:
checkpointStart
,
...
...
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