Run this model with HF Jobs
Run ChatterjeeLab/FusOn-pLM on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ChatterjeeLab/FusOn-pLM. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ChatterjeeLab/FusOn-pLM on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ChatterjeeLab/FusOn-pLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ChatterjeeLab/FusOn-pLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="ChatterjeeLab/FusOn-pLM")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ChatterjeeLab/FusOn-pLM") model = AutoModelForMaskedLM.from_pretrained("ChatterjeeLab/FusOn-pLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files9 unmodified lines101112131415161718192021222324252627282930311 unmodified line33343526363738394041424344454647484935505152539 unmodified lines
```from transformers import AutoTokenizer, AutoModelimport loggingimport torch
# Suppress warnings about newly initialized 'esm.pooler.dense.bias', 'esm.pooler.dense.weight' layers - these are not used to extract embeddingslogging.getLogger("transformers.modeling_utils").setLevel(logging.ERROR)
# Set devicedevice = torch.device("cuda" if torch.cuda.is_available() else "cpu")print(f"Using device: {device}")
# Load the tokenizer and modelmodel_name = "ChatterjeeLab/FusOn-pLM" tokenizer = AutoTokenizer.from_pretrained(model_name)model = AutoModel.from_pretrained(model_name)model.to(device)model.eval()
# Example fusion oncoprotein sequence: MLLT10:PICALM, associated with Acute Myeloid Leukemia (LAML) # Amino acids 1-80 are derived from the head gene, MLLT101 unmodified linesequence = "MVSSDRPVSLEDEVSHSMKEMIGGCCVCSDERGWAENPLVYCDGHGCSVAVHQACYGIVQVPTGPWFCRKCESQERAARVPPQMGSVPVMTQPTLIYSQPVMRPPNPFGPVSGAQIQFM"
# Tokenize the input sequenceinputs = tokenizer(sequence, return_tensors="pt")inputs = tokenizer(sequence, return_tensors="pt", padding=True, truncation=True,max_length=2000)inputs = {k: v.to(device) for k, v in inputs.items()}
# Get the embeddingswith torch.no_grad(): outputs = model(**inputs) # The embeddings are in the last_hidden_state tensor embeddings = outputs.last_hidden_state # remove extra dimension embeddings = embeddings.squeeze(0) # remove BOS and EOS tokens embeddings = embeddings[1:-1, :]
# Convert embeddings to numpy array (if needed)embeddings = embeddings.squeeze(0).numpy()embeddings = embeddings.numpy()
print("Per-residue embeddings shape:", embeddings.shape)
README.md+17-2