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
2bb2bdd5
Commit
2bb2bdd5
authored
Dec 15, 2023
by
Michael Yang
Browse files
fix lint
parent
acfc376e
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
15 additions
and
15 deletions
+15
-15
cmd/interactive.go
cmd/interactive.go
+1
-4
llm/ggml.go
llm/ggml.go
+3
-3
progress/progress.go
progress/progress.go
+1
-3
readline/history.go
readline/history.go
+2
-2
readline/readline.go
readline/readline.go
+1
-0
readline/readline_unix.go
readline/readline_unix.go
+1
-1
server/download.go
server/download.go
+2
-1
server/images.go
server/images.go
+1
-0
server/routes.go
server/routes.go
+1
-0
server/routes_test.go
server/routes_test.go
+1
-1
server/upload.go
server/upload.go
+1
-0
No files found.
cmd/interactive.go
View file @
2bb2bdd5
...
@@ -238,10 +238,7 @@ func generateInteractive(cmd *cobra.Command, opts generateOptions) error {
...
@@ -238,10 +238,7 @@ func generateInteractive(cmd *cobra.Command, opts generateOptions) error {
usageParameters
()
usageParameters
()
continue
continue
}
}
var
params
[]
string
params
:=
args
[
3
:
]
for
_
,
p
:=
range
args
[
3
:
]
{
params
=
append
(
params
,
p
)
}
fp
,
err
:=
api
.
FormatParams
(
map
[
string
][]
string
{
args
[
2
]
:
params
})
fp
,
err
:=
api
.
FormatParams
(
map
[
string
][]
string
{
args
[
2
]
:
params
})
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"Couldn't set parameter: %q
\n\n
"
,
err
)
fmt
.
Printf
(
"Couldn't set parameter: %q
\n\n
"
,
err
)
...
...
llm/ggml.go
View file @
2bb2bdd5
...
@@ -98,9 +98,9 @@ func (c *containerLORA) Name() string {
...
@@ -98,9 +98,9 @@ func (c *containerLORA) Name() string {
return
"ggla"
return
"ggla"
}
}
func
(
c
*
containerLORA
)
Decode
(
ro
*
readSeekOffset
)
(
model
,
error
)
{
func
(
c
*
containerLORA
)
Decode
(
r
s
o
*
readSeekOffset
)
(
model
,
error
)
{
var
version
uint32
var
version
uint32
binary
.
Read
(
ro
,
binary
.
LittleEndian
,
&
version
)
binary
.
Read
(
r
s
o
,
binary
.
LittleEndian
,
&
version
)
switch
version
{
switch
version
{
case
1
:
case
1
:
...
@@ -111,7 +111,7 @@ func (c *containerLORA) Decode(ro *readSeekOffset) (model, error) {
...
@@ -111,7 +111,7 @@ func (c *containerLORA) Decode(ro *readSeekOffset) (model, error) {
c
.
version
=
version
c
.
version
=
version
// remaining file contents aren't decoded
// remaining file contents aren't decoded
ro
.
Seek
(
0
,
io
.
SeekEnd
)
r
s
o
.
Seek
(
0
,
io
.
SeekEnd
)
return
nil
,
nil
return
nil
,
nil
}
}
...
...
progress/progress.go
View file @
2bb2bdd5
...
@@ -77,7 +77,7 @@ func (p *Progress) Add(key string, state State) {
...
@@ -77,7 +77,7 @@ func (p *Progress) Add(key string, state State) {
p
.
states
=
append
(
p
.
states
,
state
)
p
.
states
=
append
(
p
.
states
,
state
)
}
}
func
(
p
*
Progress
)
render
()
error
{
func
(
p
*
Progress
)
render
()
{
p
.
mu
.
Lock
()
p
.
mu
.
Lock
()
defer
p
.
mu
.
Unlock
()
defer
p
.
mu
.
Unlock
()
...
@@ -101,8 +101,6 @@ func (p *Progress) render() error {
...
@@ -101,8 +101,6 @@ func (p *Progress) render() error {
}
}
p
.
pos
=
len
(
p
.
states
)
p
.
pos
=
len
(
p
.
states
)
return
nil
}
}
func
(
p
*
Progress
)
start
()
{
func
(
p
*
Progress
)
start
()
{
...
...
readline/history.go
View file @
2bb2bdd5
...
@@ -23,7 +23,7 @@ type History struct {
...
@@ -23,7 +23,7 @@ type History struct {
func
NewHistory
()
(
*
History
,
error
)
{
func
NewHistory
()
(
*
History
,
error
)
{
h
:=
&
History
{
h
:=
&
History
{
Buf
:
arraylist
.
New
(),
Buf
:
arraylist
.
New
(),
Limit
:
100
,
//resizeme
Limit
:
100
,
//
resizeme
Autosave
:
true
,
Autosave
:
true
,
Enabled
:
true
,
Enabled
:
true
,
}
}
...
@@ -84,7 +84,7 @@ func (h *History) Add(l []rune) {
...
@@ -84,7 +84,7 @@ func (h *History) Add(l []rune) {
h
.
Compact
()
h
.
Compact
()
h
.
Pos
=
h
.
Size
()
h
.
Pos
=
h
.
Size
()
if
h
.
Autosave
{
if
h
.
Autosave
{
h
.
Save
()
_
=
h
.
Save
()
}
}
}
}
...
...
readline/readline.go
View file @
2bb2bdd5
...
@@ -72,6 +72,7 @@ func (i *Instance) Readline() (string, error) {
...
@@ -72,6 +72,7 @@ func (i *Instance) Readline() (string, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
// nolint: errcheck
defer
UnsetRawMode
(
fd
,
termios
)
defer
UnsetRawMode
(
fd
,
termios
)
buf
,
_
:=
NewBuffer
(
i
.
Prompt
)
buf
,
_
:=
NewBuffer
(
i
.
Prompt
)
...
...
readline/readline_unix.go
View file @
2bb2bdd5
...
@@ -11,7 +11,7 @@ func handleCharCtrlZ(fd int, termios *Termios) (string, error) {
...
@@ -11,7 +11,7 @@ func handleCharCtrlZ(fd int, termios *Termios) (string, error) {
return
""
,
err
return
""
,
err
}
}
syscall
.
Kill
(
0
,
syscall
.
SIGSTOP
)
_
=
syscall
.
Kill
(
0
,
syscall
.
SIGSTOP
)
// on resume...
// on resume...
return
""
,
nil
return
""
,
nil
...
...
server/download.go
View file @
2bb2bdd5
...
@@ -138,7 +138,7 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *Regis
...
@@ -138,7 +138,7 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *Regis
}
}
defer
file
.
Close
()
defer
file
.
Close
()
file
.
Truncate
(
b
.
Total
)
_
=
file
.
Truncate
(
b
.
Total
)
g
,
inner
:=
errgroup
.
WithContext
(
ctx
)
g
,
inner
:=
errgroup
.
WithContext
(
ctx
)
g
.
SetLimit
(
numDownloadParts
)
g
.
SetLimit
(
numDownloadParts
)
...
@@ -340,6 +340,7 @@ func downloadBlob(ctx context.Context, opts downloadOpts) error {
...
@@ -340,6 +340,7 @@ func downloadBlob(ctx context.Context, opts downloadOpts) error {
return
err
return
err
}
}
// nolint: contextcheck
go
download
.
Run
(
context
.
Background
(),
requestURL
,
opts
.
regOpts
)
go
download
.
Run
(
context
.
Background
(),
requestURL
,
opts
.
regOpts
)
}
}
...
...
server/images.go
View file @
2bb2bdd5
...
@@ -747,6 +747,7 @@ func deleteUnusedLayers(skipModelPath *ModelPath, deleteMap map[string]struct{},
...
@@ -747,6 +747,7 @@ func deleteUnusedLayers(skipModelPath *ModelPath, deleteMap map[string]struct{},
// save (i.e. delete from the deleteMap) any files used in other manifests
// save (i.e. delete from the deleteMap) any files used in other manifests
manifest
,
_
,
err
:=
GetManifest
(
fmp
)
manifest
,
_
,
err
:=
GetManifest
(
fmp
)
if
err
!=
nil
{
if
err
!=
nil
{
// nolint: nilerr
return
nil
return
nil
}
}
...
...
server/routes.go
View file @
2bb2bdd5
...
@@ -748,6 +748,7 @@ func ListModelsHandler(c *gin.Context) {
...
@@ -748,6 +748,7 @@ func ListModelsHandler(c *gin.Context) {
resp
,
err
:=
modelResponse
(
tag
)
resp
,
err
:=
modelResponse
(
tag
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"skipping file: %s"
,
fp
)
log
.
Printf
(
"skipping file: %s"
,
fp
)
// nolint: nilerr
return
nil
return
nil
}
}
...
...
server/routes_test.go
View file @
2bb2bdd5
...
@@ -193,8 +193,8 @@ func Test_Routes(t *testing.T) {
...
@@ -193,8 +193,8 @@ func Test_Routes(t *testing.T) {
}
}
resp
,
err
:=
httpSrv
.
Client
()
.
Do
(
req
)
resp
,
err
:=
httpSrv
.
Client
()
.
Do
(
req
)
defer
resp
.
Body
.
Close
()
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
defer
resp
.
Body
.
Close
()
if
tc
.
Expected
!=
nil
{
if
tc
.
Expected
!=
nil
{
tc
.
Expected
(
t
,
resp
)
tc
.
Expected
(
t
,
resp
)
...
...
server/upload.go
View file @
2bb2bdd5
...
@@ -395,6 +395,7 @@ func uploadBlob(ctx context.Context, mp ModelPath, layer *Layer, opts *RegistryO
...
@@ -395,6 +395,7 @@ func uploadBlob(ctx context.Context, mp ModelPath, layer *Layer, opts *RegistryO
return
err
return
err
}
}
// nolint: contextcheck
go
upload
.
Run
(
context
.
Background
(),
opts
)
go
upload
.
Run
(
context
.
Background
(),
opts
)
}
}
...
...
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