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
f43dea68
Unverified
Commit
f43dea68
authored
Feb 01, 2024
by
Daniel Hiltgen
Committed by
GitHub
Feb 01, 2024
Browse files
Merge pull request #2318 from dhiltgen/more_clean
Harden generate patching model
parents
79131045
e1f50377
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
llm/generate/gen_common.sh
llm/generate/gen_common.sh
+18
-8
No files found.
llm/generate/gen_common.sh
View file @
f43dea68
...
...
@@ -65,15 +65,17 @@ apply_patches() {
echo
'include (../../../ext_server/CMakeLists.txt) # ollama'
>>
${
LLAMACPP_DIR
}
/examples/server/CMakeLists.txt
fi
# apply temporary patches until fix is upstream
for
patch
in
../patches/
*
.diff
;
do
for
file
in
$(
grep
"^+++ "
${
patch
}
|
cut
-f2
-d
' '
|
cut
-f2-
-d
/
)
;
do
(
cd
${
LLAMACPP_DIR
}
;
git checkout
${
file
}
)
if
[
-n
"
$(
ls
-A
../patches/
*
.diff
)
"
]
;
then
# apply temporary patches until fix is upstream
for
patch
in
../patches/
*
.diff
;
do
for
file
in
$(
grep
"^+++ "
${
patch
}
|
cut
-f2
-d
' '
|
cut
-f2-
-d
/
)
;
do
(
cd
${
LLAMACPP_DIR
}
;
git checkout
${
file
}
)
done
done
do
ne
for
patch
in
../patches/
*
.diff
;
do
(
cd
${
LLAMACPP_DIR
}
&&
git apply
${
patch
}
)
done
for
patch
in
../patches/
*
.diff
;
do
(
cd
${
LLAMACPP_DIR
}
&&
git apply
${
patch
}
)
done
fi
# Avoid duplicate main symbols when we link into the cgo binary
sed
-e
's/int main(/int __main(/g'
<
${
LLAMACPP_DIR
}
/examples/server/server.cpp
>
${
LLAMACPP_DIR
}
/examples/server/server.cpp.tmp
&&
...
...
@@ -112,4 +114,12 @@ compress_libs() {
# Keep the local tree clean after we're done with the build
cleanup
()
{
(
cd
${
LLAMACPP_DIR
}
/examples/server/
&&
git checkout CMakeLists.txt server.cpp
)
if
[
-n
"
$(
ls
-A
../patches/
*
.diff
)
"
]
;
then
for
patch
in
../patches/
*
.diff
;
do
for
file
in
$(
grep
"^+++ "
${
patch
}
|
cut
-f2
-d
' '
|
cut
-f2-
-d
/
)
;
do
(
cd
${
LLAMACPP_DIR
}
;
git checkout
${
file
}
)
done
done
fi
}
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