CoolFace
Modelpublic

Nhoodie/omni-dna-hgt-lora-best

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes10downloads
Model Card

Omni-DNA-Multitask-1B HGT Detection LoRA (Step 1300 (best))

Model Description

QLoRA adapter for Omni-DNA-Multitask-1B fine-tuned for Horizontal Gene Transfer (HGT) detection.

Task: Binary classification - detect genomic islands (horizontally transferred genes).

  • —Training data: IslandViewer 4 (11,182 train / 2,796 eval, balanced)
  • —Format: DNAsequence + HGTdetection_token + label (0 or 1)
  • —Novel token: Token 4117 (HGT_detection) added to vocabulary

Training Configuration

ParameterValue
LoRA Rank64
LoRA Alpha128
Target Modulesattproj, attnout, ffproj, ffout
LoRA Dropout0.05
Quantization4-bit NF4 (QLoRA)
Trainable Params~46.1M
Learning Rate2e-4 (cosine)
Batch Size8 (grad accum 4)

Best Performance (Step 1300, Epoch 3.72)

MetricValue
AUC0.8736
AP0.8735
F10.6857
Accuracy0.736

AUC Trajectory

StepEpochAUCF1
1000.290.61460.6967
2000.570.76200.7399
3000.860.81010.7069
4001.140.82440.7172
5001.430.83590.6844
6001.720.83810.6697
7002.000.81660.5854
8002.290.80150.3593
9002.570.82240.7445
10002.860.82130.5407
11003.140.82270.7000
12003.430.72140.3933
13003.720.87360.6857 BEST
14004.000.82670.7701
15004.290.83890.7795
16004.570.80480.5260
17004.860.76460.4451
18005.140.79480.4070
19005.430.81150.5714
20005.720.79200.5168
21006.000.79850.5528
22006.290.73550.3631
23006.570.76890.3873

Usage

python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

base = AutoModelForCausalLM.from_pretrained('yahmaachi/omni-dna-multitask-1b')
tokenizer = AutoTokenizer.from_pretrained('yahmaachi/omni-dna-multitask-1b')
tokenizer.add_tokens(['HGT_detection'])
base.resize_token_embeddings(len(tokenizer))

model = PeftModel.from_pretrained(base, 'Nhoodie/omni-dna-hgt-lora-best')
model.eval()

dna = 'ATGCGATCGATCGATCGATC...'  # your sequence
inputs = tokenizer(dna + 'HGT_detection', return_tensors='pt')
with torch.no_grad():
    logits = model(**inputs).logits[:, -1, :]
    prob = torch.softmax(logits, dim=-1)
    # token 4097 = 1 (HGT), token 4096 = 0 (not HGT)
    hgt_prob = prob[0, 4097].item()
print(f'HGT probability: {hgt_prob:.4f}')

Training Notes

The training exhibited an interesting collapse-recovery pattern: after initial overfitting around epoch 2-3.4, the novel token (HGT_detection, #4117) underwent a representational reorganization, leading to a new best AUC of 0.8736 at step 1300.

Steps 1300 and 1500 are sibling models - different representational equilibria rather than descendant relationships. Step 1300 optimizes ranking (AUC), step 1500 optimizes classification (F1).

License

MIT