-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from yirongjie/main
perf: add AArch64 GEMM/GEMV for q4_0.
- Loading branch information
Showing
81 changed files
with
4,913 additions
and
1,232 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
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
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 |
---|---|---|
|
@@ -118,9 +118,10 @@ NetTensor *Attention(Context *c,NetTensor *x, int embedding_size, int hidden_siz | |
auto *qk = _Matmul( {q, k}, false, true, name + ".qk"); | ||
qk = *qk/std::sqrt(hidden_size); | ||
if(name.find("text") != std::string::npos){ | ||
qk = _Causalmask( {qk}, name + ".mask"); | ||
qk = _Softmax( {qk}, DIMENSION, true, name + ".softmax"); | ||
} else{ | ||
qk = _Softmax( {qk}, DIMENSION, false, name + ".softmax"); | ||
} | ||
qk = _Softmax( {qk}, DIMENSION, name + ".softmax"); | ||
auto *o = _Matmul( {qk, v}, false, false, name + ".qkv"); | ||
o = o->view(-1, 1, -1, hidden_size * head_size); | ||
o = _Linear( {o}, hidden_size * head_size, embedding_size, true, name + ".out_proj"); | ||
|
@@ -227,10 +228,10 @@ void ImageBind(Context* c) { | |
a = a->transpose(BATCH, SEQUENCE); | ||
|
||
auto *j1 = _Matmul( {p, i}, false, true, "final.vision@text"); | ||
j1 = _Softmax( {j1}, DIMENSION, "[email protected]"); | ||
j1 = _Softmax( {j1}, DIMENSION, false, "[email protected]"); | ||
|
||
auto *j2 = _Matmul( {p, a}, false, true, "final.vision@audio"); | ||
j2 = _Softmax( {j2}, DIMENSION, "[email protected]"); | ||
j2 = _Softmax( {j2}, DIMENSION, false, "[email protected]"); | ||
|
||
i = _Cat( {j1, j2}, BATCH, "final.cat"); | ||
} | ||
|
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.