mirror of https://github.com/google/gemma.cpp.git
Toward Bazel support: expose BUILD, add WORKSPACE/MODULE.bazel. Refs #16
PiperOrigin-RevId: 609734560
This commit is contained in:
parent
7c9954dea5
commit
a16df06cf2
|
|
@ -0,0 +1,14 @@
|
||||||
|
module(
|
||||||
|
name = "gemma",
|
||||||
|
version = "0.1.0",
|
||||||
|
)
|
||||||
|
|
||||||
|
bazel_dep(
|
||||||
|
name = "rules_license",
|
||||||
|
version = "0.0.7",
|
||||||
|
)
|
||||||
|
|
||||||
|
bazel_dep(
|
||||||
|
name = "com_google_sentencepiece",
|
||||||
|
version = "0.1.96",
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
workspace(name = "gemma")
|
||||||
|
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
http_archive,
|
||||||
|
name = "rules_license",
|
||||||
|
sha256 = "4531deccb913639c30e5c7512a054d5d875698daeb75d8cf90f284375fe7c360",
|
||||||
|
urls = [
|
||||||
|
"https://github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
http_archive,
|
||||||
|
name = "com_google_sentencepiece",
|
||||||
|
sha256 = "8409b0126ebd62b256c685d5757150cf7fcb2b92a2f2b98efb3f38fc36719754",
|
||||||
|
strip_prefix = "sentencepiece-0.1.96",
|
||||||
|
urls = ["https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip"],
|
||||||
|
build_file = "@//third_party:sentencepiece.bazel",
|
||||||
|
patches = ["@//third_party:com_google_sentencepiece.patch"],
|
||||||
|
patch_args = ["-p1"],
|
||||||
|
)
|
||||||
4
gemma.cc
4
gemma.cc
|
|
@ -62,7 +62,6 @@
|
||||||
#include "hwy/contrib/thread_pool/thread_pool.h"
|
#include "hwy/contrib/thread_pool/thread_pool.h"
|
||||||
// copybara:import_next_line:sentencepiece
|
// copybara:import_next_line:sentencepiece
|
||||||
#include "src/sentencepiece_processor.h"
|
#include "src/sentencepiece_processor.h"
|
||||||
// #include "third_party/sentencepiece/src/util.h"
|
|
||||||
|
|
||||||
namespace gcpp {
|
namespace gcpp {
|
||||||
|
|
||||||
|
|
@ -205,8 +204,7 @@ struct Activations {
|
||||||
static constexpr size_t kQKVDim = TConfig::kQKVDim;
|
static constexpr size_t kQKVDim = TConfig::kQKVDim;
|
||||||
static constexpr size_t kHeads = TConfig::kHeads;
|
static constexpr size_t kHeads = TConfig::kHeads;
|
||||||
static constexpr size_t kKVHeads = TConfig::kKVHeads;
|
static constexpr size_t kKVHeads = TConfig::kKVHeads;
|
||||||
static constexpr size_t kCachePosSize =
|
static constexpr size_t kCachePosSize = TConfig::kLayers * kKVHeads * kQKVDim;
|
||||||
TConfig::kLayers * kKVHeads * kQKVDim;
|
|
||||||
static constexpr size_t kCacheLayerSize = kKVHeads * kQKVDim;
|
static constexpr size_t kCacheLayerSize = kKVHeads * kQKVDim;
|
||||||
|
|
||||||
std::array<float, kBatchSize * kModelDim> x; // input
|
std::array<float, kBatchSize * kModelDim> x; // input
|
||||||
|
|
|
||||||
4
gemma.h
4
gemma.h
|
|
@ -24,11 +24,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// copybara:import_next_line:gemma_cpp
|
|
||||||
#include "configs.h" // kSeqLen
|
|
||||||
// copybara:import_next_line:gemma_cpp
|
// copybara:import_next_line:gemma_cpp
|
||||||
#include "compression/compress.h" // SfpStream/NuqStream
|
#include "compression/compress.h" // SfpStream/NuqStream
|
||||||
// copybara:import_next_line:gemma_cpp
|
// copybara:import_next_line:gemma_cpp
|
||||||
|
#include "configs.h" // kSeqLen
|
||||||
|
// copybara:import_next_line:gemma_cpp
|
||||||
#include "util/args.h" // ArgsBase
|
#include "util/args.h" // ArgsBase
|
||||||
#include "hwy/aligned_allocator.h"
|
#include "hwy/aligned_allocator.h"
|
||||||
#include "hwy/base.h" // hwy::bfloat16_t
|
#include "hwy/base.h" // hwy::bfloat16_t
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue