Modelscript from segformer b0

I would like to know the modelscript.alls used to optimize and compile segformer b0 for Hailo8, the model on HailoModelZoo under segmentation models.

Here is more details of the model
https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.18.0/hailo8/segformer_b0_bn_profiler_results_compiled.html#/model-details

Here is the modelscript files I am using based on what I could understand from model details

normalization199 = normalization([ 123.675, 116.28, 103.53], [58.395, 57.12, 57.375])
model_optimization_flavor(optimization_level=2,compression_level=0)
model_optimization_config(calibration, batch_size=2, calibset_size=64)
context_switch_param(mode=allowed)
allocator_param(timeout=15h)

As input I am using segformer_b0_512x1024.onnx file available on model zoo repo and I also know that there was another post where the user managed to compile it by resizing it down, but according to model zoo info dev team from Hailo did not had to resize.

I am using hailo dfc 3.28 and as far as I understand this model was compiled on hailo dataflow compiler 2.18

Compilation fails on trying to map the Context 12/12

One of the outputs I got(this was with timeout=3h but with timeout=15h also it failed on the same way)
[warning] Failed recording best-effort buffers: l4_portal_from_resize3_d0_to_resize3_dc was not found in toposort recipe during buffers override record [error] Mapping Failed (Timeout, allocation time: 3h 19m 11s) [error] Mapping Failed (Timeout, allocation time: 3h 19m 11s) Resolver didn’t find possible solution. Watchdog expired after 3h 0m 2s Mapping Failed (Timeout, allocation time: 3h 19m 11s) [error] Failed to produce compiled graph .

So could someone share modelscript.alls used for this model in particular ?

Hi @Douglas_Silva,

With DFC 3.28: if you’re using model_optimization_flavor(optimization_level=2) , you cannot also specify manual resources_param - the compiler will reject it. The Model Zoo HEF was compiled on DFC 2.18, which had a different compiler backend, so a model that fit on 2.18 may need tuning on 3.28.
To work around the context 12/12 mapping timeout, try:

  1. Increase the timeout with allocator_param(timeout=25h).
  2. If that’s still not enough, drop to model_optimization_flavor(optimization_level=1, compression_level=0) which then allows you to add resources_param(max_control_utilization=0.6, max_compute_utilization=0.6) to help the allocator find a valid mapping.
  3. If it still fails, try reducing input resolution (e.g., 512x512).

Thanks,