Instructions to use josephjojoe/chai-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use josephjojoe/chai-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir chai-mlx josephjojoe/chai-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Update precision policy docs and config
Browse filesDocument the new reference/float32 runtime policies and make the default explicit in config.json.
- README.md +29 -14
- config.json +7 -0
README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: mlx
|
| 4 |
tags:
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
pipeline_tag: other
|
| 10 |
---
|
| 11 |
|
|
@@ -28,9 +28,18 @@ converted from the upstream TorchScript distribution for use with the
|
|
| 28 |
| `model-feature_embedding.safetensors` | Feature embedding stack | 4.8 MB |
|
| 29 |
| `model-bond_loss_input_proj.safetensors` | Bond feature projection | 2 KB |
|
| 30 |
|
| 31 |
-
Total: **~1.2 GB**. All parameters are stored in `float32`;
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|
|
@@ -39,17 +48,23 @@ from huggingface_hub import snapshot_download
|
|
| 39 |
from chai_mlx import ChaiMLX
|
| 40 |
|
| 41 |
path = snapshot_download("josephjojoe/chai-mlx")
|
| 42 |
-
model = ChaiMLX.from_pretrained(path)
|
|
|
|
| 43 |
```
|
| 44 |
|
| 45 |
Or directly:
|
| 46 |
|
| 47 |
```python
|
| 48 |
model = ChaiMLX.from_pretrained("josephjojoe/chai-mlx")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
```
|
| 50 |
|
| 51 |
See the [chai-mlx README](https://github.com/josephjojoe/chai-mlx) for
|
| 52 |
-
featurization, inference, and CUDA-comparison workflows
|
|
|
|
| 53 |
|
| 54 |
## Provenance
|
| 55 |
|
|
@@ -66,11 +81,11 @@ for the pinned `chai-lab` SHA that the CUDA comparison harness runs against.
|
|
| 66 |
|
| 67 |
## Validation
|
| 68 |
|
| 69 |
-
On 1L2Y (Trp-cage, 20 residues), MLX-vs-CUDA (H100,
|
| 70 |
-
**0.75
|
| 71 |
-
CUDA vs NMR ground truth is 0.57
|
| 72 |
-
experimental truth than CUDA. GDT-TS between MLX and CUDA is 95.1%,
|
| 73 |
-
C
|
| 74 |
been validated; multimer and ligand targets are untested.
|
| 75 |
|
| 76 |
The remaining MLX-vs-CUDA gap is dominated by bf16 fused-kernel rounding
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: mlx
|
| 4 |
tags:
|
| 5 |
+
- mlx
|
| 6 |
+
- protein-structure-prediction
|
| 7 |
+
- chai-1
|
| 8 |
+
- biology
|
| 9 |
pipeline_tag: other
|
| 10 |
---
|
| 11 |
|
|
|
|
| 28 |
| `model-feature_embedding.safetensors` | Feature embedding stack | 4.8 MB |
|
| 29 |
| `model-bond_loss_input_proj.safetensors` | Bond feature projection | 2 KB |
|
| 30 |
|
| 31 |
+
Total: **~1.2 GB**. All parameters are stored in `float32`; runtime
|
| 32 |
+
precision is selected by `compute_dtype`:
|
| 33 |
+
|
| 34 |
+
- `reference` (default): matches the reference bundle's mixed-precision
|
| 35 |
+
boundary. Trunk / confidence run in bf16 where the TorchScript graphs do,
|
| 36 |
+
while diffusion and other preserved numerically sensitive parameters stay
|
| 37 |
+
in fp32.
|
| 38 |
+
- `float32`: keeps the MLX port in fp32 throughout.
|
| 39 |
+
|
| 40 |
+
The shipped `config.json` sets `config_version` to `"1"` and
|
| 41 |
+
`compute_dtype` to `"reference"`, so `ChaiMLX.from_pretrained(...)`
|
| 42 |
+
picks up the reference precision policy by default.
|
| 43 |
|
| 44 |
## Usage
|
| 45 |
|
|
|
|
| 48 |
from chai_mlx import ChaiMLX
|
| 49 |
|
| 50 |
path = snapshot_download("josephjojoe/chai-mlx")
|
| 51 |
+
model = ChaiMLX.from_pretrained(path) # default: compute_dtype="reference"
|
| 52 |
+
model_fp32 = ChaiMLX.from_pretrained(path, compute_dtype="float32")
|
| 53 |
```
|
| 54 |
|
| 55 |
Or directly:
|
| 56 |
|
| 57 |
```python
|
| 58 |
model = ChaiMLX.from_pretrained("josephjojoe/chai-mlx")
|
| 59 |
+
model_fp32 = ChaiMLX.from_pretrained(
|
| 60 |
+
"josephjojoe/chai-mlx",
|
| 61 |
+
compute_dtype="float32",
|
| 62 |
+
)
|
| 63 |
```
|
| 64 |
|
| 65 |
See the [chai-mlx README](https://github.com/josephjojoe/chai-mlx) for
|
| 66 |
+
featurization, inference, and CUDA-comparison workflows, including the
|
| 67 |
+
CLI `--dtype reference|float32` switch.
|
| 68 |
|
| 69 |
## Provenance
|
| 70 |
|
|
|
|
| 81 |
|
| 82 |
## Validation
|
| 83 |
|
| 84 |
+
On 1L2Y (Trp-cage, 20 residues), MLX-vs-CUDA (H100, `compute_dtype="reference"`)
|
| 85 |
+
C-alpha RMSD is **0.75 A mean** across 15 sample pairs (3 seeds x 5 diffusion
|
| 86 |
+
samples); CUDA vs NMR ground truth is 0.57 A mean, so MLX sits ~0.26 A further
|
| 87 |
+
from experimental truth than CUDA. GDT-TS between MLX and CUDA is 95.1%,
|
| 88 |
+
C-alpha lDDT 89.8%. Monomers up to ~76 residues (1L2Y, 1VII, 1CRN, 1UBQ) have
|
| 89 |
been validated; multimer and ligand targets are untested.
|
| 90 |
|
| 91 |
The remaining MLX-vs-CUDA gap is dominated by bf16 fused-kernel rounding
|
config.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"feature_dims": {
|
| 3 |
"token": 2638,
|
| 4 |
"token_pair": 163,
|
|
@@ -92,6 +93,7 @@
|
|
| 92 |
21.375
|
| 93 |
]
|
| 94 |
},
|
|
|
|
| 95 |
"supported_token_sizes": [
|
| 96 |
256,
|
| 97 |
384,
|
|
@@ -101,6 +103,11 @@
|
|
| 101 |
1536,
|
| 102 |
2048
|
| 103 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
"attention_mask_value": -10000.0,
|
| 105 |
"layer_norm_eps": 1e-05,
|
| 106 |
"centroid_eps": 0.0001,
|
|
|
|
| 1 |
{
|
| 2 |
+
"config_version": "1",
|
| 3 |
"feature_dims": {
|
| 4 |
"token": 2638,
|
| 5 |
"token_pair": 163,
|
|
|
|
| 93 |
21.375
|
| 94 |
]
|
| 95 |
},
|
| 96 |
+
"compute_dtype": "reference",
|
| 97 |
"supported_token_sizes": [
|
| 98 |
256,
|
| 99 |
384,
|
|
|
|
| 103 |
1536,
|
| 104 |
2048
|
| 105 |
],
|
| 106 |
+
"template_restype_vocab": 33,
|
| 107 |
+
"template_restype_embed_dim": 32,
|
| 108 |
+
"num_rbf_radii": 6,
|
| 109 |
+
"distance_rbf_scale": 4.8,
|
| 110 |
+
"pocket_rbf_scale": 2.8,
|
| 111 |
"attention_mask_value": -10000.0,
|
| 112 |
"layer_norm_eps": 1e-05,
|
| 113 |
"centroid_eps": 0.0001,
|