Instructions to use Nhoodie/omni-dna-hgt-lora-step1500 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Nhoodie/omni-dna-hgt-lora-step1500 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/mnt/storage/hf_cache/omni-dna-multitask-hgt") model = PeftModel.from_pretrained(base_model, "Nhoodie/omni-dna-hgt-lora-step1500") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: yahmaachi/omni-dna-multitask-1b
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- dna
|
| 8 |
+
- genomic
|
| 9 |
+
- horizontal-gene-transfer
|
| 10 |
+
- hgt
|
| 11 |
+
- omnidna
|
| 12 |
+
- qlora
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Omni-DNA-Multitask-1B HGT Detection LoRA (Step 1500)
|
| 16 |
+
|
| 17 |
+
## Model Description
|
| 18 |
+
|
| 19 |
+
QLoRA adapter for Omni-DNA-Multitask-1B fine-tuned for **Horizontal Gene Transfer (HGT) detection**.
|
| 20 |
+
|
| 21 |
+
Task: Binary classification - detect genomic islands (horizontally transferred genes).
|
| 22 |
+
|
| 23 |
+
- Training data: IslandViewer 4 (11,182 train / 2,796 eval, balanced)
|
| 24 |
+
- Format: DNA_sequence + HGT_detection_token + label (0 or 1)
|
| 25 |
+
- Novel token: Token 4117 (HGT_detection) added to vocabulary
|
| 26 |
+
|
| 27 |
+
## Training Configuration
|
| 28 |
+
|
| 29 |
+
| Parameter | Value |
|
| 30 |
+
|-----------|-------|
|
| 31 |
+
| LoRA Rank | 64 |
|
| 32 |
+
| LoRA Alpha | 128 |
|
| 33 |
+
| Target Modules | att_proj, attn_out, ff_proj, ff_out |
|
| 34 |
+
| LoRA Dropout | 0.05 |
|
| 35 |
+
| Quantization | 4-bit NF4 (QLoRA) |
|
| 36 |
+
| Trainable Params | ~46.1M |
|
| 37 |
+
| Learning Rate | 2e-4 (cosine) |
|
| 38 |
+
| Batch Size | 8 (grad accum 4) |
|
| 39 |
+
|
| 40 |
+
## Best Performance (Step 1300, Epoch 3.72)
|
| 41 |
+
|
| 42 |
+
| Metric | Value |
|
| 43 |
+
|--------|-------|
|
| 44 |
+
| AUC | 0.8736 |
|
| 45 |
+
| AP | 0.8735 |
|
| 46 |
+
| F1 | 0.6857 |
|
| 47 |
+
| Accuracy | 0.736 |
|
| 48 |
+
|
| 49 |
+
## AUC Trajectory
|
| 50 |
+
|
| 51 |
+
| Step | Epoch | AUC | F1 |
|
| 52 |
+
|------|-------|-----|-----|
|
| 53 |
+
| 100 | 0.29 | 0.6146 | 0.6967 |
|
| 54 |
+
| 200 | 0.57 | 0.7620 | 0.7399 |
|
| 55 |
+
| 300 | 0.86 | 0.8101 | 0.7069 |
|
| 56 |
+
| 400 | 1.14 | 0.8244 | 0.7172 |
|
| 57 |
+
| 500 | 1.43 | 0.8359 | 0.6844 |
|
| 58 |
+
| 600 | 1.72 | 0.8381 | 0.6697 |
|
| 59 |
+
| 700 | 2.00 | 0.8166 | 0.5854 |
|
| 60 |
+
| 800 | 2.29 | 0.8015 | 0.3593 |
|
| 61 |
+
| 900 | 2.57 | 0.8224 | 0.7445 |
|
| 62 |
+
| 1000 | 2.86 | 0.8213 | 0.5407 |
|
| 63 |
+
| 1100 | 3.14 | 0.8227 | 0.7000 |
|
| 64 |
+
| 1200 | 3.43 | 0.7214 | 0.3933 |
|
| 65 |
+
| 1300 | 3.72 | 0.8736 | 0.6857 **BEST** |
|
| 66 |
+
| 1400 | 4.00 | 0.8267 | 0.7701 |
|
| 67 |
+
| 1500 | 4.29 | 0.8389 | 0.7795 |
|
| 68 |
+
| 1600 | 4.57 | 0.8048 | 0.5260 |
|
| 69 |
+
| 1700 | 4.86 | 0.7646 | 0.4451 |
|
| 70 |
+
| 1800 | 5.14 | 0.7948 | 0.4070 |
|
| 71 |
+
| 1900 | 5.43 | 0.8115 | 0.5714 |
|
| 72 |
+
| 2000 | 5.72 | 0.7920 | 0.5168 |
|
| 73 |
+
| 2100 | 6.00 | 0.7985 | 0.5528 |
|
| 74 |
+
| 2200 | 6.29 | 0.7355 | 0.3631 |
|
| 75 |
+
| 2300 | 6.57 | 0.7689 | 0.3873 |
|
| 76 |
+
|
| 77 |
+
## Usage
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
from peft import PeftModel
|
| 81 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 82 |
+
import torch
|
| 83 |
+
|
| 84 |
+
base = AutoModelForCausalLM.from_pretrained('yahmaachi/omni-dna-multitask-1b')
|
| 85 |
+
tokenizer = AutoTokenizer.from_pretrained('yahmaachi/omni-dna-multitask-1b')
|
| 86 |
+
tokenizer.add_tokens(['HGT_detection'])
|
| 87 |
+
base.resize_token_embeddings(len(tokenizer))
|
| 88 |
+
|
| 89 |
+
model = PeftModel.from_pretrained(base, 'Nhoodie/omni-dna-hgt-lora-best')
|
| 90 |
+
model.eval()
|
| 91 |
+
|
| 92 |
+
dna = 'ATGCGATCGATCGATCGATC...' # your sequence
|
| 93 |
+
inputs = tokenizer(dna + 'HGT_detection', return_tensors='pt')
|
| 94 |
+
with torch.no_grad():
|
| 95 |
+
logits = model(**inputs).logits[:, -1, :]
|
| 96 |
+
prob = torch.softmax(logits, dim=-1)
|
| 97 |
+
# token 4097 = 1 (HGT), token 4096 = 0 (not HGT)
|
| 98 |
+
hgt_prob = prob[0, 4097].item()
|
| 99 |
+
print(f'HGT probability: {hgt_prob:.4f}')
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## Training Notes
|
| 103 |
+
|
| 104 |
+
The training exhibited an interesting collapse-recovery pattern: after initial overfitting
|
| 105 |
+
around epoch 2-3.4, the novel token (HGT_detection, #4117) underwent a representational
|
| 106 |
+
reorganization, leading to a new best AUC of 0.8736 at step 1300.
|
| 107 |
+
|
| 108 |
+
Steps 1300 and 1500 are sibling models - different representational equilibria rather than
|
| 109 |
+
descendant relationships. Step 1300 optimizes ranking (AUC), step 1500 optimizes classification (F1).
|
| 110 |
+
|
| 111 |
+
## License
|
| 112 |
+
|
| 113 |
+
MIT
|