Skip to content

Commit

Permalink
fix llama2 test.
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz committed Apr 26, 2024
1 parent 4e1b509 commit b095f78
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/llama2-tasks-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ float expectedOutput[4096] = {
1.00493455, 1.00216055, 1.02500832, 1.01412213, 0.997673035, 1.01922369, 1.01705575, 1.01369667,
};

void nop(TASK_ARGS) {}

int main() {
TransformerSpec spec;
spec.headerSize = sizeof(TransformerFileOldHeader) + sizeof(int);
Expand All @@ -542,6 +544,8 @@ int main() {
spec.weightsFloatType = F32;
spec.bufferFloatType = F32;
spec.nSlices = 1;
spec.hiddenAct = GELU;
spec.ropeTheta = 10000.0f;

size_t beforeBlockBytes = /* embedding */ 524288000;
size_t blockBytes = 809533440;
Expand All @@ -567,8 +571,11 @@ int main() {
for (int i = 0; i < spec.dim; i++) x[i] = randomF32(&state) / 120.0;

TransformerArch arch = buildLlama2Arch(&spec);
arch.inference.tasks[arch.inference.nTasks - 3].handler = &nop;
arch.inference.tasks[arch.inference.nTasks - 2].handler = &nop;
arch.inference.tasks[arch.inference.nTasks - 1].handler = &nop;

int nThreads = 4;
int nThreads = 1;
TransformerContext context;
context.transformer = &transformer;
context.currentBlockIndex = 0;
Expand Down

0 comments on commit b095f78

Please sign in to comment.