linear_quantize_activations taking 90 minutes + on MacBook Air M1 2020

In my quantization code, the line:

compressed_model_a8 = cto.coreml.experimental.linear_quantize_activations(
model, activation_config, [{'img':np.random.randn(1,13,1024,1024)}]
)

has taken 90 minutes to run so far and is still not completed. From debugging, I can see that the line it's stuck on is line 261 in _model_debugger.py:

model = ct.models.MLModel(
cloned_spec,
weights_dir=self.weights_dir,
compute_units=compute_units,
skip_model_load=False, # Don't skip model load as we need model prediction to get activations range.
)

Is this expected behaviour? Would it be quicker to run on another computer with more RAM?

My original model before quantization is 195MB

linear_quantize_activations taking 90 minutes + on MacBook Air M1 2020
 
 
Q