Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
huydhn committed Aug 10, 2024
1 parent 56508c4 commit 51dfaf3
Showing 1 changed file with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
package com.example.executorchllamademo;

import static junit.framework.TestCase.assertTrue;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import android.os.Bundle;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import android.os.Bundle;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -39,23 +41,24 @@ public void testTokensPerSecond() {
// Find out the model name
File directory = new File(RESOURCE_PATH);
Arrays.stream(directory.listFiles())
.filter(file -> file.getName().endsWith(".pte") || file.getName().endsWith(".pt"))
.forEach(model -> {
LlamaModule mModule = new LlamaModule(model.getPath(), tokenizerPath, 0.8f);
// Print the model name because there might be more than one of them
report("ModelName", model.getName());

int loadResult = mModule.load();
// Check that the model can be load successfully
assertEquals(0, loadResult);

// Run a testing prompt
mModule.generate("How do you do! I'm testing llama2 on mobile device", PerfTest.this);
assertFalse(tokensPerSecond.isEmpty());

final Float tps = tokensPerSecond.get(tokensPerSecond.size() - 1);
reportMetric("TPS", tps);
});
.filter(file -> file.getName().endsWith(".pte") || file.getName().endsWith(".pt"))
.forEach(
model -> {
LlamaModule mModule = new LlamaModule(model.getPath(), tokenizerPath, 0.8f);
// Print the model name because there might be more than one of them
report("ModelName", model.getName());

int loadResult = mModule.load();
// Check that the model can be load successfully
assertEquals(0, loadResult);

// Run a testing prompt
mModule.generate("How do you do! I'm testing llama2 on mobile device", PerfTest.this);
assertFalse(tokensPerSecond.isEmpty());

final Float tps = tokensPerSecond.get(tokensPerSecond.size() - 1);
reportMetric("TPS", tps);
});
}

@Override
Expand Down

0 comments on commit 51dfaf3

Please sign in to comment.