Downloads · 30 days
7
6% of all-time downloads
tumorailab/LitGene_ContrastiveLearning
LitGene_ContrastiveLearning is a machine learning model from tumorailab. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
LitGene is a transformer-based model that learns rich gene representations by integrating textual information from the scientific literature with structured knowledge from the Gene Ontology (GO). Using contrastive lea…
Downloads · 30 days
7
6% of all-time downloads
All-time downloads
110
Public
Repo size
887 MB
Likes
0
Public
Click a slice to open those files.
.bin443 MB · 100%
From the Hugging Face model README
LitGene is a transformer-based model that learns rich gene representations by integrating textual information from the scientific literature with structured knowledge from the Gene Ontology (GO). Using contrastive learning, the model refines gene embeddings that capture both sequence and functional annotations, enabling improved prediction of protein properties, gene-disease associations, and functional annotations such as GO terms and KEGG pathways.
This repository provides model weights for the pre-trained LitGene model. It is intended to serve as a base representation model that can be further adapted/fine-tuned for specific biomedical tasks.
This model is intended to be used for any tasks that require interfacing with models . LitGene can be used for any of the following:
Below is the example (pytorch) code to import LitGene weights
import torch
from transformers import AutoModel, AutoTokenizer
# Load the model and tokenizer
model_name = "tumorailab/LitGene_ContrastiveLearning"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name)
# If you want to move the model to GPU
device = "cuda" if torch.cuda.is_available() else "cpu"
model = model.to(device)
below is example code to get embeddings for an example scentence
# Prepare your sentence
sentence = "Your text goes here"
# Tokenize the sentence
inputs = tokenizer(
sentence,
padding=True,
truncation=True,
max_length=512,
return_tensors="pt"
)
# Move inputs to the same device as model
inputs = {k: v.to(device) for k, v in inputs.items()}
# Get embeddings
with torch.no_grad():
model.eval()
outputs = model(**inputs)
# Get the CLS token embedding (first token)
print(outputs.last_hidden_state)
| Hyperparameter | Value |
|---|---|
| Embedding Dimension | 768 |
| Batch Size | 64 |
| Optimizer | AdamW |
| Learning Rate | 2e-5 (with linear decay) |
| Weight Decay | 0.01 |
| Contrastive Learning Loss Function | Margin-based ranking loss |
| Contrastive Loss Margin (δ) | 0.5 |
| Number of Training Steps | 100k |
| Dropout Rate | 0.1 |
| Gradient Clipping | 1.0 |