facebookresearch / esm

Evolutionary Scale Modeling (esm): Pretrained language models for proteins
MIT License
3.26k stars 643 forks source link

Only CPU Malfunction -- HF Colab Notebook #451

Open coopersvajda opened 1 year ago

coopersvajda commented 1 year ago

Hello, I am trying to utilize ESM as made available in the HuggingFace Colab Notebook. I do not have a local GPU to use, so have been attempting the only CPU mode. The first issue is in preparing the model and tokenizer where it states " If using GPU, use model.cuda() to transfer the model to GPU." and the code below is:

from transformers import AutoTokenizer, EsmForProteinFolding

tokenizer = AutoTokenizer.from_pretrained("facebook/esmfold_v1") model = EsmForProteinFolding.from_pretrained("facebook/esmfold_v1", low_cpu_mem_usage=True)

model = model.cuda()**

To get around this, I simply removed the "model = model.cuda()" and the code ran fine. Next, down the line, I got to the Tokenization step which requires a GPU:

tokenized_input = tokenized_input.cuda()

Obviously when ran the error of "NO GPU" was displayed. So I went ahead and tried to run actual prediction lines:

import torch

with torch.no_grad(): output = model(tokenized_input)**

This displayed the following error:

RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'

So how are you supposed to run this sheet without a GPU? Is there something in the tokenization stage I should alter to provide good inputs for the prediction model?

chAwater commented 1 year ago