--- library_name: transformers base_model: kuleshov-group/PlantCAD2-Large-l48-d1536 tags: - biology - genomics - DNA - bryophytes - masked-language-modeling - mamba2 --- # BryoCAD-Large BryoCAD-Large is a DNA foundation model adapted to bryophyte genomes through continued pre-training of [PlantCAD2-Large](https://huggingface.co/kuleshov-group/PlantCAD2-Large-l48-d1536). The model was further pre-trained on 17 phylogenetically diverse bryophyte genomes representing 17 orders across the three major bryophyte lineages: mosses, liverworts, and hornworts. ## Model overview BryoCAD-Large retains the bidirectional, reverse-complement-equivariant Mamba2 architecture of PlantCAD2. It processes DNA sequences at single-nucleotide resolution with a context length of 8,192 bp and uses a masked language modeling objective. | Property | Description | |---|---| | Base model | PlantCAD2-Large | | Architecture | Bidirectional, reverse-complement-equivariant Mamba2 | | Context length | 8,192 bp | | Tokenization | Single nucleotide | | Pre-training objective | Masked language modeling | | Continued pre-training data | 17 bryophyte genomes | During continued pre-training, training loss decreased from approximately 1.136 to 0.927, a reduction of 18.4%. The smaller model is available at [bryocad/BryoCAD-Small](https://huggingface.co/bryocad/BryoCAD-Small). ## Intended uses BryoCAD-Large is intended for research on bryophyte genomic sequences, including: - Zero-shot motif recovery. - Genomic sequence representation learning. - Genomic feature prediction. - Gene structure annotation workflows. The released checkpoint is a masked language model. Task-specific prediction or annotation may require additional scoring procedures, fine-tuning, or downstream models. ## Loading the model BryoCAD uses custom model code and requires a compatible PyTorch, Transformers, Mamba2, and CUDA environment. ```python import torch from transformers import AutoModelForMaskedLM, AutoTokenizer model_id = "bryocad/BryoCAD-Large" tokenizer = AutoTokenizer.from_pretrained( model_id, trust_remote_code=True, ) model = AutoModelForMaskedLM.from_pretrained( model_id, trust_remote_code=True, torch_dtype=torch.bfloat16, ).to("cuda").eval() ``` This example assumes a CUDA GPU with BF16 support. Review the repository's custom code before enabling `trust_remote_code=True`. ## Masked nucleotide prediction The following example masks one nucleotide and obtains the model's logits at that position. ```python sequence = "ACGT" * 2048 # Example input: 8,192 bp mask_position = 4096 # Zero-based nucleotide position inputs = tokenizer( sequence, return_tensors="pt", add_special_tokens=False, return_attention_mask=False, return_token_type_ids=False, ) input_ids = inputs["input_ids"] assert input_ids.shape[1] == len(sequence) input_ids[0, mask_position] = tokenizer.mask_token_id input_ids = input_ids.to("cuda") with torch.inference_mode(): logits = model(input_ids=input_ids).logits masked_position_logits = logits[0, mask_position] ``` The example illustrates model inference; the synthetic sequence is not a biological benchmark. For nucleotide prediction, restrict candidate tokens to A, C, G, and T rather than selecting from the full vocabulary. ## Limitations - Continued pre-training used 17 bryophyte genomes and does not represent all bryophyte diversity. - Performance may vary across species, genomic regions, and downstream tasks. - Reduced pre-training loss does not by itself establish improved downstream performance. - Predictions should be evaluated against independent biological evidence before use in annotation or interpretation. ## Availability and reproducibility This repository contains the model weights, configuration, tokenizer files, and custom model code required for loading the checkpoint. For reproducible analyses, record the repository revision and software environment used. ## Acknowledgments BryoCAD builds on PlantCAD2 and its associated model implementation. Please also acknowledge and cite the original PlantCAD2 work when using BryoCAD.