Julia ports of timm (PyTorch Image Models, by Ross Wightman) backbones
for Lux.jl, with pretrained weights loaded directly from HuggingFace Hub
in .safetensors format. The name is an homage to the project we port from.
Most of Luximm was written by AI agents driving the porting workflow
encoded in .claude/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.
| Family | Variant prefix | Weights | Weight License | Commercial Use |
|---|---|---|---|---|
| ResNet | :resnet* |
5 | Apache 2.0 | ✅ |
| BiT ResNetV2 | :resnetv2_*_bit_* |
15 | Apache 2.0 | ✅ |
| ConvNeXt | :convnext_* |
19 | Apache 2.0 | ✅ |
| ConvNeXt (DINOv3) | :convnext_* |
4 | DINOv3 License | |
| ConvNeXt V2 | :convnextv2_* |
26 | CC BY-NC 4.0 | ❌ |
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 indexcreate_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 page.
Luximm.jl is licensed under the Apache License, Version 2.0 (see
LICENSE and NOTICE). The license matches upstream
timm. The Julia code in this repository is original, but layer naming,
hyperparameters, padding ordering, and state_dict key layout are
deliberately taken from timm so pretrained weights load directly.
Thanks to Ross Wightman for timm, to HuggingFace for
hosting the .safetensors weights that Luximm.jl loads at runtime, to
the Julia ML ecosystem maintainers whose work makes a port like this
plausible, and to Medical Metrics Inc. for allowing
me to work on and open-source the project.