File tree Expand file tree Collapse file tree 2 files changed +39
-23
lines changed Expand file tree Collapse file tree 2 files changed +39
-23
lines changed Original file line number Diff line number Diff line change @@ -149,21 +149,43 @@ https://user-images.githubusercontent.com/1991296/224442907-7693d4be-acaa-4e01-8
149
149
150
150
## Usage
151
151
152
- Here are the step for the LLaMA-7B model:
152
+ Here are the step for the LLaMA-7B model.
153
+
154
+ ### Get the Code
153
155
154
156
``` bash
155
- # build this repo
156
157
git clone https://github.com/ggerganov/llama.cpp
157
158
cd llama.cpp
158
- make
159
+ ```
160
+
161
+ ### Build
162
+
163
+ Note: For Windows, CMake or Zig can be used.
164
+
165
+ 1 . Use ` make `
166
+
167
+ ``` bash
168
+ make
169
+ ```
159
170
160
- # For Windows and CMake, use the following command instead:
161
- cd < path_to_llama_folder>
162
- mkdir build
163
- cd build
164
- cmake ..
165
- cmake --build . --config Release
171
+ 1. Use CMake
166
172
173
+ ` ` ` bash
174
+ mkdir build
175
+ cd build
176
+ cmake ..
177
+ cmake --build . --config Release
178
+ ` ` `
179
+
180
+ 1. Use Zig
181
+
182
+ ` ` ` bash
183
+ zig build -Drelease-fast
184
+ ` ` `
185
+
186
+ # ## Prepare Data & Run
187
+
188
+ ` ` ` bash
167
189
# obtain the original LLaMA model weights and place them in ./models
168
190
ls ./models
169
191
65B 30B 13B 7B tokenizer_checklist.chk tokenizer.model
Original file line number Diff line number Diff line change 1
1
const std = @import ("std" );
2
2
3
- pub fn build (b : * std.Build ) void {
3
+ pub fn build (b : * std.build.Builder ) void {
4
4
const target = b .standardTargetOptions (.{});
5
- const optimize = b .standardOptimizeOption (.{} );
5
+ const optimize = b .standardReleaseOptions ( );
6
6
const want_lto = b .option (bool , "lto" , "Want -fLTO" );
7
7
8
- const lib = b .addStaticLibrary (.{
9
- .name = "llama" ,
10
- .target = target ,
11
- .optimize = optimize ,
12
- });
8
+ const lib = b .addStaticLibrary ("llama" , null );
13
9
lib .want_lto = want_lto ;
10
+ lib .setTarget (target );
11
+ lib .setBuildMode (optimize );
14
12
lib .linkLibCpp ();
15
13
lib .addIncludePath ("." );
16
14
lib .addIncludePath ("examples" );
@@ -44,16 +42,12 @@ pub fn build(b: *std.Build) void {
44
42
fn build_example (comptime name : []const u8 , args : anytype ) * std.build.LibExeObjStep {
45
43
const b = args .b ;
46
44
const lib = args .lib ;
47
- const target = args .target ;
48
- const optimize = args .optimize ;
49
45
const want_lto = args .want_lto ;
50
46
51
- const exe = b .addExecutable (.{
52
- .name = name ,
53
- .target = target ,
54
- .optimize = optimize ,
55
- });
47
+ const exe = b .addExecutable (name , null );
56
48
exe .want_lto = want_lto ;
49
+ lib .setTarget (args .target );
50
+ lib .setBuildMode (args .optimize );
57
51
exe .addIncludePath ("." );
58
52
exe .addIncludePath ("examples" );
59
53
exe .addCSourceFiles (&.{
You can’t perform that action at this time.
0 commit comments