Menu

1 / 2

Why a Keras model fails to convert to TFLite: 11 known cases, 5 traps

DEV Community: pytorch·Rahul Kumar·about 22 hours ago
#4N2N9EiR
#devtopytorch#devto#dev#export#keras
Reading 0:00
15s threshold

KerasHub, the Keras library of pretrained models, expects 11 of its own models to fail the export to LiteRT (the new

name of TensorFlow Lite), and its tests say why in one line each. Here are all 11, the five traps they fall into, and

what to write instead.

I contribute to Keras and KerasHub. The change that switched these export tests back on for the PyTorch backend,

keras-hub#2698 , is mine.

The 11, in KerasHub's own words

An expected failure is a test marked to fail until an upstream fix lands; when the fix lands, the test turns loud

instead of silently passing. Each name links to its line in the tests:

Model Trap The test's own reason

D-Fine 2. One shape "D-FINE's multi-scale features hit a torch.export shape guard."

Flux 2. One shape "torch.export guard from Flux's dynamic num_heads reshape."

F-Net 3. No lowering "litert-torch has no lowering for aten.complex (from ops.fft2)."

GPT-OSS 3. No lowering "litert-torch NHWC rewriter has no lowering for aten.amax."

Mixtral 3.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.