Instructions to use melmass/fab-s-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use melmass/fab-s-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download melmass/fab-s-mlx --local-dir fab-s-mlx
- SAM 3D Body
How to use melmass/fab-s-mlx with SAM 3D Body:
import cv2 import numpy as np from notebook.utils import setup_sam_3d_body from tools.vis_utils import visualize_sample_together estimator = setup_sam_3d_body("melmass/fab-s-mlx") img_bgr = cv2.imread("path/to/image.jpg") outputs = estimator.process_one_image(cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)) rend_img = visualize_sample_together(img_bgr, outputs, estimator.faces) cv2.imwrite("output.jpg", rend_img.astype(np.uint8)) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
FAB weights converted for MLXBody
Browse files- README.md +27 -0
- config.json +19 -0
- conversion.json +15 -0
- model.safetensors +3 -0
- parity/reference.safetensors +3 -0
- parity/reference_bf16.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: fab-weights-license
|
| 4 |
+
license_link: https://huggingface.co/noahcao/FAB/blob/main/WEIGHTS_LICENSE
|
| 5 |
+
library_name: mlx
|
| 6 |
+
tags:
|
| 7 |
+
- mlx
|
| 8 |
+
- human-mesh-recovery
|
| 9 |
+
- sam-3d-body
|
| 10 |
+
base_model: noahcao/FAB
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# FAB-S for MLX
|
| 14 |
+
|
| 15 |
+
FAB-S from [noahcao/FAB](https://huggingface.co/noahcao/FAB) (code: github.com/noahcao/FAB at ec65caf), converted for
|
| 16 |
+
an MLX port of SAM 3D Body: SAM 3D Body's prompt encoder, decoder, MHR and camera heads on FAB's distilled DINOv3
|
| 17 |
+
backbone (ViT-S+/16, 12 blocks), body pass only.
|
| 18 |
+
|
| 19 |
+
- `model.safetensors`: the student backbone under timm's names (`backbone.vit.*`, `backbone.proj.*`) in bfloat16, the
|
| 20 |
+
body decoder and heads in float32 under mlx-vlm's SAM 3D Body names, MLX layouts (Linear `[out, in]`, Conv2d
|
| 21 |
+
`[out, kh, kw, in]`). The Momentum Human Rig (`head_pose.body_model.*`), which FAB's checkpoint does not hold, is
|
| 22 |
+
taken from `mlx-community/sam-3d-body-dinov3-bf16`. The hand decoder and FAB's own heads (dense, contact,
|
| 23 |
+
visibility, G1) are left out.
|
| 24 |
+
- `conversion.json`: the source files and their hashes.
|
| 25 |
+
- `parity/`: FAB's own forward pass on one photo (CPU, float32), for the port's parity test.
|
| 26 |
+
|
| 27 |
+
Weights under FAB's weights licence (research and non-commercial use only); SAM 3D Body's and DINOv3's terms apply.
|
config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "fab_body",
|
| 3 |
+
"name": "FAB-S",
|
| 4 |
+
"timm_backbone": "dinov3_vits16plus",
|
| 5 |
+
"backbone_depth": 12,
|
| 6 |
+
"backbone_width": 384,
|
| 7 |
+
"backbone_heads": 6,
|
| 8 |
+
"backbone_mlp": "swiglu",
|
| 9 |
+
"register_tokens": 4,
|
| 10 |
+
"rope_temperature": 100,
|
| 11 |
+
"image_size": [
|
| 12 |
+
512,
|
| 13 |
+
512
|
| 14 |
+
],
|
| 15 |
+
"patch_size": 16,
|
| 16 |
+
"embed_dim": 1280,
|
| 17 |
+
"decoder_depth": 6,
|
| 18 |
+
"hand_pass": false
|
| 19 |
+
}
|
conversion.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source": "noahcao/FAB",
|
| 3 |
+
"source_file": "fab-s/model.pt",
|
| 4 |
+
"source_sha256": "f09fc382bd524c0eb6f60f1031fddb2e4023ae0572d6815ab2e4e1753635aaff",
|
| 5 |
+
"source_code": "github.com/noahcao/FAB ec65caf",
|
| 6 |
+
"rig_from": "mlx-community/sam-3d-body-dinov3-bf16 (head_pose.body_model.*)",
|
| 7 |
+
"rig_sha256": "879c3b6bc28c450ffc3722746bf1251e6c6b9b009eb4daadf6977065fde6af47",
|
| 8 |
+
"tensors": 546,
|
| 9 |
+
"dtypes": {
|
| 10 |
+
"torch.int32": 11,
|
| 11 |
+
"torch.bfloat16": 190,
|
| 12 |
+
"torch.float32": 342,
|
| 13 |
+
"torch.uint8": 3
|
| 14 |
+
}
|
| 15 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92aa6a7b12f338492d1fc79427fb32e913da605f4b8a4d3370a5119a649c24d8
|
| 3 |
+
size 975592127
|
parity/reference.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f99579435f5366ab4044078aa5d3a0b76d2055e881142a4933043f1c67dd9008
|
| 3 |
+
size 16758780
|
parity/reference_bf16.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a6c5c47519909cd97f980e6516446892355e6e03cba8fe0c916dcfe58fbe24e
|
| 3 |
+
size 16758780
|