From 6ad3752b51bf6734e5fcb3e6e788413e9d08d998 Mon Sep 17 00:00:00 2001 From: Clemens Akens Date: Thu, 19 Oct 2023 18:09:17 +0200 Subject: [PATCH] Minor refactoring --- src/generator.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generator.zig b/src/generator.zig index 2ee61ac..34b521f 100644 --- a/src/generator.zig +++ b/src/generator.zig @@ -54,13 +54,13 @@ pub fn generate(self: *Self, writer: anytype) !void { var token: usize = bos_token; var next_token: usize = 0; var prompt_tokens_index: usize = 0; - var n_timed_steps: usize = 0; + var n_timed_positions: usize = 0; var start_time: i64 = 0; var total_time: i64 = 0; for (0..self.transformer.sequence_length) |position| { if (position > 0) { - n_timed_steps += 1; + n_timed_positions += 1; start_time = std.time.milliTimestamp(); } @@ -88,9 +88,9 @@ pub fn generate(self: *Self, writer: anytype) !void { token = next_token; } - if (n_timed_steps > 0 and self.verbose) { + if (n_timed_positions > 0 and self.verbose) { const average_time = - @as(f32, @floatFromInt(total_time)) / @as(f32, @floatFromInt(n_timed_steps)); + @as(f32, @floatFromInt(total_time)) / @as(f32, @floatFromInt(n_timed_positions)); try writer.print("\n\nachieved: {d:.3} tok/s", .{@as(f32, 1000 / average_time)}); }