Downloads · 30 days
17
14% of all-time downloads
stephaniesamm/nucleotide-transformer-v2-50m-multi-species-finetuned-human-enhancers-cohn
nucleotide-transformer-v2-50m-multi-species-finetuned-human-enhancers-cohn is a text classification model from stephaniesamm. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as cc-by-nc-sa-4.0.
Binary DNA-sequence classifier fine-tuned from InstaDeepAI/nucleotide-transformer-v2-50m-multi-species on the Genomic Benchmarks Cohn human-enhancer dataset. Class 0 is negative/non-enhancer and class 1 is positive/en…
Downloads · 30 days
17
14% of all-time downloads
All-time downloads
125
Public
Parameters
53.8M
215 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors215 MB · 100%
From the Hugging Face model README
Binary DNA-sequence classifier fine-tuned from
InstaDeepAI/nucleotide-transformer-v2-50m-multi-species
on the Genomic Benchmarks Cohn human-enhancer dataset. Class 0 is
negative/non-enhancer and class 1 is positive/enhancer.
katarinagresova/Genomic_Benchmarks_human_enhancers_cohn2e-532 with 2 gradient-accumulation steps (effective batch size 64 on one GPU)3; training stopped after epoch 442The best validation checkpoint was epoch 1 and was restored before test evaluation.
Results on the held-out test split using the checkpoint selected by validation F1:
| Metric | Value |
|---|---|
| Accuracy | 0.7311 |
| Weighted F1 | 0.7301 |
This repository contains custom model code and therefore requires
trust_remote_code=True.
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo_id = (
"stephaniesamm/"
"nucleotide-transformer-v2-50m-multi-species-finetuned-human-enhancers-cohn"
)
# Load the DNA tokenizer and fine-tuned classifier.
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForSequenceClassification.from_pretrained(
repo_id,
trust_remote_code=True,
)
# Use evaluation mode for prediction rather than training.
model.eval()
# The model was fine-tuned on 500-base-pair sequences.
sequence = "ACGT" * 125
# Convert the DNA sequence into the model's token IDs and attention mask.
inputs = tokenizer(
sequence,
return_tensors="pt",
padding="max_length",
truncation=True,
max_length=86,
)
# Run inference without calculating training gradients, then convert the two
# raw class scores (logits) into scores that sum to 1.
with torch.no_grad():
class_scores = torch.softmax(model(**inputs).logits, dim=-1)[0]
# Select the class with the larger score and map its ID to a readable label.
label_names = {0: "negative/non-enhancer", 1: "positive/enhancer"}
predicted_id = int(class_scores.argmax())
print(label_names[predicted_id], float(class_scores[predicted_id]))
The repository includes train.py and pinned dependencies in
requirements.txt. Install them with:
pip install -r requirements.txt
PyTorch builds are platform- and CUDA-specific. If the pinned PyTorch package is not compatible with your system, install the appropriate build using the official PyTorch installation guide before installing the remaining dependencies.
See the publications for the Nucleotide Transformer and Genomic Benchmarks.