forked from ggerganov/ggml
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into falcon40b
- Loading branch information
Showing
50 changed files
with
10,842 additions
and
1,991 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
GGML_NLOOP: 3 | ||
GGML_NITER: 1 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set GGML_N_THREADS for Ubuntu | ||
run: echo "GGML_N_THREADS=2" >> $GITHUB_ENV | ||
if: matrix.os == 'ubuntu-latest' | ||
|
||
- name: Set GGML_N_THREADS for MacOS | ||
run: echo "GGML_N_THREADS=2" >> $GITHUB_ENV | ||
if: matrix.os == 'macos-latest' | ||
|
||
- name: Create Build Environment | ||
run: mkdir build | ||
|
||
- name: Configure CMake | ||
working-directory: ./build | ||
run: cmake .. | ||
|
||
- name: Build | ||
working-directory: ./build | ||
run: make | ||
|
||
- name: Test | ||
working-directory: ./build | ||
run: ctest --verbose --timeout 900 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
const std = @import("std"); | ||
|
||
// Zig Version: 0.11.0-dev.3798+a5e15eced | ||
// Zig Build Command: zig build | ||
// Zig Run Command: | ||
// zig build run_dolly-v2 | ||
// zig build run_gpt-2 | ||
// zig build run_gpt-j | ||
// zig build run_gpt-neox | ||
// zig build run_mnist | ||
// zig build run_mpt | ||
// zig build run_replit | ||
// zig build run_starcoder | ||
// zig build run_test-grad0 | ||
// zig build run_test-mul-mat0 | ||
// zig build run_test-mul-mat2 | ||
// zig build run_test-opt | ||
// zig build run_test-vec1 | ||
// zig build run_test0 | ||
// zig build run_test1 | ||
// zig build run_test2 | ||
// zig build run_test3 | ||
pub fn build(b: *std.build.Builder) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
const lib = b.addStaticLibrary(.{ | ||
.name = "ggml", | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
lib.addIncludePath("./include"); | ||
lib.addIncludePath("./include/ggml"); | ||
lib.addCSourceFiles(&.{ | ||
"src/ggml.c", | ||
}, &.{"-std=c11"}); | ||
lib.linkLibC(); | ||
lib.linkLibCpp(); | ||
b.installArtifact(lib); | ||
|
||
// examples | ||
const examples = .{ | ||
"dolly-v2", | ||
"gpt-2", | ||
"gpt-j", | ||
"gpt-neox", | ||
"mnist", | ||
"mpt", | ||
"replit", | ||
"starcoder", | ||
// "whisper", | ||
}; | ||
inline for (examples) |name| { | ||
const exe = b.addExecutable(.{ | ||
.name = name, | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
exe.addIncludePath("./include"); | ||
exe.addIncludePath("./include/ggml"); | ||
exe.addIncludePath("./examples"); | ||
// exe.addIncludePath("./examples/whisper"); | ||
exe.addCSourceFiles(&.{ | ||
std.fmt.comptimePrint("examples/{s}/main.cpp", .{name}), | ||
"examples/common.cpp", | ||
"examples/common-ggml.cpp", | ||
// "examples/whisper/whisper.cpp", | ||
}, &.{"-std=c++11"}); | ||
exe.linkLibrary(lib); | ||
b.installArtifact(exe); | ||
const run_cmd = b.addRunArtifact(exe); | ||
run_cmd.step.dependOn(b.getInstallStep()); | ||
if (b.args) |args| run_cmd.addArgs(args); | ||
const run_step = b.step("run_" ++ name, "Run examples"); | ||
run_step.dependOn(&run_cmd.step); | ||
} | ||
|
||
// tests | ||
const tests = .{ | ||
// "test-blas0", | ||
"test-grad0", | ||
"test-mul-mat0", | ||
// "test-mul-mat1", | ||
"test-mul-mat2", | ||
"test-opt", | ||
// "test-svd0", | ||
// "test-vec0", | ||
"test-vec1", | ||
// "test-vec2", | ||
"test0", | ||
"test1", | ||
"test2", | ||
"test3", | ||
}; | ||
inline for (tests) |name| { | ||
const exe = b.addExecutable(.{ | ||
.name = name, | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
exe.addIncludePath("./include"); | ||
exe.addIncludePath("./include/ggml"); | ||
exe.addCSourceFiles(&.{ | ||
std.fmt.comptimePrint("tests/{s}.c", .{name}), | ||
}, &.{"-std=c11"}); | ||
exe.linkLibrary(lib); | ||
b.installArtifact(exe); | ||
const run_cmd = b.addRunArtifact(exe); | ||
run_cmd.step.dependOn(b.getInstallStep()); | ||
if (b.args) |args| run_cmd.addArgs(args); | ||
const run_step = b.step("run_" ++ name, "Run tests"); | ||
run_step.dependOn(&run_cmd.step); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.