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
d6af13ef
Commit
d6af13ef
authored
Feb 26, 2025
by
Michael Yang
Browse files
runner: simplify tensor split parsing
parent
a59f6652
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
runner/llamarunner/runner.go
runner/llamarunner/runner.go
+4
-5
runner/ollamarunner/runner.go
runner/ollamarunner/runner.go
+4
-5
No files found.
runner/llamarunner/runner.go
View file @
d6af13ef
...
@@ -943,12 +943,11 @@ func Execute(args []string) error {
...
@@ -943,12 +943,11 @@ func Execute(args []string) error {
var
tensorSplitFloats
[]
float32
var
tensorSplitFloats
[]
float32
if
*
tensorSplit
!=
""
{
if
*
tensorSplit
!=
""
{
stringFloats
:=
regexp
.
MustCompile
(
","
)
.
Split
(
*
tensorSplit
,
-
1
)
splits
:=
strings
.
Split
(
*
tensorSplit
,
","
)
tensorSplitFloats
=
make
([]
float32
,
len
(
splits
))
tensorSplitFloats
=
make
([]
float32
,
0
,
len
(
stringFloats
))
for
i
,
s
:=
range
splits
{
for
_
,
s
:=
range
stringFloats
{
f
,
_
:=
strconv
.
ParseFloat
(
s
,
32
)
f
,
_
:=
strconv
.
ParseFloat
(
s
,
32
)
tensorSplitFloats
=
append
(
tensorSplitFloats
,
float32
(
f
)
)
tensorSplitFloats
[
i
]
=
float32
(
f
)
}
}
}
}
...
...
runner/ollamarunner/runner.go
View file @
d6af13ef
...
@@ -881,12 +881,11 @@ func Execute(args []string) error {
...
@@ -881,12 +881,11 @@ func Execute(args []string) error {
var
tensorSplitFloats
[]
float32
var
tensorSplitFloats
[]
float32
if
*
tensorSplit
!=
""
{
if
*
tensorSplit
!=
""
{
stringFloats
:=
regexp
.
MustCompile
(
","
)
.
Split
(
*
tensorSplit
,
-
1
)
splits
:=
strings
.
Split
(
*
tensorSplit
,
","
)
tensorSplitFloats
=
make
([]
float32
,
len
(
splits
))
tensorSplitFloats
=
make
([]
float32
,
0
,
len
(
stringFloats
))
for
i
,
s
:=
range
splits
{
for
_
,
s
:=
range
stringFloats
{
f
,
_
:=
strconv
.
ParseFloat
(
s
,
32
)
f
,
_
:=
strconv
.
ParseFloat
(
s
,
32
)
tensorSplitFloats
=
append
(
tensorSplitFloats
,
float32
(
f
)
)
tensorSplitFloats
[
i
]
=
float32
(
f
)
}
}
}
}
...
...
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