Skip to content

Commit 60e8131

Browse files
committed
Merge upstream tag 'b5886' into develop
2 parents bc85227 + dcf7f2e commit 60e8131

1,218 files changed

Lines changed: 402824 additions & 137534 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 70 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
---
22
Language: Cpp
3-
# BasedOnStyle: Google
4-
AccessModifierOffset: -1
53
AlignAfterOpenBracket: Align
6-
AlignConsecutiveMacros: false
7-
AlignConsecutiveAssignments: false
8-
AlignConsecutiveDeclarations: false
9-
AlignEscapedNewlines: Left
10-
AlignOperands: true
11-
AlignTrailingComments: true
4+
AlignArrayOfStructures: Left
5+
AlignConsecutiveAssignments: AcrossComments
6+
AlignConsecutiveBitFields: AcrossComments
7+
AlignConsecutiveDeclarations: AcrossComments
8+
AlignConsecutiveMacros: AcrossComments
9+
# AlignConsecutiveShortCaseStatements: AcrossComments
10+
AlignEscapedNewlines: Left # LeftWithLastLine
11+
AlignOperands: Align
12+
AlignTrailingComments:
13+
Kind: Always
14+
OverEmptyLines: 1
1215
AllowAllArgumentsOnNextLine: true
13-
AllowAllConstructorInitializersOnNextLine: true
14-
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowAllParametersOfDeclarationOnNextLine: false
17+
# AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
1518
AllowShortBlocksOnASingleLine: Never
1619
AllowShortCaseLabelsOnASingleLine: false
17-
AllowShortFunctionsOnASingleLine: All
18-
AllowShortLambdasOnASingleLine: All
19-
AllowShortIfStatementsOnASingleLine: WithoutElse
20-
AllowShortLoopsOnASingleLine: true
21-
AlwaysBreakAfterDefinitionReturnType: None
22-
AlwaysBreakAfterReturnType: None
20+
AllowShortFunctionsOnASingleLine: Inline
21+
AllowShortIfStatementsOnASingleLine: Never
22+
AllowShortLambdasOnASingleLine: Inline
23+
AllowShortLoopsOnASingleLine: false
2324
AlwaysBreakBeforeMultilineStrings: true
24-
AlwaysBreakTemplateDeclarations: Yes
2525
BinPackArguments: true
26-
BinPackParameters: true
26+
BinPackParameters: true # OnePerLine
27+
BitFieldColonSpacing: Both
28+
BreakBeforeBraces: Custom # Attach
2729
BraceWrapping:
28-
AfterCaseLabel: false
30+
AfterCaseLabel: true
2931
AfterClass: false
3032
AfterControlStatement: false
3133
AfterEnum: false
@@ -37,40 +39,37 @@ BraceWrapping:
3739
AfterExternBlock: false
3840
BeforeCatch: false
3941
BeforeElse: false
42+
BeforeLambdaBody: false
43+
BeforeWhile: false
4044
IndentBraces: false
41-
SplitEmptyFunction: true
42-
SplitEmptyRecord: true
43-
SplitEmptyNamespace: true
45+
SplitEmptyFunction: false
46+
SplitEmptyRecord: false
47+
SplitEmptyNamespace: false
48+
# BreakAdjacentStringLiterals: true
49+
BreakAfterAttributes: Never
4450
BreakBeforeBinaryOperators: None
45-
BreakBeforeBraces: Attach
46-
BreakBeforeInheritanceComma: false
47-
BreakInheritanceList: BeforeColon
48-
BreakBeforeTernaryOperators: true
49-
BreakConstructorInitializersBeforeComma: false
50-
BreakConstructorInitializers: BeforeColon
51-
BreakAfterJavaFieldAnnotations: false
51+
BreakBeforeInlineASMColon: OnlyMultiline
52+
BreakBeforeTernaryOperators: false
53+
# BreakBinaryOperations: Never
54+
BreakConstructorInitializers: AfterColon
55+
# BreakFunctionDefinitionParameters: false
56+
BreakInheritanceList: AfterComma
5257
BreakStringLiterals: true
53-
ColumnLimit: 80
58+
# BreakTemplateDeclarations: Yes
59+
ColumnLimit: 120
5460
CommentPragmas: '^ IWYU pragma:'
5561
CompactNamespaces: false
56-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
5762
ConstructorInitializerIndentWidth: 4
5863
ContinuationIndentWidth: 4
59-
Cpp11BracedListStyle: true
60-
DeriveLineEnding: true
61-
DerivePointerAlignment: true
64+
Cpp11BracedListStyle: false
65+
DerivePointerAlignment: false
6266
DisableFormat: false
67+
EmptyLineBeforeAccessModifier: Leave
68+
EmptyLineAfterAccessModifier: Never
6369
ExperimentalAutoDetectBinPacking: false
6470
FixNamespaceComments: true
65-
ForEachMacros:
66-
- foreach
67-
- Q_FOREACH
68-
- BOOST_FOREACH
6971
IncludeBlocks: Regroup
7072
IncludeCategories:
71-
- Regex: '^<ext/.*\.h>'
72-
Priority: 2
73-
SortPriority: 0
7473
- Regex: '^<.*\.h>'
7574
Priority: 1
7675
SortPriority: 0
@@ -82,22 +81,31 @@ IncludeCategories:
8281
SortPriority: 0
8382
IncludeIsMainRegex: '([-_](test|unittest))?$'
8483
IncludeIsMainSourceRegex: ''
84+
IndentAccessModifiers: false
85+
IndentCaseBlocks: true
8586
IndentCaseLabels: true
86-
IndentGotoLabels: true
87-
IndentPPDirectives: None
87+
IndentExternBlock: NoIndent
88+
IndentGotoLabels: false
89+
IndentPPDirectives: AfterHash
8890
IndentWidth: 4
8991
IndentWrappedFunctionNames: false
92+
InsertBraces: true # NOTE: may lead to incorrect formatting
93+
InsertNewlineAtEOF: true
9094
JavaScriptQuotes: Leave
9195
JavaScriptWrapImports: true
9296
KeepEmptyLinesAtTheStartOfBlocks: false
97+
LambdaBodyIndentation: Signature
98+
LineEnding: LF
9399
MacroBlockBegin: ''
94100
MacroBlockEnd: ''
95101
MaxEmptyLinesToKeep: 1
96102
NamespaceIndentation: None
97-
ObjCBinPackProtocolList: Never
98-
ObjCBlockIndentWidth: 2
99-
ObjCSpaceAfterProperty: false
103+
ObjCBinPackProtocolList: Auto
104+
ObjCBlockIndentWidth: 4
105+
ObjCSpaceAfterProperty: true
100106
ObjCSpaceBeforeProtocolList: true
107+
PPIndentWidth: -1
108+
PackConstructorInitializers: CurrentLine
101109
PenaltyBreakAssignment: 2
102110
PenaltyBreakBeforeFirstCallParameter: 1
103111
PenaltyBreakComment: 300
@@ -106,7 +114,9 @@ PenaltyBreakString: 1000
106114
PenaltyBreakTemplateDeclaration: 10
107115
PenaltyExcessCharacter: 1000000
108116
PenaltyReturnTypeOnItsOwnLine: 200
109-
PointerAlignment: Left
117+
PointerAlignment: Middle
118+
QualifierAlignment: Left
119+
#QualifierOrder: ['static', 'inline', 'friend', 'constexpr', 'const', 'volatile', 'type', 'restrict']
110120
RawStringFormats:
111121
- Language: Cpp
112122
Delimiters:
@@ -118,27 +128,12 @@ RawStringFormats:
118128
- 'c++'
119129
- 'C++'
120130
CanonicalDelimiter: ''
121-
BasedOnStyle: google
122-
- Language: TextProto
123-
Delimiters:
124-
- pb
125-
- PB
126-
- proto
127-
- PROTO
128-
EnclosingFunctions:
129-
- EqualsProto
130-
- EquivToProto
131-
- PARSE_PARTIAL_TEXT_PROTO
132-
- PARSE_TEST_PROTO
133-
- PARSE_TEXT_PROTO
134-
- ParseTextOrDie
135-
- ParseTextProtoOrDie
136-
CanonicalDelimiter: ''
137-
BasedOnStyle: google
138-
ReflowComments: true
139-
SortIncludes: true
140-
SortUsingDeclarations: true
141-
SpaceAfterCStyleCast: false
131+
ReferenceAlignment: Middle
132+
ReflowComments: false # IndentOnly
133+
SeparateDefinitionBlocks: Always
134+
SortIncludes: CaseInsensitive
135+
SortUsingDeclarations: LexicographicNumeric
136+
SpaceAfterCStyleCast: true
142137
SpaceAfterLogicalNot: false
143138
SpaceAfterTemplateKeyword: true
144139
SpaceBeforeAssignmentOperators: true
@@ -150,19 +145,17 @@ SpaceBeforeRangeBasedForLoopColon: true
150145
SpaceInEmptyBlock: false
151146
SpaceInEmptyParentheses: false
152147
SpacesBeforeTrailingComments: 2
153-
SpacesInAngles: false
154-
SpacesInConditionalStatement: false
148+
SpacesInAngles: Never
155149
SpacesInContainerLiterals: true
156-
SpacesInCStyleCastParentheses: false
150+
SpacesInLineCommentPrefix:
151+
Minimum: 1
152+
Maximum: -1
157153
SpacesInParentheses: false
158154
SpacesInSquareBrackets: false
159155
SpaceBeforeSquareBrackets: false
160-
Standard: Auto
161-
StatementMacros:
162-
- Q_UNUSED
163-
- QT_REQUIRE_VERSION
164-
TabWidth: 8
165-
UseCRLF: false
156+
Standard: c++17
157+
TabWidth: 4
166158
UseTab: Never
159+
WhitespaceSensitiveMacros: ['STRINGIZE']
167160
...
168161

