Skip to content

Commit acb5375

Browse files
fixup! lookup: evaluation tools, use corpus/previous gens
1 parent 3106005 commit acb5375

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

common/ngram-cache.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ void llama_ngram_cache_update(llama_ngram_cache & ngram_cache, int ngram_min, in
3939
const long eta_min = eta_ms / (60*1000);
4040
const long eta_s = (eta_ms - 60*1000*eta_min) / 1000;
4141

42-
fprintf(stderr, "%s: %ld/%ld done, ETA: %02ld:%02ld\n", __func__, n_done, n_todo, eta_min, eta_s);
42+
// %02ld doesn't compile on Arm64 MacOS:
43+
std::string eta_string;
44+
eta_string += eta_min < 10 ? "0" : "";
45+
eta_string += std::to_string(eta_min);
46+
eta_string += ":";
47+
eta_string += eta_s < 10 ? "0" : "";
48+
eta_string += std::to_string(eta_s);
49+
fprintf(stderr, "%s: %ld/%ld done, ETA: %s\n", __func__, n_done, n_todo, eta_string.c_str());
4350
}
4451
}
4552
}

examples/lookup/lookup-stats.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char ** argv){
7373
int n_drafted = 0;
7474
int n_accept = 0;
7575

76-
const int64_t t_start_ms = ggml_time_ms();
76+
const long t_start_ms = ggml_time_ms();
7777

7878
// Iterate over input tokens in chunks of size n_ctx.
7979
// Each chunk is treated as if a sequential generation but with pre-determined tokens to ensure reproducibility.
@@ -127,12 +127,19 @@ int main(int argc, char ** argv){
127127

128128
}
129129
if (i_start > 0 && i_start / 100000 != (i_start - n_ctx) / 100000) {
130-
const int64_t t_now_ms = ggml_time_ms();
131-
const int64_t eta_ms = (n_input - i_start) * (t_now_ms - t_start_ms) / i_start;
132-
const int64_t eta_min = eta_ms / (60*1000);
133-
const int64_t eta_s = (eta_ms - 60*1000*eta_min) / 1000;
134-
135-
LOG_TEE("%d/%d done, ETA: %02ld:%02ld\n", i_start, n_input, eta_min, eta_s);
130+
const long t_now_ms = ggml_time_ms();
131+
const long eta_ms = (n_input - i_start) * (t_now_ms - t_start_ms) / i_start;
132+
const long eta_min = eta_ms / (60*1000);
133+
const long eta_s = (eta_ms - 60*1000*eta_min) / 1000;
134+
135+
// %02ld doesn't compile on Arm64 MacOS:
136+
std::string eta_string;
137+
eta_string += eta_min < 10 ? "0" : "";
138+
eta_string += std::to_string(eta_min);
139+
eta_string += ":";
140+
eta_string += eta_s < 10 ? "0" : "";
141+
eta_string += std::to_string(eta_s);
142+
LOG_TEE("lookup-stats: %d/%d done, ETA: %s\n", i_start, n_input, eta_string.c_str());
136143
}
137144

138145
// After each chunk, update the dynamic ngram cache with the context ngram cache:

0 commit comments

Comments
 (0)