mirror of https://github.com/google/gemma.cpp.git
Copybara import of the project:
--5c7dbc6599by Ikko Eltociear Ashimine <eltociear@gmail.com>: Update build.yml dispath -> dispatch COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gemma.cpp/pull/22 from eltociear:patch-15c7dbc6599PiperOrigin-RevId: 609827161
This commit is contained in:
parent
7698e3c3de
commit
e4e02a17d4
|
|
@ -0,0 +1,116 @@
|
|||
# gemma.cpp is a lightweight, standalone C++ inference engine for the Gemma
|
||||
# foundation models from Google.
|
||||
|
||||
load("@rules_license//rules:license.bzl", "license")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
license(
|
||||
name = "license",
|
||||
package_name = "gemma_cpp",
|
||||
)
|
||||
|
||||
# Dual-licensed Apache 2 and 3-clause BSD.
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files(["LICENSE"])
|
||||
|
||||
cc_library(
|
||||
name = "transformer_ops",
|
||||
hdrs = [
|
||||
"ops.h",
|
||||
],
|
||||
deps = [
|
||||
"//compression:compress",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:algo",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:dot",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:math",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:matvec",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:profiler",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
"//hwy/contrib/sort:vqsort",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "args",
|
||||
hdrs = [
|
||||
"util/args.h",
|
||||
],
|
||||
deps = [
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "app",
|
||||
hdrs = [
|
||||
"util/app.h",
|
||||
],
|
||||
deps = [
|
||||
":args",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "gemma_lib",
|
||||
srcs = [
|
||||
"gemma.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"configs.h",
|
||||
"gemma.h",
|
||||
],
|
||||
deps = [
|
||||
":args",
|
||||
":transformer_ops",
|
||||
"//base",
|
||||
"//compression:compress",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:matvec",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:nanobenchmark", # timer
|
||||
# copybara:import_next_line:hwy
|
||||
"//:profiler",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
":sentencepiece_processor",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "gemma",
|
||||
srcs = [
|
||||
"run.cc",
|
||||
],
|
||||
deps = [
|
||||
":app",
|
||||
":args",
|
||||
":gemma_lib",
|
||||
"//compression:compress",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:nanobenchmark",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:profiler",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
# Weight compression, I/O and analysis
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//third_party/gemma_cpp:license"],
|
||||
default_visibility = [
|
||||
"//learning/gemini/prod/contrib/gemini_cpp:__subpackages__",
|
||||
"//third_party/gemma_cpp:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "blob_store",
|
||||
srcs = [
|
||||
"blob_store.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"blob_store.h",
|
||||
],
|
||||
deps = [
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "stats",
|
||||
srcs = [
|
||||
"stats.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"distortion.h",
|
||||
"stats.h",
|
||||
],
|
||||
deps = [
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sfp",
|
||||
hdrs = [
|
||||
"sfp.h",
|
||||
],
|
||||
textual_hdrs = [
|
||||
"sfp-inl.h",
|
||||
],
|
||||
deps = [
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "sfp_test",
|
||||
size = "small",
|
||||
srcs = ["sfp_test.cc"],
|
||||
features = ["fully_static_link"],
|
||||
linkstatic = True,
|
||||
local_defines = ["HWY_IS_TEST"],
|
||||
# for test_suite.
|
||||
tags = ["hwy_ops_test"],
|
||||
deps = [
|
||||
":sfp",
|
||||
":stats",
|
||||
"//testing/base/public:gunit_main_no_google3",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy_test_util",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:nanobenchmark",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "nuq",
|
||||
hdrs = [
|
||||
"nuq.h",
|
||||
],
|
||||
textual_hdrs = [
|
||||
"nuq-inl.h",
|
||||
],
|
||||
deps = [
|
||||
":sfp",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
"//third_party/highway/hwy/contrib/sort:vqsort",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "nuq_test",
|
||||
size = "small",
|
||||
srcs = ["nuq_test.cc"],
|
||||
features = ["fully_static_link"],
|
||||
linkstatic = True,
|
||||
local_defines = ["HWY_IS_TEST"],
|
||||
# for test_suite.
|
||||
tags = ["hwy_ops_test"],
|
||||
deps = [
|
||||
":nuq",
|
||||
":sfp",
|
||||
":stats",
|
||||
"//testing/base/public:gunit_main_no_google3",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy_test_util",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:nanobenchmark",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "compress",
|
||||
hdrs = [
|
||||
"compress.h",
|
||||
"nuq.h",
|
||||
"sfp.h",
|
||||
],
|
||||
textual_hdrs = [
|
||||
"compress-inl.h",
|
||||
],
|
||||
deps = [
|
||||
":blob_store",
|
||||
":nuq",
|
||||
":sfp",
|
||||
":stats",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:dot",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
],
|
||||
)
|
||||
|
||||
# For internal experimentation
|
||||
cc_library(
|
||||
name = "analyze",
|
||||
textual_hdrs = [
|
||||
"analyze.h",
|
||||
],
|
||||
deps = [
|
||||
":nuq",
|
||||
":sfp",
|
||||
":stats",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:hwy",
|
||||
# copybara:import_next_line:hwy
|
||||
"//:nanobenchmark", # timer
|
||||
# copybara:import_next_line:hwy
|
||||
"//:thread_pool",
|
||||
"//third_party/highway/hwy/contrib/sort:vqsort",
|
||||
],
|
||||
)
|
||||
3
gemma.cc
3
gemma.cc
|
|
@ -60,8 +60,7 @@
|
|||
#include "hwy/aligned_allocator.h"
|
||||
#include "hwy/base.h"
|
||||
#include "hwy/contrib/thread_pool/thread_pool.h"
|
||||
// copybara:import_next_line:sentencepiece
|
||||
#include "src/sentencepiece_processor.h"
|
||||
#include "sentencepiece_processor.h"
|
||||
|
||||
namespace gcpp {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue