Skip to content

MaayanLab/gsfm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GSFM

https://gsfm.maayanlab.cloud

The gene set foundation model training and benchmarking code.

Usage

pip install gsfm@git+https://github.com/MaayanLab/gsfm.git
import torch
from gsfm import Vocab, GSFM

# other model variants include:
#  maayanlab/gsfm-rummageo -- trained on rummageo only
#  maayanlab/gsfm-rummage -- trained on both rummagene and rummageo

# load gsfm vocabulary and model weights
vocab = Vocab.from_pretrained('maayanlab/gsfm-rummagene')
gsfm = GSFM.from_pretrained('maayanlab/gsfm-rummagene')
gsfm.eval()

# convert gene symbols into token ids
token_ids = torch.tensor(vocab(['ACE1', 'ACE2']))[None, :]

# use model to predict missing genes from the set
logits = torch.squeeze(gsfm(token_ids))
top_10 = sorted(zip(logits, vocab.vocab))[-10:]
top_10

# get model middle layer
gene_set_encoding = gsfm.encode(token_ids)
gene_set_encoding

About

The gene set foundation model training, evaluation, and benchmark code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published