Skip to content

Bamba architecture #10810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 43 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1f0fea7
llama : initial Mamba-2 support
compilade Aug 1, 2024
dceff23
ggml : SIMD ggml_ssm_scan for Mamba-2
compilade Aug 19, 2024
2bfe9de
llama : support running Mamba-Codestral-7B-v0.1
compilade Aug 19, 2024
aff9692
llama : fix Mamba-2 conv state saving
compilade Aug 21, 2024
e04910d
llama : remove unused variable
compilade Aug 22, 2024
fa358e7
llama : add missing break
compilade Aug 22, 2024
38913dc
convert_hf : prefer SentencePiece tokenizer for Mamba-2 when present
compilade Aug 22, 2024
0e601ca
Merge branch 'master' into compilade/mamba2
compilade Sep 18, 2024
273e7a4
llama : avoid redundant state copy for Mamba 1 and 2
compilade Sep 30, 2024
7d6cb36
Merge branch 'master' into compilade/mamba2
compilade Oct 1, 2024
2c77d79
metal : attempt to adapt SSM_SCAN for Mamba-2
compilade Oct 2, 2024
87b97d0
metal : fix SSM_SCAN pipeline scope
compilade Oct 2, 2024
03d0e6e
metal : use log and exp instead of log1pf and expf in SSM_SCAN
compilade Oct 2, 2024
7a351ab
metal : remove unused arguments for SSM_SCAN
compilade Oct 2, 2024
8b15bc6
metal : add back n_seqs to SSM_SCAN args
compilade Oct 2, 2024
5b8ec2b
metal : fix SSM_SCAN state head offset
compilade Oct 2, 2024
62b09b3
metal : fix wrong number of tokens per sequence in SSM_SCAN
compilade Oct 3, 2024
038d958
Merge branch 'master' into compilade/mamba2
compilade Oct 12, 2024
805512a
ggml : remove unused fast broadcast path in GGML_MUL
compilade Oct 12, 2024
7d16e1b
Merge branch 'master' into compilade/mamba2
compilade Nov 1, 2024
3bc7103
ggml : avoid multiply by D in GGML_OP_SSM_SCAN
compilade Nov 4, 2024
8d8f065
Merge branch 'master' into compilade/mamba2
compilade Nov 4, 2024
b4e9c59
convert : fix flake8 lint
compilade Nov 4, 2024
1ee6c48
Merge branch 'master' into compilade/mamba2
compilade Nov 25, 2024
9a68f75
feat(jamba): First pass at GGUF conversion for Jamba models
gabe-l-hart Nov 26, 2024
246dfdb
feat(jamba): Add jamba architecture to llama.cpp enums
gabe-l-hart Nov 26, 2024
e3525e9
feat(convert): Full pass at hparam conversion
gabe-l-hart Dec 2, 2024
fd98682
fix(bamba conv): Jamba -> Bamba
gabe-l-hart Dec 3, 2024
1c1e008
fix(bamba): Jamba->Bamba in llama.cpp
gabe-l-hart Dec 3, 2024
e0af809
feat(bamba): hparam parsing in llama.cpp
gabe-l-hart Dec 3, 2024
fd3bb30
fix(bamba conv): Fizes in tensor name and hparam conversion for llama…
gabe-l-hart Dec 4, 2024
3ee0ae3
feat(bamba): Full tensor parsing for bamba
gabe-l-hart Dec 4, 2024
dfe8d3d
fix(bamba conv): Remove chunk size and consolidate head count w/ time…
gabe-l-hart Dec 5, 2024
41fc019
fix(bamba): Remove ssm_head_count and ssm_chunk_size in llama.cpp
gabe-l-hart Dec 5, 2024
e7b1abb
feat(bamba): Partially complete work on constructing the forward graph
gabe-l-hart Dec 5, 2024
f2478bc
fix: Get n_head_kv per-layer in build_bamba
gabe-l-hart Dec 9, 2024
d3a34e0
fix: per-layer recurrent embd_[kv]_s
gabe-l-hart Dec 9, 2024
92653d0
WIP: Partial work towards separate hybrid cache
gabe-l-hart Dec 9, 2024
44bf431
fix: Only allocate kv cache tensors for the appropriate layers in hyb…
gabe-l-hart Dec 10, 2024
4543ed5
feat: Update the logic in llama_decode_internal for kv_hybrid cache
gabe-l-hart Dec 10, 2024
204e78f
fix: A number of places where hybrid needs to be handled
gabe-l-hart Dec 10, 2024
97e6ba8
fix: Remove outdated TODO in convrsion script
gabe-l-hart Dec 12, 2024
b83e9a6
fix: Remove unused LLM_KV_ATTENTION_LAYER_COUNT
gabe-l-hart Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ggml : remove unused fast broadcast path in GGML_MUL
This was initially added because states were masked with ggml_mul,
but this is no longer done and so this "optimisation" is no longer
necessary, or at least not worth the additional code complexity.
  • Loading branch information
compilade committed Oct 12, 2024
commit 805512a73b9876853f0e7d0cd612259806fa5d93
32 changes: 1 addition & 31 deletions ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -10173,37 +10173,7 @@ static void ggml_compute_forward_mul_f32(
GGML_ASSERT( nb0 == sizeof(float));
GGML_ASSERT(nb00 == sizeof(float));

if (ne00 > 1 && ne10 == 1) {
// fast broadcast path
for (int64_t ir = ith; ir < nr; ir += nth) {
// src0 and dst are same shape => same indices
const int64_t i03 = ir/(ne02*ne01);
const int64_t i02 = (ir - i03*ne02*ne01)/ne01;
const int64_t i01 = (ir - i03*ne02*ne01 - i02*ne01);

const int64_t i13 = i03 % ne13;
const int64_t i12 = i02 % ne12;
const int64_t i11 = i01 % ne11;

float * src1_ptr = (float *) ((char *) src1->data + i13*nb13 + i12*nb12 + i11*nb11);

const float scale = src1_ptr[0];

if (scale == 0.0f) {
// NOTE: this also sets NANs to zero, which is not compliant with IEEE754,
// but it is useful when resetting the state of recurrent models.
memset((char *) dst->data + ir*nb1, 0, ne0 * sizeof(float));
} else {
if (dst->data != src0->data) {
// src0 is same shape as dst => same indices
memcpy((char *) dst->data + ir*nb1, (char *) src0->data + ir*nb01, ne0 * sizeof(float));
}
if (scale != 1.0f) {
ggml_vec_scale_f32(ne0, (float *) ((char *) dst->data + ir*nb1), scale);
}
}
}
} else if (nb10 == sizeof(float)) {
if (nb10 == sizeof(float)) {
for (int64_t ir = ith; ir < nr; ir += nth) {
// src0 and dst are same shape => same indices
const int64_t i03 = ir/(ne02*ne01);
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy