Skip to content

Commit 9cef07d

Browse files
authored
[Benchmarks] fix: lcm benchmarking reporting (#6198)
* fix: lcm benchmarking reporting * fix generate_csv_dict call.
1 parent 2d94c78 commit 9cef07d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

benchmarks/base_classes.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,25 @@ def run_inference(self, pipe, args):
162162
guidance_scale=1.0,
163163
)
164164

165+
def benchmark(self, args):
166+
flush()
167+
168+
print(f"[INFO] {self.pipe.__class__.__name__}: Running benchmark with: {vars(args)}\n")
169+
170+
time = benchmark_fn(self.run_inference, self.pipe, args) # in seconds.
171+
memory = bytes_to_giga_bytes(torch.cuda.max_memory_allocated()) # in GBs.
172+
benchmark_info = BenchmarkInfo(time=time, memory=memory)
173+
174+
pipeline_class_name = str(self.pipe.__class__.__name__)
175+
flush()
176+
csv_dict = generate_csv_dict(
177+
pipeline_cls=pipeline_class_name, ckpt=self.lora_id, args=args, benchmark_info=benchmark_info
178+
)
179+
filepath = self.get_result_filepath(args)
180+
write_to_csv(filepath, csv_dict)
181+
print(f"Logs written to: {filepath}")
182+
flush()
183+
165184

166185
class ImageToImageBenchmark(TextToImageBenchmark):
167186
pipeline_class = AutoPipelineForImage2Image

0 commit comments

Comments
 (0)