9
9
import torch .utils .benchmark as benchmark
10
10
11
11
from diffusers .models .modeling_utils import ModelMixin
12
- from diffusers .utils import logging
13
12
from diffusers .utils .testing_utils import require_torch_gpu , torch_device
14
13
15
14
16
- logger = logging .get_logger (__name__ )
17
-
18
-
19
15
def benchmark_fn (f , * args , ** kwargs ):
20
16
t0 = benchmark .Timer (
21
17
stmt = "f(*args, **kwargs)" ,
@@ -105,7 +101,7 @@ def post_benchmark(self, model):
105
101
@torch .no_grad ()
106
102
def run_benchmark (self , scenario : BenchmarkScenario ):
107
103
# 0) Basic stats
108
- logger . info (f"Running scenario: { scenario .name } ." )
104
+ print (f"Running scenario: { scenario .name } ." )
109
105
model = model_init_fn (scenario .model_cls , ** scenario .model_init_kwargs )
110
106
num_params = round (calculate_params (model ) / 1e6 , 2 )
111
107
flops = round (calculate_flops (model , input_dict = scenario .get_model_input_dict ()) / 1e6 , 2 )
@@ -125,7 +121,7 @@ def run_benchmark(self, scenario: BenchmarkScenario):
125
121
compile_kwargs = None ,
126
122
)
127
123
except Exception as e :
128
- logger . error (f"Benchmark could not be run with the following error\n : { e } " )
124
+ print (f"Benchmark could not be run with the following error\n : { e } " )
129
125
return results
130
126
131
127
# 2) compiled stats (if any)
@@ -140,7 +136,7 @@ def run_benchmark(self, scenario: BenchmarkScenario):
140
136
compile_kwargs = scenario .compile_kwargs ,
141
137
)
142
138
except Exception as e :
143
- logger . error (f"Compilation benchmark could not be run with the following error\n : { e } " )
139
+ print (f"Compilation benchmark could not be run with the following error\n : { e } " )
144
140
if plain is None :
145
141
return results
146
142
@@ -170,10 +166,10 @@ def run_bencmarks_and_collate(self, scenarios: Union[BenchmarkScenario, list[Ben
170
166
try :
171
167
records .append (self .run_benchmark (s ))
172
168
except Exception as e :
173
- logger . error (f"Running scenario ({ s .name } ) led to error:\n { e } " )
169
+ print (f"Running scenario ({ s .name } ) led to error:\n { e } " )
174
170
df = pd .DataFrame .from_records ([r for r in records if r ])
175
171
df .to_csv (filename , index = False )
176
- logger . info (f"Results serialized to { filename = } ." )
172
+ print (f"Results serialized to { filename = } ." )
177
173
178
174
def _run_phase (
179
175
self ,
0 commit comments