kierandidi commited on
Commit
c961cc2
·
verified ·
1 Parent(s): 0b2b358

Document the Transformers checkpoint and its current limits

Browse files

Transformers generation is supported from the transformers/ subfolder. Partial diffusion and inverse folding are not: they call the autoencoder's encoder, and rfd4-proteina-prep does not yet emit incident_bond_type_counts or ground_truth_element. Ligand and atomized inputs stop with an error rather than conditioning on unaligned geometry. Diffusers remains on the previous release.

Files changed (1) hide show
  1. README.md +40 -15
README.md CHANGED
@@ -33,7 +33,7 @@ the root are the *native* weights, loaded by `Proteina.from_pretrained`.
33
  | Call | Weights | Location | Status |
34
  |---|---|---|---|
35
  | `Proteina.from_pretrained("nvidia/RFD4-Proteina")` | Native | root of this repo | **Supported** |
36
- | `Rfd4ProteinaModel.from_pretrained("nvidia/RFD4-Proteina", subfolder="transformers")` | Transformers | `transformers/` here | Pending |
37
  | `RFD4ProteinaPipeline.from_pretrained("nvidia/RFD4-Proteina-Diffusers")` | Diffusers | [its own repo](https://huggingface.co/nvidia/RFD4-Proteina-Diffusers) | Pending; still serves the previous release |
38
 
39
  It is one model throughout — nothing is retrained. The Diffusers weights are the same tensors
@@ -45,11 +45,18 @@ Diffusers needs `model_index.json` at the root of whatever it is pointed at, so
45
  repository. Annotated-CIF preprocessing for both libraries is in
46
  [`nvidia/RFD4-Proteina-prep`](https://huggingface.co/nvidia/RFD4-Proteina-prep).
47
 
48
- > **Only the native path runs this release.** The autoencoder in these weights uses a 147-class
49
- > residue vocabulary and a 32-dimensional latent, where the previous release used 33 classes and
50
- > 16 dimensions. Both library integrations are still written against the old vocabulary and
51
- > cannot convert these weights yet. `nvidia/RFD4-Proteina-Diffusers` still holds the **previous**
52
- > release — following its examples gives you the previous model, not this one.
 
 
 
 
 
 
 
53
 
54
  Training data lives in the companion [dataset repository](https://huggingface.co/datasets/nvidia/RFD4-Proteina).
55
 
@@ -177,17 +184,35 @@ print(list(Path("runs/enzyme/inference_samples").rglob("*_generated.cif*")))
177
 
178
  `from_pretrained` loads in evaluation mode on CPU by default; `run_generation` uses the native CUDA inference workflow. A local exported bundle directory also works as the model argument.
179
 
180
- ### Transformers and Diffusers
181
 
182
- **Neither works with this revision yet.** Both integrations are written against the previous
183
- release's 33-class residue vocabulary and 16-dimensional latent; these weights use 147 classes
184
- and a 32-dimensional latent, and both conversion paths reject them rather than load them
185
- incorrectly. Annotated-CIF preprocessing for both lives in the shared
186
- [`rfd4-proteina-prep`](https://huggingface.co/nvidia/RFD4-Proteina-prep) package, which needs the
187
- same vocabulary update.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
 
189
- Until that work lands, use the native path above. If you specifically need the Diffusers pipeline
190
- today, [`nvidia/RFD4-Proteina-Diffusers`](https://huggingface.co/nvidia/RFD4-Proteina-Diffusers)
191
  still serves the **previous** release pair — a different model from this one, with its own
192
  `provenance.json` recording which native revision it came from.
193
 
 
33
  | Call | Weights | Location | Status |
34
  |---|---|---|---|
35
  | `Proteina.from_pretrained("nvidia/RFD4-Proteina")` | Native | root of this repo | **Supported** |
36
+ | `Rfd4ProteinaModel.from_pretrained("nvidia/RFD4-Proteina", subfolder="transformers")` | Transformers | `transformers/` here | **Supported**, with limits below |
37
  | `RFD4ProteinaPipeline.from_pretrained("nvidia/RFD4-Proteina-Diffusers")` | Diffusers | [its own repo](https://huggingface.co/nvidia/RFD4-Proteina-Diffusers) | Pending; still serves the previous release |
38
 
39
  It is one model throughout — nothing is retrained. The Diffusers weights are the same tensors
 
45
  repository. Annotated-CIF preprocessing for both libraries is in
46
  [`nvidia/RFD4-Proteina-prep`](https://huggingface.co/nvidia/RFD4-Proteina-prep).
47
 
48
+ > **Diffusers is not updated yet.** `nvidia/RFD4-Proteina-Diffusers` still holds the **previous**
49
+ > release (33-class vocabulary, 16-dimensional latent) — following its examples gives you the
50
+ > previous model, not this one.
51
+ >
52
+ > **The Transformers checkpoint supports generation only, for now.** Preparing an annotated CIF
53
+ > uses [`rfd4-proteina-prep`](https://huggingface.co/nvidia/RFD4-Proteina-prep), which does not
54
+ > yet emit two features the unified autoencoder's encoder needs
55
+ > (`incident_bond_type_counts`, `ground_truth_element`). Plain generation only calls the decoder
56
+ > and works; **partial diffusion and inverse folding call the encoder and will fail.** Ligand and
57
+ > atomized inputs also stop with a clear error rather than conditioning on unaligned geometry,
58
+ > because chirality alignment needs fields prep does not emit. The published prep release also
59
+ > pins `atomworks==3.0.1` and is not yet updated for the 3.0.3 this release uses.
60
 
61
  Training data lives in the companion [dataset repository](https://huggingface.co/datasets/nvidia/RFD4-Proteina).
62
 
 
184
 
185
  `from_pretrained` loads in evaluation mode on CPU by default; `run_generation` uses the native CUDA inference workflow. A local exported bundle directory also works as the model argument.
186
 
187
+ ### Transformers
188
 
189
+ ```bash
190
+ pip install transformers git+https://huggingface.co/nvidia/RFD4-Proteina-prep
191
+ ```
192
+
193
+ ```python
194
+ import torch
195
+ from rfd4_proteina_prep import prepare_cif, write_cif
196
+ from transformers import Rfd4ProteinaModel
197
+
198
+ model = Rfd4ProteinaModel.from_pretrained(
199
+ "nvidia/RFD4-Proteina", subfolder="transformers", dtype=torch.bfloat16, device_map="cuda:0"
200
+ )
201
+ features, atoms = prepare_cif("input.cif", seed=42, device=model.device)
202
+ output = model.sample(features, generator=[torch.Generator("cuda:0").manual_seed(42)])
203
+ write_cif(output, features, atoms, "design.cif")
204
+ ```
205
+
206
+ `subfolder="transformers"` is required: a Transformers export writes `config.json` and
207
+ `model.safetensors`, the names the native bundle already occupies at the root. The sampler
208
+ settings (`sampler_args`, `recycle_depths`) are part of the config, not the weights, and this
209
+ checkpoint records the recipe resolved from the native inference config — 60 steps, 185 trunk
210
+ passes, matching `recycle_strategy=thinking_medium`. See the limits in the banner above:
211
+ generation works; partial diffusion and inverse folding do not yet.
212
+
213
+ ### Diffusers
214
 
215
+ Not updated for this release. [`nvidia/RFD4-Proteina-Diffusers`](https://huggingface.co/nvidia/RFD4-Proteina-Diffusers)
 
216
  still serves the **previous** release pair — a different model from this one, with its own
217
  `provenance.json` recording which native revision it came from.
218