dingdinggo commited on
Commit
949dd6f
·
verified ·
1 Parent(s): fcad190

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -0
README.md CHANGED
@@ -1,3 +1,124 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ library_name: pytorch
4
+ tags:
5
+ - multimodal
6
+ - in-context-learning
7
+ - foundation-model
8
+ - classification
9
+ - tabpfn
10
+ - pytorch
11
  ---
12
+
13
+ # Fusion Anything Model (FAM) — v1
14
+
15
+ [![Paper](https://img.shields.io/badge/arXiv-2609.22107-b31b1b.svg)](https://arxiv.org/abs/2609.22107)
16
+ [![GitHub](https://img.shields.io/badge/GitHub-Fusion__Anything__Model-181717.svg?logo=github)](https://github.com/huizi-Cui/Fusion_Anything_Model)
17
+ [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://github.com/huizi-Cui/Fusion_Anything_Model/blob/main/LICENSE)
18
+
19
+ This repository hosts the pretrained model checkpoint (`FAM.pt`) for **Fusion Anything: A Generalized Multimodal Foundation Model**.
20
+
21
+ ---
22
+
23
+ ## Model Overview
24
+
25
+ **Fusion Anything Model (FAM)** is a multimodal foundation model for generalized in-context classification across arbitrary combinations of modalities (e.g., vision, text, audio, and tabular features).
26
+
27
+ Trained on large-scale synthetic multimodal datasets generated with **Structural Multimodal Causal Models (SMCMs)**, FAM learns transferable multimodal correlation patterns during pretraining and activates task-relevant associations from labeled **Context** examples at inference time—predicting class probabilities for unlabeled **Query** samples in a **single forward pass** with no task-specific fine-tuning. In the accompanying paper, FAM is evaluated across **20 real-world datasets spanning 11 modalities**.
28
+
29
+ ---
30
+
31
+ ## Intended Use & Scope
32
+
33
+ ### Supported Use Cases
34
+ - **Task:** Supervised multimodal classification via in-context learning (`fit` stores labeled Context samples without updating model weights; `predict_proba` / `predict` performs inference on unlabeled Query samples).
35
+ - **Modalities:** **1 to 8 modalities** per task, supplied as finite 2D NumPy feature arrays `[n_samples, n_features]` with aligned sample rows (no `NaN` or `Inf` values).
36
+ - **Classes:** **2 to 10 classes**, contiguously integer-encoded starting from `0` (all target classes must appear in the Context set).
37
+ - **Feature Dimensionality:**
38
+ - **Structured modalities** (declared via `structured_modalities`) retain their original feature columns.
39
+ - **Unstructured modalities** accept up to 48 dimensions directly (`preprocessing="none"`), or higher-dimensional pre-extracted embeddings when `preprocessing="pca"` is enabled (Context-only PCA projection to 48 dimensions).
40
+ - **Hardware:** Requires a **CUDA-capable NVIDIA GPU** (CPU inference is not supported).
41
+
42
+ ### Out-of-Scope / Limitations
43
+ - **Pre-extracted features required:** FAM operates on numerical feature/embedding arrays rather than raw images, audio waveforms, or raw text strings; users extract modality embeddings with external encoders prior to calling FAM.
44
+ - **Classification only (2–10 classes):** Regression and >10-class classification are not supported by this checkpoint.
45
+
46
+ ---
47
+
48
+ ## Usage
49
+
50
+ ### 1. Install the Package
51
+
52
+ ```bash
53
+ git clone https://github.com/huizi-Cui/Fusion_Anything_Model.git
54
+ cd Fusion_Anything_Model
55
+
56
+ # Install PyTorch with CUDA support (adjust cu128 for your CUDA version)
57
+ pip install torch==2.9.0 torchvision==0.24.0 --index-url https://download.pytorch.org/whl/cu128
58
+
59
+ # Install Fusion Anything
60
+ pip install -e .
61
+ ```
62
+
63
+ ### 2. Download the Checkpoint
64
+
65
+ ```bash
66
+ huggingface-cli download FusionAnything/FAMv1 FAM.pt --local-dir checkpoints
67
+ ```
68
+
69
+ Alternatively, place `FAM.pt` anywhere and set `FAM_CHECKPOINT=/path/to/FAM.pt` or pass `checkpoint="/path/to/FAM.pt"` to `FusionAnythingClassifier`.
70
+
71
+ ### 3. Run Inference
72
+
73
+ ```python
74
+ import numpy as np
75
+ from fusion_anything import FusionAnythingClassifier
76
+
77
+ # Each modality is a finite 2D array of shape [n_samples, n_features]
78
+ context = {
79
+ "image": np.load("context_image.npy"),
80
+ "tabular": np.load("context_tabular.npy"),
81
+ }
82
+ labels = np.load("context_labels.npy") # 1D integer array, 0..K-1 (2 <= K <= 10)
83
+
84
+ query = {
85
+ "image": np.load("test_image.npy"),
86
+ "tabular": np.load("test_tabular.npy"),
87
+ }
88
+
89
+ model = FusionAnythingClassifier(device="cuda:0", preprocessing="pca")
90
+ model.fit(context, labels, structured_modalities=["tabular"])
91
+
92
+ probabilities = model.predict_proba(query) # shape: [n_query, n_classes]
93
+ predictions = model.classes_[probabilities.argmax(axis=1)]
94
+ ```
95
+
96
+ ---
97
+
98
+ ## License & Acknowledgments
99
+
100
+ - Released under the **[Apache License 2.0](https://github.com/huizi-Cui/Fusion_Anything_Model/blob/main/LICENSE)**.
101
+ - **Built with PriorLabs-TabPFN** — the underlying TabPFN v2 architecture runtime is subject to the [Prior Labs License](https://github.com/huizi-Cui/Fusion_Anything_Model/blob/main/fusion_anything/vendor/tabpfn_runtime/LICENSE).
102
+
103
+ ---
104
+
105
+ ## Citation
106
+
107
+ If you use FAM in your research, please cite:
108
+
109
+ ```bibtex
110
+ @article{cui2026fusion,
111
+ title={Fusion Anything: A Generalized Multimodal Foundation Model},
112
+ author={Cui, Huizi and Han, Zongbo and Ding, Chenggong and Xiao, Naichuan and Yang, Jialong and Chen, Jingdong and Wang, Guangyu and Hu, Qinghua and Zhang, Changqing},
113
+ journal={arXiv preprint arXiv:2609.22107},
114
+ year={2026}
115
+ }
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Contact
121
+
122
+ - **Huizi Cui** ([huizicui@tju.edu.cn](mailto:huizicui@tju.edu.cn)) — Data generation & FAM training
123
+ - **Chenggong Ding** ([chenggong_ding@tju.edu.cn](mailto:chenggong_ding@tju.edu.cn)) — FAM evaluation
124
+ - **Naichuan Xiao** ([xiaonaichuan@tju.edu.cn](mailto:xiaonaichuan@tju.edu.cn)) — Specialized model evaluation