Skip to content

Commit 1efda42

Browse files
committed
Clean up code
1 parent b2ad660 commit 1efda42

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

extension/android/jni/jni_layer_llama.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ bool utf8_check_validity(const char* str, size_t length) {
3939
uint8_t byte = static_cast<uint8_t>(str[i]);
4040
if (byte >= 0x80) { // Non-ASCII byte
4141
if (i + 1 >= length) { // Incomplete sequence
42-
__android_log_print(ANDROID_LOG_ERROR, "ExecuTorchDBG", "Incomplete sequence");
4342
return false;
4443
}
4544
uint8_t next_byte = static_cast<uint8_t>(str[i + 1]);
@@ -50,10 +49,6 @@ bool utf8_check_validity(const char* str, size_t length) {
5049
} else if ((byte & 0xF8) == 0xF0 && (next_byte & 0xC0) == 0x80 && (i + 2 < length) && (static_cast<uint8_t>(str[i + 2]) & 0xC0) == 0x80 && (i + 3 < length) && (static_cast<uint8_t>(str[i + 3]) & 0xC0) == 0x80) { // 4-byte sequence
5150
i += 4;
5251
} else {
53-
__android_log_print(ANDROID_LOG_ERROR, "ExecuTorchDBG", "Invalid sequence");
54-
while(*str)
55-
__android_log_print(ANDROID_LOG_ERROR, "ExecuTorchDBGS", "%02x", (unsigned int) *str++);
56-
5752
return false; // Invalid sequence
5853
}
5954
}
@@ -79,7 +74,7 @@ class ExecuTorchLlamaCallbackJni
7974

8075
token_buffer += result;
8176
if (!utf8_check_validity(token_buffer.c_str(), token_buffer.size())) {
82-
__android_log_print(ANDROID_LOG_ERROR, "ExecuTorchDBG", "CONTINUEEEA:%zu", token_buffer.size());
77+
ET_LOG(Info, "Current token buffer is not valid UTF-8. Waiting for more.");
8378
return;
8479
}
8580
result = token_buffer;

0 commit comments

Comments
 (0)