Initial upload via tools/push_to_hf.py (architecture: ilex.models.swift.SwiFT)
Browse files- README.md +94 -0
- config.json +82 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: ilex
|
| 3 |
+
tags:
|
| 4 |
+
- jax
|
| 5 |
+
- equinox
|
| 6 |
+
- ilex
|
| 7 |
+
- neuroimaging
|
| 8 |
+
- fmri
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
license_link: https://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# SwiFT (4D Swin fMRI Transformer, Mamba-free predecessor of NeuroSTORM) -- SwiFT HCP-YA sex-classification fine-tune backbone
|
| 14 |
+
|
| 15 |
+
## Description
|
| 16 |
+
|
| 17 |
+
SwiFT (Kim, Kwon, Moon, Cha et al., arXiv:2307.05916) is a 4D
|
| 18 |
+
Swin Transformer for fMRI BOLD volumes. The architecture is the
|
| 19 |
+
Mamba-free predecessor of NeuroSTORM -- same 4-stage Swin
|
| 20 |
+
topology (depths [2, 2, 6, 2], channels [36, 72, 144, 288],
|
| 21 |
+
4D window [4, 4, 4, 4]) but using conventional WindowAttention4D
|
| 22 |
+
multi-head self-attention as the per-window mixer instead of
|
| 23 |
+
NeuroSTORM's Mamba selective-scan SSM.
|
| 24 |
+
|
| 25 |
+
v0 ships two variants:
|
| 26 |
+
|
| 27 |
+
* ``contrastive`` -- the contrastive-pretraining checkpoint
|
| 28 |
+
(SimCLR-style backbone trained on a multi-cohort fMRI corpus).
|
| 29 |
+
Use as a frozen feature extractor for downstream tasks.
|
| 30 |
+
* ``hcp-sex`` -- the supervised fine-tune on HCP-YA sex
|
| 31 |
+
classification. Same architecture as `contrastive`; weights
|
| 32 |
+
have been further fine-tuned end-to-end. Use as a starting
|
| 33 |
+
point for additional fine-tuning or as an HCP-specific feature
|
| 34 |
+
extractor.
|
| 35 |
+
|
| 36 |
+
The bundle stores only the backbone (``SwinTransformer4D``) --
|
| 37 |
+
the consumer-side SimCLR projection (``emb_mlp``) and the
|
| 38 |
+
downstream task heads (``clf.head``, ``reg.head``) are training-
|
| 39 |
+
time plumbing and are dropped at extract.
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
## Intended use
|
| 43 |
+
|
| 44 |
+
HCP-YA sex-classification fine-tuned variant. Same backbone topology as the contrastive variant; the weights have been further fine-tuned on the supervised classification task. Use as an HCP-specific feature extractor OR as initialisation for additional fine-tuning. The classifier head (clf.head) is NOT in the bundle -- add your own downstream MLP on the (288, 2, 2, 2, 20) backbone embedding.
|
| 45 |
+
|
| 46 |
+
## Usage
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from ilex.models.swift import SwiFT
|
| 50 |
+
model = SwiFT.from_pretrained('ilex-hub/swift.hcp-sex.1')
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Authors
|
| 54 |
+
|
| 55 |
+
Kim P. Y., Kwon J., Moon T., Cha J. (Seoul National University M.IN.D Lab + Connectome Lab)
|
| 56 |
+
|
| 57 |
+
## Citation
|
| 58 |
+
|
| 59 |
+
Kim P. Y., Kwon J., Moon T., Cha J. et al. (2023). SwiFT -- Swin 4D fMRI Transformer. arXiv 2307.05916.
|
| 60 |
+
|
| 61 |
+
### References
|
| 62 |
+
|
| 63 |
+
- Kim P. Y., Kwon J., Moon T., Cha J. et al. (2023). SwiFT -- Swin 4D fMRI Transformer. arXiv:2307.05916.
|
| 64 |
+
- Liu Z. et al. (2021). Swin Transformer -- Hierarchical Vision Transformer using Shifted Windows. arXiv:2103.14030.
|
| 65 |
+
- Upstream code + weights -- github.com/Transconnectome/SwiFT (Apache-2.0).
|
| 66 |
+
|
| 67 |
+
## License
|
| 68 |
+
|
| 69 |
+
HF Hub license tag: `apache-2.0`
|
| 70 |
+
|
| 71 |
+
**Effective terms:** Apache-2.0 (both upstream code and the in-tree pretrained .ckpt checkpoints at github.com/Transconnectome/SwiFT). The ilex JAX / Equinox port code is separately Apache-2.0 / GPL-3.0.
|
| 72 |
+
|
| 73 |
+
Upstream license reference: https://www.apache.org/licenses/LICENSE-2.0
|
| 74 |
+
|
| 75 |
+
### Copyright
|
| 76 |
+
|
| 77 |
+
SwiFT is copyright (c) Transconnectome / Seoul National
|
| 78 |
+
University 2023, Apache-2.0-licensed on the upstream code +
|
| 79 |
+
the in-tree pretrained checkpoints
|
| 80 |
+
(github.com/Transconnectome/SwiFT). The ilex JAX / Equinox port
|
| 81 |
+
code is separately licensed under Apache-2.0 / GPL-3.0.
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
## Upstream source
|
| 85 |
+
|
| 86 |
+
Original weights / reference implementation: https://github.com/Transconnectome/SwiFT
|
| 87 |
+
|
| 88 |
+
## Provenance
|
| 89 |
+
|
| 90 |
+
This artefact was produced by [ilex](https://github.com/hypercoil/ilex)'s
|
| 91 |
+
save/load pipeline. The architecture is implemented in
|
| 92 |
+
`ilex.models.swift.SwiFT` and the weights have been converted
|
| 93 |
+
from their upstream format. See the upstream source above
|
| 94 |
+
for the canonical reference.
|
config.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_ilex": {
|
| 3 |
+
"architecture": "ilex.models.swift.model.SwiFT",
|
| 4 |
+
"constructor_kwargs": {
|
| 5 |
+
"c_multiplier": 2,
|
| 6 |
+
"depths": [
|
| 7 |
+
2,
|
| 8 |
+
2,
|
| 9 |
+
6,
|
| 10 |
+
2
|
| 11 |
+
],
|
| 12 |
+
"embed_dim": 36,
|
| 13 |
+
"first_window_size": [
|
| 14 |
+
4,
|
| 15 |
+
4,
|
| 16 |
+
4,
|
| 17 |
+
4
|
| 18 |
+
],
|
| 19 |
+
"img_size": [
|
| 20 |
+
96,
|
| 21 |
+
96,
|
| 22 |
+
96,
|
| 23 |
+
20
|
| 24 |
+
],
|
| 25 |
+
"in_chans": 1,
|
| 26 |
+
"last_layer_full_MSA": true,
|
| 27 |
+
"num_heads": [
|
| 28 |
+
3,
|
| 29 |
+
6,
|
| 30 |
+
12,
|
| 31 |
+
24
|
| 32 |
+
],
|
| 33 |
+
"patch_size": [
|
| 34 |
+
6,
|
| 35 |
+
6,
|
| 36 |
+
6,
|
| 37 |
+
1
|
| 38 |
+
],
|
| 39 |
+
"window_size": [
|
| 40 |
+
4,
|
| 41 |
+
4,
|
| 42 |
+
4,
|
| 43 |
+
4
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
"format": "ilex",
|
| 47 |
+
"framework_version": {
|
| 48 |
+
"equinox": "0.13.8",
|
| 49 |
+
"ilex": "0.0.0.dev0",
|
| 50 |
+
"jax": "0.10.0",
|
| 51 |
+
"jaxlib": "0.10.0",
|
| 52 |
+
"numpy": "2.4.4",
|
| 53 |
+
"safetensors": "0.7.0"
|
| 54 |
+
},
|
| 55 |
+
"has_state": false,
|
| 56 |
+
"origin": "ilex-native",
|
| 57 |
+
"weights_status": "bundled"
|
| 58 |
+
},
|
| 59 |
+
"authors": "Kim P. Y., Kwon J., Moon T., Cha J. (Seoul National University M.IN.D Lab + Connectome Lab)",
|
| 60 |
+
"copyright": "SwiFT is copyright (c) Transconnectome / Seoul National\nUniversity 2023, Apache-2.0-licensed on the upstream code +\nthe in-tree pretrained checkpoints\n(github.com/Transconnectome/SwiFT). The ilex JAX / Equinox port\ncode is separately licensed under Apache-2.0 / GPL-3.0.\n",
|
| 61 |
+
"data_type": "image",
|
| 62 |
+
"description": "SwiFT (Kim, Kwon, Moon, Cha et al., arXiv:2307.05916) is a 4D\nSwin Transformer for fMRI BOLD volumes. The architecture is the\nMamba-free predecessor of NeuroSTORM -- same 4-stage Swin\ntopology (depths [2, 2, 6, 2], channels [36, 72, 144, 288],\n4D window [4, 4, 4, 4]) but using conventional WindowAttention4D\nmulti-head self-attention as the per-window mixer instead of\nNeuroSTORM's Mamba selective-scan SSM.\n\nv0 ships two variants:\n\n* ``contrastive`` -- the contrastive-pretraining checkpoint\n (SimCLR-style backbone trained on a multi-cohort fMRI corpus).\n Use as a frozen feature extractor for downstream tasks.\n* ``hcp-sex`` -- the supervised fine-tune on HCP-YA sex\n classification. Same architecture as `contrastive`; weights\n have been further fine-tuned end-to-end. Use as a starting\n point for additional fine-tuning or as an HCP-specific feature\n extractor.\n\nThe bundle stores only the backbone (``SwinTransformer4D``) --\nthe consumer-side SimCLR projection (``emb_mlp``) and the\ndownstream task heads (``clf.head``, ``reg.head``) are training-\ntime plumbing and are dropped at extract.\n",
|
| 63 |
+
"equinox_version": "0.13.8",
|
| 64 |
+
"ilex_version": "0.0.0.dev0",
|
| 65 |
+
"image_classes": "Inputs are 4D fMRI BOLD volumes (channels-first per-sample\n``(1, 96, 96, 96, 20)`` -- 1 channel, 96^3 MNI152 brain voxels,\n20 time frames per clip). Preprocessing is consumer-side per\nthe upstream's pipeline.\n",
|
| 66 |
+
"intended_use": "Research use for fMRI BOLD analysis where the consumer wants a\nlearned representation of a 4D volume rather than hand-engineered\nfeatures. Typical downstream consumers:\n\n* Phenotype regression (sex, age, IQ, cognitive measures) via a\n linear probe on the backbone embedding.\n* Disease classification (HCP-YA, ABCD-derived tasks) via the\n `hcp-sex` variant as initialisation.\n* Self-supervised representation comparisons against NeuroSTORM\n (the Mamba-augmented successor) for ablation studies.\n\nThe ilex port wraps the JAX backbone forward only; consumers\nown the upstream's preprocessing pipeline (MNI152 registration,\n``(96, 96, 96)`` resampling, normalisation, 20-frame clips).\nThe bundle ships ``model.norm`` and ``model.head`` Linear\nparameters as static fields for state-dict round-trip integrity\nbut the JAX ``__call__`` does NOT invoke them -- matching the\nupstream ``SwinTransformer4D.forward`` which returns the deepest-\nstage feature map directly.\n\nNot a clinical diagnostic tool.\n",
|
| 67 |
+
"jax_version": "0.10.0",
|
| 68 |
+
"network_data_format": {
|
| 69 |
+
"inputs": {},
|
| 70 |
+
"outputs": {}
|
| 71 |
+
},
|
| 72 |
+
"numpy_version": "2.4.4",
|
| 73 |
+
"pred_classes": "Output is the deepest-stage backbone feature map\n``(288, 2, 2, 2, 20)`` -- a per-clip, channels-first 4D\nrepresentation suitable for downstream task heads (linear probe,\nattention pool, MLP regression / classification). Consumers\ncan chain the bundle's stored ``model.norm`` + a custom head\nfor inference per the upstream's ``clf_mlp`` / ``reg_mlp``\npattern.\n",
|
| 74 |
+
"references": [
|
| 75 |
+
"Kim P. Y., Kwon J., Moon T., Cha J. et al. (2023). SwiFT -- Swin 4D fMRI Transformer. arXiv:2307.05916.",
|
| 76 |
+
"Liu Z. et al. (2021). Swin Transformer -- Hierarchical Vision Transformer using Shifted Windows. arXiv:2103.14030.",
|
| 77 |
+
"Upstream code + weights -- github.com/Transconnectome/SwiFT (Apache-2.0)."
|
| 78 |
+
],
|
| 79 |
+
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json",
|
| 80 |
+
"task": "fMRI representation learning + downstream prediction via a 4D Swin Transformer backbone (the Mamba-free predecessor of NeuroSTORM)",
|
| 81 |
+
"version": "0.0.0"
|
| 82 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6296a3469379003e4c8f893c1b564188239310e06314c4e19da15987caa3f30
|
| 3 |
+
size 17278420
|