Julia ports of [timm][timm] (PyTorch Image Models, by Ross Wightman) backbones
for [Lux.jl][lux], with pretrained weights loaded directly from HuggingFace Hub
in .safetensors format. The name is an homage to the project we port from.
Status
Most of Luximm was written by AI agents driving the porting workflow
encoded in skills/timm-to-lux/, with human
review at each phase and the parity tests as the correctness backstop.
The code is already being used in real projects, so the registered
backbones work for forward inference with the released weights. That
said: expect bugs and rough edges, especially around anything the
parity tests do not exercise (custom training loops, mixed-precision
paths, exotic input shapes). File issues and PRs.
For LLMs & Agents
This library ships agent skills. In Claude Code:
/plugin marketplace add csvance/Luximm.jl
/plugin install luximm
That installs timm-to-lux, the porting workflow behind this library
(converting PyTorch timm models into numerically-equivalent Lux.jl
implementations with parity-tested weight loading). It lives in
skills/ as plain Markdown.
Available backbones
| Family | Variant prefix | Weights | Weight License | Commercial Use |
|---|
| [ResNet][resnet] | [:resnet*][prefix-resnet] | 5 | [Apache 2.0][license-apache2] | ✅ |
| [SE-ResNet][seresnet] | [:seresnet*][prefix-seresnet] | 1 | [Apache 2.0][license-apache2] | ✅ |
| [BiT ResNetV2][bit] | [:resnetv2_*_bit_*][prefix-bit] | 15 | [Apache 2.0][license-apache2] | ✅ |
| [ConvNeXt][convnextv1] | [:convnext_*][prefix-convnext] | 19 | [Apache 2.0][license-apache2] | ✅ |
| [ConvNeXt (DINOv3)][dinov3] | [:convnext_*][prefix-convnext] | 4 | [DINOv3 License][license-dinov3] | ⚠️ |
| [ConvNeXt V2][convnextv2] | [:convnextv2_*][prefix-convnextv2] | 26 | [CC BY-NC 4.0][license-convnextv2] | ❌ |
| [VGG][vgg] | [:vgg*][prefix-vgg] | 8 | [CC BY 4.0][license-ccby4] | ✅ |
| [ViT][vit] | [:vit_*][prefix-vit] | 4 | [Apache 2.0][license-apache2] | ✅ |
| [CoAtNet][coatnet] | [:coatnet_*][prefix-coatnet] | 5 | [Apache 2.0][license-apache2] | ✅ |
Basic usage
using Luximm, Lux, Random
# ResNet50 with the trained 1000-class ImageNet head.
# `create_pretrained` is family-agnostic; the symbol selects the family.
# It returns the model and a closure that loads the released weights
# into `(ps, st)` once you've run `Lux.setup`.
model, load = create_pretrained(:resnet50_a1_in1k)
ps, st = Lux.setup(Xoshiro(0), model)
ps, st = load(ps, st)
st = Lux.testmode(st) # BatchNorm/Dropout in eval mode
x = randn(Float32, 224, 224, 3, 1)
logits, _ = model(x, ps, st) # (1000, 1)
top1 = argmax(vec(logits)) # ImageNet class index
create_model(variant; ...) (without weight loading) is also exported
for from-scratch training. For the full walkthrough, including
feature-extractor mode (num_classes = 0), single-channel inputs
(in_chans = 1), and the HuggingFace cache layout, see the
[Getting Started][docs-getting-started] docs page.
Composing with a pretrained backbone
Drop a feature-extractor backbone into your own @compact block and
let the loader fill in just the backbone's subtree. The
prefix = (:backbone,) tuple matches the slot name in the outer
model, so load_backbone writes only into ps.backbone.* and
st.backbone.*, leaving the head at its random initialization for
downstream training:
using Luximm, Lux, NNlib, Random
backbone, load_backbone = create_pretrained(:resnet50_a1_in1k;
num_classes = 0, prefix = (:backbone,))