.clang-tidy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ Checks: >
1313
-readability-magic-numbers,
1414
-readability-uppercase-literal-suffix,
1515
-readability-simplify-boolean-expr,
16+
-readability-math-missing-parentheses,
1617
clang-analyzer-*,
1718
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
1819
performance-*,
1920
portability-*,
21+
-portability-simd-intrinsics,
2022
misc-*,
2123
-misc-const-correctness,
2224
-misc-non-private-member-variables-in-classes,
2325
-misc-no-recursion,
26+
-misc-use-anonymous-namespace,
2427
FormatStyle: none

.devops/cpu.Dockerfile

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
ARG UBUNTU_VERSION=22.04
2+
3+
FROM ubuntu:$UBUNTU_VERSION AS build
4+
5+
ARG TARGETARCH
6+
7+
ARG GGML_CPU_ARM_ARCH=armv8-a
8+
9+
RUN apt-get update && \
10+
apt-get install -y build-essential git cmake
11+
12+
WORKDIR /app
13+
14+
COPY . .
15+
16+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
17+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_CURL=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON; \
18+
elif [ "$TARGETARCH" = "arm64" ]; then \
19+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_CURL=OFF -DGGML_CPU_ARM_ARCH=${GGML_CPU_ARM_ARCH}; \
20+
else \
21+
echo "Unsupported architecture"; \
22+
exit 1; \
23+
fi && \
24+
cmake --build build -j $(nproc)
25+
26+
RUN mkdir -p /app/lib && \
27+
find build \( -name "*.so" -o -name "*.so.*" \) -exec cp {} /app/lib \;
28+
29+
RUN mkdir -p /app/full \
30+
&& cp build/bin/* /app/full \
31+
&& cp *.py /app/full \
32+
&& cp -r gguf-py /app/full \
33+
&& cp -r requirements /app/full \
34+
&& cp requirements.txt /app/full \
35+
&& cp .devops/tools.sh /app/full/tools.sh
36+
37+
## Base image
38+
FROM ubuntu:$UBUNTU_VERSION AS base
39+
40+
RUN apt-get update \
41+
&& apt-get install -y libgomp1 curl\
42+
&& apt autoremove -y \
43+
&& apt clean -y \
44+
&& rm -rf /tmp/* /var/tmp/* \
45+
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
46+
&& find /var/cache -type f -delete
47+
48+
COPY --from=build /app/lib/ /app
49+
50+
### Full
51+
FROM base AS full
52+
53+
ENV LD_LIBRARY_PATH=/app:$LD_LIBRARY_PATH
54+
55+
COPY --from=build /app/full /app
56+
57+
WORKDIR /app
58+
59+
RUN apt-get update \
60+
&& apt-get install -y \
61+
git \
62+
python3 \
63+
python3-pip \
64+
&& pip install --upgrade pip setuptools wheel \
65+
&& pip install -r requirements.txt \
66+
&& apt autoremove -y \
67+
&& apt clean -y \
68+
&& rm -rf /tmp/* /var/tmp/* \
69+
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
70+
&& find /var/cache -type f -delete
71+
72+
ENTRYPOINT ["/app/tools.sh"]
73+
74+
### Light, CLI only
75+
FROM base AS light
76+
77+
ENV LD_LIBRARY_PATH=/app:$LD_LIBRARY_PATH
78+
79+
COPY --from=build /app/full/llama-cli /app
80+
81+
WORKDIR /app
82+
83+
ENTRYPOINT [ "/app/llama-cli" ]
84+
85+
### Server, Server only
86+
FROM base AS server
87+
88+
ENV LD_LIBRARY_PATH=/app:$LD_LIBRARY_PATH
89+
ENV LLAMA_ARG_HOST=0.0.0.0
90+
91+
COPY --from=build /app/full/llama-server /app
92+
93+
WORKDIR /app
94+
95+
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
96+
97+
ENTRYPOINT [ "/app/llama-server" ]

0 commit comments

Comments
 (0)