Add CPUBone model#2718
Conversation
also enable gradient checkpointing, forward_intermediates
|
@Krystex thx, the timm impl looks in decent shape. Did you verify equivalence to original across all model scales? Does it reproduce imagenet-1k eval numbers? |
altair199797
left a comment
There was a problem hiding this comment.
Hi,
author here. Looks good, I see no problems. To be sure we'd need to evaluate ImageNet accuracy.
And thanks again for doing that!:D
Best Regards
|
So, I took a closer look, reproduced evals in float32 and looked at timm API compat. That checked out. But use with autocast fails, especially bfloat16 which resulted in complete collapse. I thought it might be an attention logits overflow, similar to EfficientViT-MIT but it's not. So I tasked codex to isolate the cause of the collapse... it found the issue. There's a corresponding float32 forced region that works around, but I feel it is still going to be problematic for downstream use, fine-tune, etc and likely not going to end up being used extensively in CPU or mobile scenarios where further quantization, low prec operation is often the norm... Codex' summary here, a bit more inflammatory than warranted, but it covers the key points: The architecture permits a genuinely ill-conditioned representation. The problematic local branch is expand conv + bias + Hardswish → depthwise conv + bias + Hardswish → pointwise conv → BatchNorm, with no normalization before the final projection. In the trained B0/B1 weights, that That is partly structural and partly learned:
So the fp32 island is a compatibility safeguard, not proof the architecture is naturally AMP-robust. Fixing the underlying design would mean changing normalization/bias placement or training regularization and |
|
This was a recommended architectural change to potential avoid the awkward numerics, though would require retrain to confirm / fix. |
Hi there!
In this PR I want to add the CPUBone by Nottebaum et al. to timm. Disclaimer: I'm not the author of the paper.
I took the reference implementation, cleaned it up and integrated it into the timm library so it can be easily loaded with
timm.create_model('cpubone_b0').There are still some minor cleanups to do, but I think this first draft is ready for a review by the original author.