Instructions to use bryocad/BryoCAD-Small-ATAC-Mpolymorpha-Ctrl-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use bryocad/BryoCAD-Small-ATAC-Mpolymorpha-Ctrl-LoRA with PEFT:
from peft import PeftModel from transformers import AutoModelForSequenceClassification base_model = AutoModelForSequenceClassification.from_pretrained("bryocad/BryoCAD-Small") model = PeftModel.from_pretrained(base_model, "bryocad/BryoCAD-Small-ATAC-Mpolymorpha-Ctrl-LoRA") - Notebooks
- Google Colab
- Kaggle
BryoCAD-Small-ATAC-Mpolymorpha-Ctrl-LoRA
This repository provides a LoRA adapter for binary chromatin-accessibility prediction using the BryoCAD-Small DNA foundation model. The adapter was fine-tuned on control-condition ATAC-seq data from Marchantia polymorpha and corresponds to the final checkpoint at 4,000 optimizer steps used in the BryoCAD study.
This is an adapter checkpoint, not a standalone foundation model. Inference requires the compatible BryoCAD-Small backbone, its sequence-classification implementation, and the trained classification head.
Training data
Training examples were derived from control-condition ATAC-seq peaks from M. polymorpha (GSE290177), using the MpTak v6 reference genome. Positive examples were 512-bp windows centered on peak summits. Negative examples were non-overlapping 512-bp genomic windows from chromosomes and scaffolds containing annotated peaks, excluding windows overlapping any peak. Windows extending beyond reference sequence boundaries or containing ambiguous bases were removed. Eligible negatives were retained without GC matching or class balancing.
Chromosomes 7 and 8 were reserved for validation. The remaining eligible chromosomes and scaffolds were used for training.
| Split | Positive windows | Negative windows |
|---|---|---|
| Training | 32,186 | 265,052 |
| Validation | 8,858 | 62,228 |
Fine-tuning
LoRA was applied to x_proj, in_proj, and out_proj, with rank 8, alpha 32, and dropout 0.1. The training objective was unweighted two-class cross-entropy loss. The final checkpoint, rather than a validation-selected checkpoint, was used for evaluation.
Prediction and evaluation
The two output classes are negative (0) and positive (1). The positive-class softmax probability is used as the accessibility score. Classification uses the class with the higher predicted probability, without decision-threshold optimization.
In the accompanying study, transfer performance was evaluated without additional fine-tuning on M. polymorpha heat-stress ATAC-seq data from GSE290177 and Arabidopsis thaliana control and heat-stress DNase-seq data from GSE145742. Evaluation used AUROC and F1. Marchantia heat-stress evaluation was restricted to the held-out chromosomes 7 and 8.
Inference
The input is a 512-bp DNA sequence. Use the BryoCAD-Small tokenizer without special tokens and the sequence-classification architecture used for fine-tuning. Class 0 is negative; class 1 is positive. The trained score classification head is included in the adapter weights.
The example requires a compatible PyTorch, Transformers, PEFT, Mamba2, and CUDA environment. Private repositories require prior Hugging Face authentication. Review the custom model code before using trust_remote_code=True.
import torch
from peft import PeftConfig, PeftModel
from transformers import AutoModelForSequenceClassification, AutoTokenizer
adapter_id = "bryocad/BryoCAD-Small-ATAC-Mpolymorpha-Ctrl-LoRA"
config = PeftConfig.from_pretrained(adapter_id)
base_kwargs = {"revision": config.revision} if config.revision else {}
tokenizer = AutoTokenizer.from_pretrained(
config.base_model_name_or_path,
trust_remote_code=True,
**base_kwargs,
)
base = AutoModelForSequenceClassification.from_pretrained(
config.base_model_name_or_path,
trust_remote_code=True,
num_labels=2,
id2label={0: "NEGATIVE", 1: "POSITIVE"},
label2id={"NEGATIVE": 0, "POSITIVE": 1},
torch_dtype=torch.float32,
**base_kwargs,
)
# The trained classification head is restored here, together with LoRA weights.
model = PeftModel.from_pretrained(base, adapter_id).to("cuda").eval()
sequence = "ACGT" * 128 # Synthetic 512-bp input for a smoke test.
assert len(sequence) == 512
encoded = tokenizer(
sequence,
return_tensors="pt",
add_special_tokens=False,
padding="max_length",
truncation=True,
max_length=512,
)
input_ids = encoded["input_ids"].to("cuda")
assert input_ids.shape == (1, 512)
with torch.inference_mode():
logits = model(input_ids=input_ids).logits
assert logits.shape == (1, 2)
assert torch.isfinite(logits).all()
probability_positive = torch.softmax(logits.float(), dim=-1)[0, 1].item()
print("Positive-class probability:", probability_positive)
This synthetic input tests inference only; it is not a biological validation example. A newly initialized sequence-classification head may be reported when loading the backbone; the saved trained head is then restored by the adapter-loading step. Unexpected missing task-head weights at the adapter-loading step should be investigated.
For reproducible analyses, record the backbone and adapter commit SHAs and software versions. Validate the released checkpoint against the original checkpoint on the same inputs and settings before reporting reproducibility.
Repository contents
adapter_config.json: LoRA configuration and backbone reference.adapter_model.safetensors: saved LoRA weights and the trained two-classscorehead.README.md: model description and usage requirements.
The backbone weights are distributed separately. Optimizer, scheduler, and random-number-generator states are not required for inference.
Limitations
Training used one species and one experimental condition. Cross-species and cross-condition performance should be evaluated independently for each intended application. Predictions are sequence-based accessibility scores, not direct measurements of chromatin accessibility in a particular tissue or experimental sample. Class imbalance and negative-sampling choices should be considered when interpreting classification metrics and scores.
Acknowledgments
This model builds on BryoCAD-Small, PlantCAD2, and LoRA. Please cite the corresponding methods, the BryoCAD study, and the source experimental datasets when using these resources.
- Downloads last month
- 17
Model tree for bryocad/BryoCAD-Small-ATAC-Mpolymorpha-Ctrl-LoRA
Base model
kuleshov-group/PlantCAD2-Small-l24-d0768